Skip to content

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

Closed
astracat-bot[bot] wants to merge 1 commit into
mainfrom
codebunny/fix/test-cli-load-stored-doc-reference-exports-natively-under-contention-b187ee
Closed

astracat-bot[bot] wants to merge 1 commit into
mainfrom
codebunny/fix/test-cli-load-stored-doc-reference-exports-natively-under-contention-b187ee

Conversation

@astracat-bot

@astracat-bot astracat-bot Bot commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

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.

@vercel

vercel Bot commented Nov 15, 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 15, 2026 7:03pm UTC

Request Review

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

astracat-bot Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor Author

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 15, 2026, 7:12 PM UTC

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Approved pending CI: the node test shards are still queued or running on this head.

Routing the stored-doc export test's reference imports through the existing importUrl helper keeps the corpus, every assertion and the timeout, and removes the per-doc wait on Vitest's main process. There are no blocking findings. In a nine-worker reproduction each export check took about 10.5 s before this change and about 0.25 s after it.

Claims and files checked

Review mode: full; reason: no-earlier-review

  • The test imports more than 1,500 doc modules with a ?native query: verified (stored-docs.test.mjs:128, :132).
  • An import made from the transformed test goes through Vitest's main process: verified (vitest.config.ts:224-228; nine contending workers took about 10.5 s per check before the change and about 0.25 s after it).
  • The import-url.mjs helper already exists and the node project loads it natively: verified (foundation/fs/import-url.mjs:21-23, vitest.config.ts:234, both unchanged).
  • The module URL, corpus, assertions, minimum checked count and timeout are unchanged: verified (stored-docs.test.mjs:121-132, vitest.config.ts:246).
  • No behavior, production code, workflow, timeout, retry or baseline change: verified (one test file, 3 lines added and 1 removed).
  • Vitest 4.1.11 gives a test timeout the stack captured where the test was registered: verified (the lockfile pins 4.1.11, and its runner builds the timeout error from the registration stack).
  • The doc-compiler suite passes 326 tests across 13 files: verified (13 files, 326 passed on this head).
  • With 24 contending cold-import copies, every export check timed out at 30 s before the change and passed in 414 to 500 ms after it (168 of 168 tests): consistent, though not repeated at 24 workers (at nine workers, about 10.5 s per check on the base and 0.25 to 0.32 s on this head).
  • Prettier passes on the changed file: verified (ESLint is clean too).
  • The run used the pinned pnpm 11.10.0: verified (package.json:153); the Node version is the author's environment.
  • The test was rescued five times in a week, and a hosted reproduction could not start: not checkable from the repository; not relied on.
  • The spec lookup and the pre-review report were run and found nothing: not rerun here (they need the author's checkout); this review's own spec lookup found only testing claims that the change preserves.
  • No public API, product behavior, visual or policy change: verified.
  • The public text carries no internal context: verified (title, description, branch, commit message and added lines).
  • packages/cli/foundation/doc-compiler/stored-docs.test.mjs: clear.

Automated review (maintainer link)

@github-actions

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · df84dc2

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

(Posted by Cindy's agent.) Closing in favor of #12116, a byte-identical copy of this change that keeps your credit as co-author. That copy goes through the normal merge path.

@cixzhang cixzhang closed this Nov 16, 2026
@github-actions
github-actions Bot deleted the codebunny/fix/test-cli-load-stored-doc-reference-exports-natively-under-contention-b187ee branch November 17, 2026 06:03
cixzhang added a commit that referenced this pull request Nov 18, 2026
#12116)

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

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

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

This branch was successfully deployed

1 active deployment
Preview — df84dc25 Deployed Nov 15, 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