Skip to content

test(analyze-pr): the reach test keeps its fixture out of the system temporary directory - #9209

Closed
vjeux wants to merge 1 commit into
meta:mainfrom
vjeux:test/analyze-pr-reach-fixture-outside-tmp
Closed

vjeux wants to merge 1 commit into
meta:mainfrom
vjeux:test/analyze-pr-reach-fixture-outside-tmp

Conversation

@vjeux

@vjeux vjeux commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

Maintainer impact

On a busy shared machine, analyze-pr.test.mjs's "sizes a component whose bundle reaches a changed shared module" runs past its 30 s limit and fails, though it passes alone in about 2 s. A local pnpm test:node gate then reads red for changes that never touched the analysis.

Intended invariant

The test checks the same analysis with the same fixture and the same four analyze-pr runs. Only where the fixture and analyze-pr's scratch files live changes; analyze-pr.js is untouched.

Change

Each analyze-pr run here bundles with esbuild (twice when the fixture has a build), and esbuild reads the listing of every directory above a file it bundles. The fixture lived in the system temporary directory, and so did analyze-pr's scratch files, so every build listed it. On a shared machine that directory held 272,514 entries, which cost each run about 0.5 to 0.7 s more, rising with load.

The test now creates its fixture, and a scratch directory it passes as TMPDIR to the analyze-pr runs it starts, under the checkout's node_modules/.cache/analyze-pr-test (as scripts/motion-node-load.test.mjs does with node_modules/.cache). No build reads the temporary directory any more. No timeout, retry or skip changes.

Other tests in this file make their fixtures the same way. #9164 edits several of them, so this pull request leaves them for after it.

Evidence

  • Failure before the change: on two cores shared with 20 busy processes, 6 of 8 runs timed out ("Test timed out in 30000ms"), at 31.7 to 43.9 s; the other two took 29.3 and 29.7 s.
  • Success after the change: under the same contention, 10 of 10 runs passed, at 10.0 to 19.4 s. At the machine's own load (85 to 107, nothing added), each analyze-pr run took 665 to 926 ms before and about 190 ms after; the whole test took 3.1 s before and 1.2 to 1.8 s after.
  • Product/runtime behavior verified unchanged: a test-only change; the file's 11 tests pass.

Scope

  • 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

  • pnpm exec vitest run --project node .github/scripts/analyze-pr.test.mjs: 11 of 11 pass.
  • Contention: the vitest run pinned with taskset to two cores, with 20 node -e 'for(;;){}' processes pinned to the same cores; runs before and after the change interleaved.
  • Local gates at f50fbd1 (one commit on main 932cfb9): build, typecheck and repo checks pass; the .github/scripts tests pass (1,598); the UI suite passes (17,099 tests); the node suite passes except the two cache.test.mjs lock tests that fail on this machine without the change too (fix(cli): a crashed run's release install is recognized by the Node it ran on, whatever its name #8520), and the reach test took 1.1 s inside it.

…temporary directory

Each analyze-pr run in "sizes a component whose bundle reaches a changed
shared module" bundles with esbuild, which reads the listing of every
directory above the files it bundles. The fixture and analyze-pr's
scratch files lived in the system temporary directory, so every build
listed it. On a shared machine it held 272,514 entries, and under load the
test ran past its 30 s limit, though it passes alone in about 2 s.

The fixture and the scratch directory (TMPDIR for the analyze-pr runs it
starts) now live under the checkout's node_modules/.cache/analyze-pr-test.
On two cores shared with 20 busy processes the test ran 34.2 to 43.9 s
before (5 of 5 timed out) and 12.5 to 19.4 s after (7 of 7 passed). No
timeout, retry or skip changes; analyze-pr.js is unchanged.
@vercel

vercel Bot commented Oct 31, 2026

Copy link
Copy Markdown

Deployment failed for project astryx with the following error:

The provided GitHub repository does not contain the requested branch or commit reference. Please ensure the repository is not empty.

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

astracat-bot Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 31, 2026, 9:09 PM UTC

@github-actions

Copy link
Copy Markdown
Contributor

PR Analysis Report

Current run: The current CI run concluded skipped. Current analysis is unavailable.


Generated by PR Enrichment workflow | View current CI run

@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.

This looks ready to approve. Moving the reach test's fixture and its analyze-pr scratch files under node_modules/.cache keeps every esbuild build out of the system temporary directory, and the test's assertions are unchanged. With 272,514 entries in the temporary directory, the reach test took about 1.17 s before and 0.52 s after (the same as with an empty one), and every test in the file passes. The file's remaining os.tmpdir() fixtures can follow once #9164 lands.

[Automated review]

cixzhang added a commit that referenced this pull request Oct 31, 2026
…temporary directory (re-land of #9209) (#9212)

test(analyze-pr): the reach test keeps its fixture out of the system temporary directory (re-land of #9209)

Co-authored-by: vjeux <[email protected]>
@vjeux

vjeux commented Oct 31, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #9212 (landed as 3470f74).

@vjeux vjeux closed this Oct 31, 2026
@vjeux
vjeux deleted the test/analyze-pr-reach-fixture-outside-tmp branch October 31, 2026 21:36
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