Repository navigation
test(runtime): reuse the census transports, pay first boots at module scope, and declare two budgets (#23181 slice 19) - #28081
Merged
Conversation
…ule scope; declare budgets on two files (#23181 slice 19) meta-list-projection-parity reads its four census blocks through one booted dispatcher/RestServer pair per caller instead of booting a fresh pair per caller per cell. mcp-package-object-discovery pays each shape's first kernel boot at module scope. It and stored-metadata-reader-contexts carry a ruled test-budget header (ruling record 6181973363, letter B). Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cwb48o186kZzEGZ9a1
Contributor
📓 Docs Drift CheckNothing in this diff resolved to a documentable surface (no symbol, route or SDK anchor derived from 0 changed package(s)), so this run has no opinion about the docs. What this run could not see
Coarse fallback — 0 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): |
Contributor
Author
|
domain:server#1 · os-elon-musk · session_016WV4czVnUdQQCVKSW5J2uk Seat ACCEPT · PR #28081 · head
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Elon · project thread
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 underpackages/runtime/src/, all*.test.ts;@objectstack/runtime'sfiles[]shipsdistonly.维护者速读
meta-list-projection-parity的普查用例改为每个调用者复用一对已启动的 dispatcher/RestServer;mcp-package-object-discovery在模块顶层先付两种形态的首次启动;它和stored-metadata-reader-contexts.pin在第 2 行加// test-budget:声明。只动测试文件。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/runtimefiles over 10 s:src/stored-metadata-reader-contexts.pin.test.ts16.31 s,src/domains/mcp-package-object-discovery.test.ts14.93 s andsrc/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.tsandsrc/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 freshRestServer(with itsregisterRoutes()) for every caller of every cell. The file booted a dispatcher 3,179 times, nearly all in these blocks, and aRestServeras 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'sexecCtxMemois aWeakMapkeyed on the request object; the dispatcher'smembershipCacheis 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 abeforeAll. 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.src/domains/meta-list-projection-parity.test.tssrc/domains/mcp-package-object-discovery.test.tssrc/stored-metadata-reader-contexts.pin.test.tsThe class follows the precedent
packages/verify/src/held-session-vendor-admin-doors.pin.test.tsset 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):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:
localTest Files 483 passed (483),Tests 7870 passed | 19 skipped (7889);repoTest 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.The reuse proof (one-time, not kept)
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 HEADwas empty after.Header parse
Both lines parse through
readTestBudget(scripts/measure-test-shard-timings.mjs): budgets 20 and 30 at line 2, classspawns the real producer once per single-cause fixture;meta-list-projection-paritydeclares none.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
domain:serverpackages that are not on the card's list:@objectstack/plugin-audit(src/parent-record-read-leaf.integration.test.ts35.78 s,src/comment-parent-pair.integration.test.ts28.07 s),@objectstack/metadata(src/serializers/typescript-serializer-annotation.test.ts23.74 s),@objectstack/plugin-pinyin-search(src/boot-reconcile.integration.test.ts17.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-discoverymay 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-paritycarries none, and the next refresh is the reading that says whether it is under.claude/project-thread-388dl6is the card thread's platform-assigned branch; claim 6520622267 names it.Verification
Local, on
1a5d0aea:node scripts/pm/dispatch-gates.mjs --commandsderived 49 families; each run with its exit captured by redirect before any pipe, pluspnpm lint. 48 exit 0 andpnpm lintexit 0;pnpm check:dual-build-cjs-loadsexit 3 (packages outside the runtime closure have nodist), 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
🤖 Generated with Claude Code
https://claude.ai/code/session_016WV4cwb48o186kZzEGZ9a1