Repository navigation
test(cli): load stored doc reference exports natively under contention - #12116
Conversation
Re-cut of #11909, byte for byte, on current main. Co-authored-by: astracat-bot[bot] <323722387+astracat-bot[bot]@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
|
/approve-spec 0fccd34 |
There was a problem hiding this comment.
Approved: CI passed on this head, including the shard that runs this spec, both before and after the pull request was marked ready again.
The test now loads its reference docs through the existing importUrl helper, which the node test project already loads natively, and keeps the same module URL, corpus, assertions, minimum count and timeout. With eight cold copies running at once, the export check takes about 0.4 s per copy instead of about 10 s with the direct import.
Claims and files checked
Review mode: same-head; reason: none
- Claim: the commit re-cuts #11909 byte for byte on
mainand credits its author: verified (identical hunks; Co-authored-by trailer); the head still merges cleanly onto today'smain. - Claim: #11909 was reviewed earlier and closes when this merges: process statements with nothing in the code to check; #11909 is already closed.
- Claim: not re-run locally because the test needs a built Core: verified (the node project's global setup builds Core).
- Claim: this pull request's CI runs the file: verified (node shard 1 of 9 ran it in both CI runs, 7 tests passed each time).
- Claim: 24 concurrent cold copies pass 168/168: consistent (7 tests per copy); eight copies pass every export check in 0.40–0.45 s.
- Claim: the doc-compiler directory passes 326 tests across 13 files: verified.
- Claim: Prettier passes on the file: verified; ESLint passes too. The pre-review report was not re-run.
- Claim: the test times out intermittently in CI, with five retries in a week: CI records outside the repository; the cited commit is on
main. - Claim: Vitest 4.1.11 attaches the registration stack to timeout errors: verified (locked version and runner source).
- Claim: the test imports more than 1,500 doc modules with a
?nativequery: verified (1,576 doc files). - Claim: an import from the transformed test still goes through Vitest's main process: verified (the module runner asks it about every new module id).
- Claim: queued requests can use the 30-second budget: the budget is verified; eight copies took about 10 s each, with no timeout at that load.
- Claim: the node project already loads the helper natively: verified (
server.deps.externalinvitest.config.ts). - Claim: the module URL and assertions are unchanged: verified.
- Claim: no production code, workflow, timeout, retry or baseline change: verified (one test file).
- Claim: before the fix, all 24 copies timed out at 30,000 ms: not reproduced at eight copies.
- Claim: after the fix, export checks take 414–500 ms: consistent with 0.40–0.45 s.
- Claim: a separate lab reproduction could not start, and the CI trace names no doc: not checkable here.
- Claim: the affected test is the stored-doc exports equality test: verified.
- Claim: no public API, behavior or policy change, and no internal context in public text: verified.
- Claim: Node 24.22.1 and pnpm 11.10.0: verified (
.nvmrc,packageManager). - File
packages/cli/foundation/doc-compiler/stored-docs.test.mjs: clear.
Re-cut of #11909 by astracat-bot, byte for byte, on current
main: the commit's diff is identical to #11909's. Credit stays with astracat-bot (a Co-authored-by trailer on the commit). The drain reviewed #11909 as merge-worthy; #11909 closes when this merges.Locally: not re-run (the test needs the Node project's built Core); the change is #11909's three lines, and this pull request's CI runs the file.
validation: ran pnpm test:node packages/cli/foundation/doc-compiler/stored-docs --maxWorkers=24 --reporter=verbose with 24 isolated, cold-import copies of the spec, 168/168 tests passed; pnpm test:node packages/cli/foundation/doc-compiler --maxWorkers=4 --reporter=verbose, 326/326 tests passed across 13 files; Prettier and the pre-review report passed.
Maintainer impact
The stored-doc export equivalence test intermittently times out under import contention. Its newest rescued attempt was at a2b5fe4. Vitest 4.1.11 assigns the collected
STACK_TRACE_ERRORstack to timeout errors, which explains the otherwise uninformative failure at the test's registration line.The test directly imports more than 1,500 doc modules with a
?nativequery. Despite the query's name, an import from the transformed test still goes through Vitest's main process. The queued requests can consume the entire 30-second test budget.Intended invariant
Every stored doc must equal the exports Node imports from that doc. Keep the complete corpus, each equality assertion, the minimum checked count, and the existing timeout.
Change
Use the existing
foundation/fs/import-url.mjshelper for this test's reference import. The Node project already loads that helper natively. This removes per-doc requests to the runner without changing the module URL or the assertions.No behavior change. No production code, workflow, timeout, retry, or baseline changes.
Evidence
The stress command sets
VITEST_MAX_WORKERS=24 VITEST_MAX_THREADS=24 VITEST_MAX_FORKS=24beforepnpm test:node, in addition to--maxWorkers=24. Its before run also filters to--testNamePattern='hold, for every stored doc, the exports an import of it gives'.Scope
Affected test:
packages/cli/foundation/doc-compiler/stored-docs.test.mjs › stored doc exports › hold, for every stored doc, the exports an import of it gives.Only the test's reference import changes. The CI trace does not name the exact doc being loaded when its deadline expired, so the reproduction deliberately stresses the import queue rather than assuming one particular doc is faulty. Retaining the direct transformed import was the alternative, but it keeps the unnecessary runner contention.
Testing
Node 24.22.1 and the pinned pnpm 11.10.0.
pnpm specs:forwas run before editing and against the final diff.pnpm review:prereported zero findings and a clean merge.pnpm exec prettier --check packages/cli/foundation/doc-compiler/stored-docs.test.mjspassed.Overlap checked: #11909 (this is #11909's change, re-cut byte for byte on current main, which supersedes it)
Owning session: noopbot (a61f66c2), under CI & Release (ca77f950). Land path: the shipper, through merge-guard.