Repository navigation
Commit 6410029
<!-- claude-projects-attribution: {"github_login":"os-elon-musk"} -->
_Requested by **Elon** · [project
thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9DWbd6ULfZV9gLaW3DrBhtG4)_
Part of #23181 (slice 19, `@objectstack/runtime`). The card is a series
and stays open.
Clause-②: no
Metadata-protocol: none
Test-only diff: `skip-changeset`. Three files under
`packages/runtime/src/`, all `*.test.ts`; `@objectstack/runtime`'s
`files[]` ships `dist` only.
## 维护者速读
- 改了什么:runtime 包 3 个测试文件。`meta-list-projection-parity`
的普查用例改为每个调用者复用一对已启动的
dispatcher/RestServer;`mcp-package-object-discovery` 在模块顶层先付两种形态的首次启动;它和
`stored-metadata-reader-contexts.pin` 在第 2 行加 `// test-budget:`
声明。只动测试文件。
- 为什么改:卡 #23181 要求单个测试文件不超过 10 s;这三个文件在最近一次计时刷新里分别是 13.60、14.93、16.31 s。
- 风险与回滚:不改断言、超时与分层;复用前后 6,136 次读取逐字节一致(一次性证明,见下);整包 8,834 个用例名前后一致。回滚即
revert 本 PR。
- 先看:`packages/runtime/src/domains/meta-list-projection-parity.test.ts`
的 `censusPair`(复用的依据写在注释里);`mcp-package-object-discovery.test.ts` 第 2
行与模块顶层预热那一行。
- 两分钟验证:`pnpm --filter @objectstack/runtime exec vitest run --project
repo --maxWorkers=2 src/domains/meta-list-projection-parity.test.ts`,预期
879 个用例全绿,文件耗时约为 main 上的一半。
- 需要你做的:无,席位落地。
## What changes
The newest per-file reading is the weekly shard-timings refresh of
2026-10-26 (job 121418010419 in run 40275747937, refresh PR #25960's
window, hourly runs 40200279306 to 40272142430); no refresh has run
since. It lists three `@objectstack/runtime` files over 10 s:
`src/stored-metadata-reader-contexts.pin.test.ts` 16.31 s,
`src/domains/mcp-package-object-discovery.test.ts` 14.93 s and
`src/domains/meta-list-projection-parity.test.ts` (repo project) 13.60
s, all in run 40200279306. The card's two older runtime rows,
`src/declared-capability-absence-warn-once.test.ts` and
`src/stored-metadata-body-boundary.pin.test.ts`, are not in that list
and read 0.1 s and 3.7 s here, so this slice leaves them alone.
**Fixture reuse: `meta-list-projection-parity`.** Its four census blocks
(row A, the item read, the layered route, the book tree) booted a fresh
dispatcher and a fresh `RestServer` (with its `registerRoutes()`) for
every caller of every cell. The file booted a dispatcher 3,179 times,
nearly all in these blocks, and a `RestServer` as often; in one
instrumented run the boots took 1.53 s (`RestServer`) and 0.42 s
(dispatcher) of a 3.73 s file. They now read through one pair per caller
(`censusPair`), booted on its first cell. Neither transport keeps an
answer between two GET reads (`RestServer`'s `execCtxMemo` is a
`WeakMap` keyed on the request object; the dispatcher's
`membershipCache` is keyed on an environment no read here names), and
every protocol-double read clones its fixture. The blocks that assert on
a double's calls, or boot with options, still boot their own.
**Module-scope first boots: `mcp-package-object-discovery`.** Each
shape's first kernel boot was its slow one (276 and 163 ms against 45 to
131 ms for the other 22, isolated), paid inside a `beforeAll`. One
module-scope line boots and shuts down the first describe's own fixture
in each shape, before any hook runs (AGENTS.md: clocked windows measure
behaviour, never loading).
**Budget headers (ruling record 6181973363, letter B).** Two files stay
over 10 s on CI by the measured ratio here (CI read these three at about
3.5 to 5 times the local file time), and each boots the real stack per
fixture: one line at line 2, `// test-budget: N — spawns the real
producer once per single-cause fixture: REASON`, N = the slowest CI
reading x 1.25, rounded up to the next 10 s.
| file | change | slowest CI reading (s) | budget |
|:--|:--|--:|--:|
| `src/domains/meta-list-projection-parity.test.ts` | census reuse |
13.60 | none (expected under 10 s) |
| `src/domains/mcp-package-object-discovery.test.ts` | module-scope
first boots + header | 14.93 | 20 |
| `src/stored-metadata-reader-contexts.pin.test.ts` | header only (its
first loads were already paid at module scope) | 16.31 | 30 |
The class follows the precedent
`packages/verify/src/held-session-vendor-admin-doors.pin.test.ts` set
for one in-process boot followed by per-case door runs.
## Tests
Per-file readings, vitest's own file line (what the refresh lane reads)
and process wall, 3 isolated runs each, `--maxWorkers=2`, on a shared 4
vCPU container, before (`bc496bf7`, the three files checked out from the
base) and after (`1a5d0aea`):
| file | before r1/r2/r3 (s) | after r1/r2/r3 (s) | wall before / after
(s) |
|:--|:--|:--|:--|
| meta-list-projection-parity | 3.58 / 3.10 / 2.96 | 1.50 / 1.37 / 1.40
| 21.1, 20.0, 19.0 / 17.2, 17.5, 17.3 |
| mcp-package-object-discovery | 2.75 / 2.93 / 2.72 | 2.49 / 2.77 / 2.43
| 19.4, 19.5, 18.6 / 18.8, 19.0, 18.3 |
| stored-metadata-reader-contexts.pin | 3.33 / 3.18 / 2.92 | 3.10 / 2.89
/ 3.06 | 23.1, 23.4, 21.2 / 22.3, 21.8, 21.3 |
The wall is mostly the package's import graph (transform about 11 s,
import about 15 s per isolated run), which collection pays and no clock
in the refresh lane reads.
Whole package, both vitest projects, before and after: `local` `Test
Files 483 passed (483)`, `Tests 7870 passed | 19 skipped (7889)`; `repo`
`Test Files 3 passed (3)`, `Tests 948 passed (948)`, the same on both
sides. Name census over the two JSON reports: 8,834 test names before
and after, 0 lost, 0 new, 0 with a changed status.
<details><summary>The reuse proof (one-time, not kept)</summary>
A temporary wrapper made every census read go through both the reused
pair and a freshly booted pair, compared the two answers as JSON
(status, code, body, items, item and the four headers), and threw on any
difference. Run on the after tree: `Tests 879 passed (879)`, 6,136 reads
compared, 0 diverged. Reverted before the readings above; `git diff
HEAD` was empty after.
</details>
<details><summary>Header parse</summary>
Both lines parse through `readTestBudget`
(`scripts/measure-test-shard-timings.mjs`): budgets 20 and 30 at line 2,
class `spawns the real producer once per single-cause fixture`;
`meta-list-projection-parity` declares none.
</details>
`pnpm --filter @objectstack/runtime typecheck`: VERDICT command-exit 0
(`check:test-typecheck: OK`, 188 errors / 68 pinned signatures held,
unchanged). No ablation: no tested behaviour changed.
## Acceptance notes
- The newest reading also lists `domain:server` packages that are not on
the card's list: `@objectstack/plugin-audit`
(`src/parent-record-read-leaf.integration.test.ts` 35.78 s,
`src/comment-parent-pair.integration.test.ts` 28.07 s),
`@objectstack/metadata`
(`src/serializers/typescript-serializer-annotation.test.ts` 23.74 s),
`@objectstack/plugin-pinyin-search`
(`src/boot-reconcile.integration.test.ts` 17.47 s),
`@objectstack/plugin-security` (16.02, 13.48 s),
`@objectstack/plugin-auth` (13.74, 13.38 s). Noted for the card's list;
out of this slice.
- `mcp-package-object-discovery` may still read over 10 s on CI after
its warm-up (local cut about 8 %), which is why it carries a header;
`meta-list-projection-parity` carries none, and the next refresh is the
reading that says whether it is under.
- Branch `claude/project-thread-388dl6` is the card thread's
platform-assigned branch; claim 6520622267 names it.
## Verification
Local, on `1a5d0aea`: `node scripts/pm/dispatch-gates.mjs --commands`
derived 49 families; each run with its exit captured by redirect before
any pipe, plus `pnpm lint`. 48 exit 0 and `pnpm lint` exit 0; `pnpm
check:dual-build-cjs-loads` exit 3 (packages outside the runtime closure
have no `dist`), NOT MEASURED here and CI's. `--ran`: `49 derived
famil(ies) accounted for — 48 run, 1 NOT-MEASURED (1 DERIVED from a
recorded exit 3)`, exit 0.
---
_Generated by [Claude
Code](https://claude.ai/code/session_016WV4cwb48o186kZzEGZ9a1)_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_016WV4cwb48o186kZzEGZ9a1
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 8cb8c7f commit 6410029
3 files changed
Lines changed: 35 additions & 8 deletions
File tree
- packages/runtime/src
- domains
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
275 | 276 | | |
276 | 277 | | |
277 | 278 | | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
278 | 286 | | |
279 | 287 | | |
280 | 288 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
484 | 484 | | |
485 | 485 | | |
486 | 486 | | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
487 | 505 | | |
488 | 506 | | |
489 | 507 | | |
| |||
636 | 654 | | |
637 | 655 | | |
638 | 656 | | |
639 | | - | |
640 | | - | |
| 657 | + | |
| 658 | + | |
641 | 659 | | |
642 | 660 | | |
643 | 661 | | |
| |||
996 | 1014 | | |
997 | 1015 | | |
998 | 1016 | | |
999 | | - | |
1000 | | - | |
| 1017 | + | |
| 1018 | + | |
1001 | 1019 | | |
1002 | 1020 | | |
1003 | 1021 | | |
| |||
1059 | 1077 | | |
1060 | 1078 | | |
1061 | 1079 | | |
1062 | | - | |
1063 | | - | |
| 1080 | + | |
| 1081 | + | |
1064 | 1082 | | |
1065 | 1083 | | |
1066 | 1084 | | |
| |||
1226 | 1244 | | |
1227 | 1245 | | |
1228 | 1246 | | |
1229 | | - | |
1230 | | - | |
| 1247 | + | |
| 1248 | + | |
1231 | 1249 | | |
1232 | 1250 | | |
1233 | 1251 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
0 commit comments