Skip to content

test(cli): load stored doc reference exports natively under contention - #12116

Merged
cixzhang merged 1 commit into
mainfrom
recut/11909-stored-docs-native-exports
Nov 18, 2026
Merged

cixzhang merged 1 commit into
mainfrom
recut/11909-stored-docs-native-exports

Conversation

@cixzhang

Copy link
Copy Markdown
Contributor

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_ERROR stack 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 ?native query. 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.mjs helper 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

  • deflake_evidence: d. It was rescued 5 times in 7 days across 5 commits and 5 containers (causes async-retry 5).
  • Before: the unchanged spec passed alone. To reproduce contention, run it alongside 23 temporary copies, giving each copy a distinct import query so their transforms cannot share the runner's cache. At the rescued commit, all 24 export checks, including the original unchanged test, timed out in 30,000 ms.
  • After: the same 24-worker, cold-import setup passed every export check in 414–500 ms, and all seven cases in every copy passed (168 tests). The temporary copies were removed and are not part of this change.
  • The surrounding document compiler suite passed all 326 tests.
  • A separate CI-lab reproduction could not start because its endpoint was unavailable; the failure and fix were both exercised locally.

The stress command sets VITEST_MAX_WORKERS=24 VITEST_MAX_THREADS=24 VITEST_MAX_FORKS=24 before pnpm 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.

  • No intended public API, product behavior, visual direction, or policy change.
  • Product changes discovered during the work were removed or split.
  • Public text and artifacts contain no internal Meta context.

Testing

Node 24.22.1 and the pinned pnpm 11.10.0. pnpm specs:for was run before editing and against the final diff. pnpm review:pre reported zero findings and a clean merge. pnpm exec prettier --check packages/cli/foundation/doc-compiler/stored-docs.test.mjs passed.


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.

Re-cut of #11909, byte for byte, on current main.

Co-authored-by: astracat-bot[bot] <323722387+astracat-bot[bot]@users.noreply.github.com>
@vercel

vercel Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 16, 2026 5:38pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 16, 2026
@astracat-bot

astracat-bot Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 18, 2026, 11:25 AM UTC

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 0fccd34

Storybook · Sandbox · built from this PR's head

Package size: no published package changed; no new dependencies.

Not run on this PR: add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.


Generated by PR Enrichment workflow | View full report

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 0fccd34

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 main and credits its author: verified (identical hunks; Co-authored-by trailer); the head still merges cleanly onto today's main.
  • 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 ?native query: 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.external in vitest.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.

Automated review (maintainer link)

@cixzhang
cixzhang marked this pull request as ready for review November 18, 2026 09:01
@cixzhang
cixzhang marked this pull request as draft November 18, 2026 11:02
@cixzhang
cixzhang marked this pull request as ready for review November 18, 2026 11:02
@cixzhang
cixzhang merged commit 03cc634 into main Nov 18, 2026
212 checks passed
@github-actions
github-actions Bot deleted the recut/11909-stored-docs-native-exports branch November 19, 2026 06:04

This branch was successfully deployed

1 active deployment
Preview — 0fccd346 Deployed Nov 16, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant