Skip to content

test: the Node legs' split books idle swizzle-proof slices at their import, and records keep only Node-leg time - #11648

Merged
josephfarina merged 9 commits into
mainfrom
speed/rerecord-node-durations
Nov 14, 2026
Merged

josephfarina merged 9 commits into
mainfrom
speed/rerecord-node-durations

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Maintainer impact

node scripts/vitest-shard-sequencer.mjs record run.log read every job's lines in a whole run's log (gh run view --log). The build job runs its own --project node tests, which every Node leg skips, so a re-record booked their time (setup-canonical.test.ts 187.6 s, next.turbopack.test.mjs 109.3 s and two browser tests) to legs that never spend it.

Intended invariant

A re-record keeps only Node-leg time, and the split books the swizzle-proof slices only in a run whose scope proves targets. When the scope is affected, a slice proves only the targets that depend on the change, and it stays booked at its full recorded time. Every Node test file still runs exactly once.

Change

  • The split now books the swizzle-proof slices at their import alone when this run proves no target. Each slice reads the same scope first: proof.mjs's new runScope, which runSlice now uses. The sequencer's idleSwizzleSlices reads that same scope at shard time. The slices' recorded time (2,338.5 s across eight slices) is the time they take when a change reaches them. On most pull requests, which change no component, the legs holding the slices finished early while the heavy CLI files piled into the remaining legs. This is why Node leg 1 (and leg 2 on a re-record) ran into its time limit on many pull requests.

  • In a log that carries the job column, only Node-leg jobs count: a pull request's test-node (N/M) or a Main run's test-node (N). A single leg's own log has no job column and reads as before.

  • A file whose every test skips in a Node leg (↓ … (N tests | N skipped)) is recorded at 0, so a time another job gave it can't stay booked.

  • Tests for both rules.

Declared difference

None in any package. scripts/vitest-node-durations.json is unchanged.

On main's record, a run whose change reaches no component now splits as 890 / 1116 / 1116 / 1115 / 1115 s of actual test time (leg 1 keeps its reserved steps), where today the four legs that hold slices book 441 to 655 s of slice time that they do not spend.

Scope

Components: CI test sharding (durations recorder)

  • 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

scripts/vitest-shard-sequencer.test.mjs (25) passes, both as is and with SWIZZLE_PROOF_CHANGED=docs/README.md; swizzle-proof/scope.test.mjs passes. New cases: idle slices let the heavy files spread (no leg takes more than two of eight); the slices are idle for a docs-only change and booked for a component change or SWIZZLE_PROOF_ALL=1; no scope is read when no slice is in the run. The shard tests compute their expected legs with the run's own idle set.

@vercel

vercel Bot commented Nov 14, 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 14, 2026 5:54am UTC

Request Review

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

astracat-bot Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 14, 2026, 6:02 AM UTC

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 265734e

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, ci:run-a11y or ci:run-rtl to run them.


Generated by PR Enrichment workflow | View full report

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

Requesting changes. Most of the re-recorded times look right, and every Node leg passed inside its time limit on this head, but two of the new entries record time from a different CI job.

  • scripts/vitest-node-durations.json records setup-canonical.test.ts at 187.6 s and next.turbopack.test.mjs at 109.3 s, but both skip in every Node leg (they run only in the test-build job, under ASTRYX_CANONICAL_SETUP_BROWSER=1 and ASTRYX_TURBOPACK_E2E=1), so the sequencer books about 297 s of work that no Node leg does, and counting only Node-leg time the five legs split 1602 / 1414 / 1492 / 1599 / 1602 s rather than 1602 s each.

To fix it, set those two entries to 0, along with build-css.data-tokens.browser.test.mjs (2.3 s) and stylex-module-resolution.browser.test.mjs (0.3 s), which come from the same job, and update the description's "from the Node legs" and "1602 s each". A later re-record from the Node legs will not correct these values, because the recorder keeps the times of files a run does not reach.

Claims and files checked
  • Claim: Node leg 1 of 5 runs into its job time limit and the watchdog fails it. The watchdog mechanism is verified in the CI bounds test; how often it happens is not checkable from the repository.
  • Claim: the legs are uneven because the recorded times are stale. Verified: 22 Node test files had no time, and 511 times had drifted.
  • Claim: a recent all-green run had legs of 14.5, 9, 7.7, 5.4 and 8.4 minutes. Not checkable, because the run is not named.
  • Claim: every Node test file still runs exactly once. Verified: the splitter asserts it, and all five legs passed on this head.
  • Claim: the record was re-recorded with the documented command from the Node legs of one run (865 files). False for five added entries, which match lines from the test-build and build-storybook jobs; the file's shape matches the recorder's output.
  • Claim: nothing else changes, and no package changes. Verified.
  • Claim: the old record's split gives 1782 / 1575 / 1796 / 1279 / 1577 s and the new one 1602 s each, about 10% off the longest leg. The arithmetic reproduces with the record as the truth; counting Node-leg time, the new split is 1602 / 1414 / 1492 / 1599 / 1602 s.
  • Claim: the file parses and formats cleanly. Verified.
  • Claim: no public API, product behavior or internal context changes. Verified.
  • File scripts/vitest-node-durations.json: the finding above.

Automated review (maintainer link)

Comment thread scripts/vitest-node-durations.json Resolved
Comment thread scripts/vitest-node-durations.json Resolved
@josephfarina josephfarina changed the title test: re-record the Node legs' test times so leg 1 stops running into its time limit test: the durations recorder reads only the Node legs, and the Node legs' times are re-recorded Nov 14, 2026

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

Requesting changes. The four build-job times from the last review are now 0, and the recorder no longer reads other jobs' lines.

  • NODE_LEG_JOB in scripts/vitest-shard-sequencer.mjs:117 matches only test-node (N/M), so record finds no times in a Main workflow log, whose Node legs are named test-node (1) to test-node (6), although the record guard (scripts/vitest-shard-sequencer.test.mjs:92) says to regenerate from those logs; accepting /^test-node \(\d+(?:\/\d+)?\)$/ and adding a test-node (2) line to the whole-run test fixes it.
  • The description says scripts/vitest-shard-sequencer.test.mjs passes with 19 tests, but after the merge of main the file holds 22, so please update the count.

On this head CI's test-node (2/5) was stopped by the time-limit watchdog after its heavy CLI files ran well past their recorded times; a rerun will show whether that was runner load.

Claims and files checked
  • Claim: Node leg 1 of 5 often runs into its job time limit, and the watchdog names whichever file is running. The watchdog is verified in the workflow; how often it happens cannot be checked from the repository.
  • Claim: on a recent all-green run the legs took 14.5, 9, 7.7, 5.4 and 8.4 minutes. Not checkable, because the run is not named.
  • Claim: every Node test file still runs exactly once. Verified: the splitter throws unless each file lands in exactly one leg.
  • Claim: the recorder on main read every job's lines, so the build job's runs of tests that the Node legs skip were booked to the legs. Verified: the base recorder has no job filter, and those tests run only under environment flags that the build job sets.
  • Claim: with a job column, only test-node (N/M) lines count, and a single leg's own log reads as before. Verified as written, but the Main workflow's legs are excluded (first finding).
  • Claim: a file whose every test skips is recorded at 0. Verified, in code and in a test.
  • Claim: the record is re-recorded with that recorder from one recent all-green run's Node legs (866 files). The record's shape matches the recorder's output, and the four build-job entries are 0; the run and the file count cannot be checked.
  • Claim: tests cover a whole-run log with build-job lines and a wholly skipped file. Verified.
  • Claim: no package changes; only the Node legs' split changes. Verified.
  • Claim: with the new record the five legs split into 1542 s each. Verified with the leg-one reserve off; with it on, the first leg carries less by design.
  • Claim: on the first head, CI's leg 1 took 9.5 minutes. Verified (9.45 minutes).
  • Claim: no public API, product behaviour or internal context changes. Verified.
  • Claim: the sequencer test passes (19). The file holds 22 tests at this head (second finding).
  • File scripts/vitest-shard-sequencer.mjs: the first finding.
  • File scripts/vitest-shard-sequencer.test.mjs: no case covers the Main workflow's leg names (first finding); otherwise clear.
  • File scripts/vitest-node-durations.json: clear; the earlier finding is fixed.

Automated review (maintainer link)

Comment thread scripts/vitest-shard-sequencer.mjs Resolved
@josephfarina josephfarina changed the title test: the durations recorder reads only the Node legs, and the Node legs' times are re-recorded test: the durations recorder books only time the Node legs spend Nov 14, 2026

@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 pending CI: four of the five Node legs are still running or queued on this head.

Both points from the last review are fixed: record now reads a Main run's test-node (N) legs as well as a pull request's test-node (N/M) legs (scripts/vitest-shard-sequencer.mjs:120, pinned by the whole-run test), and the description's test count matches the 22 tests CI ran. The recorder now ignores other jobs' lines and books a wholly skipped Node file at 0, while the record itself stays main's.

Claims and files checked
  • Claim: on main, record read every job's lines in a whole run's log. Verified: the base recorder has no job filter.
  • Claim: the build job runs its own Node-project tests that every Node leg skips, so a re-record booked their times (setup-canonical 187.6 s, the Turbopack test 109.3 s and two browser tests) to the legs. Verified: those tests run only under flags the build job sets, and the first head's record carried exactly those values.
  • Claim: a re-record books only time the Node legs spend. Verified for the job filter and the skipped rule, on fixed lines and on CI's own leg log.
  • Claim: every Node test file still runs exactly once. Verified: the splitter is unchanged and its exactly-one-leg cases passed.
  • Claim: with a job column, only a pull request's test-node (N/M) or a Main run's test-node (N) counts. Verified against both workflows' job names and the new test.
  • Claim: a single leg's own log has no job column and reads as before. Verified: CI's raw job log reads into all 246 of its files.
  • Claim: a file whose every test skips in a Node leg is recorded at 0. Verified in code, in the test and on CI's log.
  • Claim: tests cover both rules. Verified.
  • Claim: no package changes and the durations record is unchanged. Verified: the record is byte-identical to main.
  • Claim: an earlier re-record put the heaviest CLI files in one leg, which ran past its limit. Consistent with CI at the previous head, where Node leg 2 of 5 failed after 14 minutes; not re-measured.
  • Claim: the record stays main's until the split accounts for it. Verified.
  • Claim: no public API, product behaviour, visual or policy change, and no internal context. Verified.
  • Claim: the sequencer test passes with 22 tests. Verified in CI on this head.
  • File scripts/vitest-shard-sequencer.mjs: clear.
  • File scripts/vitest-shard-sequencer.test.mjs: clear.

Automated review (maintainer link)

@josephfarina josephfarina changed the title test: the durations recorder books only time the Node legs spend test: the Node legs' split books only time the legs will spend (idle swizzle-proof slices, Node-leg-only records) Nov 14, 2026

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

Requesting changes: booking idle swizzle-proof slices at their import is a sound fix for the leg skew, but it breaks two existing sequencer tests outside this pull request's own diff.

  • scripts/vitest-shard-sequencer.test.mjs:155 and :192 still build their expected legs without the new idle set, so on any checkout whose change reaches no component source or swizzle toolchain path (for example with SWIZZLE_PROOF_CHANGED=docs/README.md) both fail while the base passes, and this pull request passes only because it changes proof.mjs; pin the scope in the suite (vi.stubEnv('SWIZZLE_PROOF_ALL', '1')) or compute expected with idleSwizzleSlices, and add a case that covers the idle branch.
  • The description says the slices total "about 2,160 s across seven slices" and booked "about 470 s per leg that held one", but the record has eight slices (2,338.5 s) and the four legs that held slices booked 441–655 s each, and the title's "only time the legs will spend" holds only when a run proves no target or every target.

CI's Node legs have not run on this head yet.

Claims and files checked
  • Claim: on main, record read every job's lines in a whole run's log and booked build-job tests to the Node legs. Verified: the base recorder has no job filter.
  • Claim: the split books only time the Node legs will spend. Partly: true for runs that prove no target or every target; an affected run still books each slice at its full time.
  • Claim: every Node test file still runs exactly once. Verified: idle changes only cost, every leg computes the same set, and the new split case checks it.
  • Claim: the slices are booked at their import alone when the run proves no target. Verified at scripts/vitest-shard-sequencer.mjs:56 and :171-180.
  • Claim: each slice reads the same scope first through the new runScope, which runSlice uses, and the sequencer reads that scope at shard time. Verified at proof.mjs:488-506, :523 and vitest-shard-sequencer.mjs:178.
  • Claim: the slices' recorded time is about 2,160 s across seven slices. False: eight slices, 2,338.5 s.
  • Claim: on most pull requests the slice-holding legs finished early while the heavy CLI files piled into the rest, so leg 1 ran into its limit. Consistent with the computed base split (leg 1 at 1,362 s against 932–1,146 s); not re-measured.
  • Claim: in a log with a job column, only test-node (N/M) and test-node (N) lines count. Verified at :123, :138-139 and in the whole-run test.
  • Claim: a single leg's own log has no job column and reads as before. Verified: lines with fewer than three columns pass the filter.
  • Claim: a wholly skipped file is recorded at 0. Verified at :149-155 and in the test.
  • Claim: tests cover both recorder rules. Verified.
  • Claim: no package changes and the durations record is unchanged. Verified.
  • Claim: on main's record, a run that reaches no component splits as 890 / 1116 / 1116 / 1115 / 1115 s. Verified within 4 s per leg.
  • Claim: the old split booked about 470 s of idle slice time per leg that held one. False: four legs held two slices each, 441–655 s apiece.
  • Claim: no public API, product behaviour, visual or policy change, and no internal context. Verified.
  • Claim: the sequencer test (24) and the scope test pass. Partly: they pass on this change; the sequencer test fails 2 of 24 when the change reaches no component.
  • Claim: new cases show the heavy files spread with idle slices and no scope is read without a slice. Verified, the second by code (the early return at :173); no case covers the idle branch.
  • File scripts/vitest-shard-sequencer.mjs: clear.
  • File scripts/vitest-shard-sequencer.test.mjs: blocking (the two expected splits).
  • File scripts/vitest-shard-sequencer.d.mts: clear.
  • File packages/cli/test/swizzle-proof/proof.mjs: clear; one unused-binding note.

Automated review (maintainer link)

Comment thread scripts/vitest-shard-sequencer.mjs Resolved
@josephfarina josephfarina changed the title test: the Node legs' split books only time the legs will spend (idle swizzle-proof slices, Node-leg-only records) test: the Node legs' split books idle swizzle-proof slices at their import, and records keep only Node-leg time Nov 14, 2026

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

Requesting changes: the shard tests now expect the run's own idle set and the description's numbers match the record, but the new scope case fails whenever SWIZZLE_PROOF_ALL=1 is already set.

  • scripts/vitest-shard-sequencer.test.mjs:355 expects all eight slices idle after stubbing only SWIZZLE_PROOF_CHANGED, but Main's release re-check runs the Node legs with SWIZZLE_PROOF_ALL=1 (.github/workflows/deploy.yml:224), so there the scope is all and the assertion at :362 fails on every re-check; stub SWIZZLE_PROOF_ALL to '' before the first assertion, or in the suite's beforeEach beside VITEST_LEG_ONE_RESERVE.

Both points from the last review are fixed. CI's Node legs have not run on this head yet.

Claims and files checked
  • Claim: before this change, record read every job's lines in a whole run's log, so build-job tests could be booked to the Node legs. Verified: the base recorder has no job filter.
  • Claim: a re-record keeps only Node-leg time. Verified at scripts/vitest-shard-sequencer.mjs:123 and :138-139, and in the whole-run test.
  • Claim: the split books the slices only in a run whose scope proves targets, and an affected run keeps each slice at its full recorded time. Verified at :171-180.
  • Claim: every Node test file still runs exactly once. Verified: idle changes only cost, and the new split case checks every file lands once.
  • Claim: each slice reads the same scope first through the new runScope, which runSlice uses, and the sequencer reads it at shard time. Verified at proof.mjs:488-506, :523 and vitest-shard-sequencer.mjs:178.
  • Claim: the slices' recorded time is 2,338.5 s across eight slices. Verified against the record.
  • Claim: on most pull requests the slice-holding legs finished early while the heavy CLI files piled into the rest, which is why leg 1 ran into its limit. Consistent with the computed base split (leg 1 at 1,362 s against 932–1,146 s); not re-measured.
  • Claim: in a log with a job column, only test-node (N/M) and test-node (N) lines count. Verified.
  • Claim: a single leg's own log has no job column and reads as before. Verified: lines with fewer than three columns pass the filter.
  • Claim: a wholly skipped file is recorded at 0. Verified at :151-155 and in the test.
  • Claim: tests cover both recorder rules. Verified.
  • Claim: no package changes and the durations record is unchanged. Verified.
  • Claim: on the record, a run that reaches no component splits as 890 / 1116 / 1116 / 1115 / 1115 s, where the four slice-holding legs book 441 to 655 s of slice time. Verified within 4 s per leg, and 441 / 623 / 620 / 655 s.
  • Claim: no public API, product behaviour, visual or policy change, and no internal context. Verified.
  • Claim: the sequencer test (25) passes as is and with a docs-only change, and the scope test passes. Verified; the sequencer test fails 1 of 25 with SWIZZLE_PROOF_ALL=1.
  • Claim: new cases cover the heavy files spreading, the idle set per scope, and no scope read without a slice, and the shard tests use the run's own idle set. Verified, the third by code (the early return at :173); the per-scope case is the one above.
  • File scripts/vitest-shard-sequencer.mjs: clear.
  • File scripts/vitest-shard-sequencer.test.mjs: blocking (the scope case at :355).
  • File scripts/vitest-shard-sequencer.d.mts: clear.
  • File packages/cli/test/swizzle-proof/proof.mjs: clear.

Automated review (maintainer link)

Comment thread scripts/vitest-shard-sequencer.test.mjs Resolved

@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 pending CI: the Node legs and the other required checks have not finished on this head yet.

Both points from the last review are fixed: the shard tests build their expected legs with the run's own idle set, and the suite clears SWIZZLE_PROOF_ALL itself, so the scope case also passes in Main's release re-check. The sequencer test passes 25 of 25 in every swizzle scope and on this branch merged with main.

  • Optional: the $comment in scripts/vitest-node-durations.json still says a pull request that does not reach the slices leaves its legs uneven; that now holds only for a run that reaches some component, so it is worth a one-line update.
Claims and files checked
  • Claim: before this change, record read every job's lines in a whole run's log, so build-job tests were booked to the Node legs. Verified: the base recorder has no job filter, and the build job alone runs those tests under their opt-in variables.
  • Claim: the earlier re-record booked 187.6 s and 109.3 s plus two browser tests from that job. Verified against that re-record.
  • Claim: a re-record keeps only Node-leg time. Verified at scripts/vitest-shard-sequencer.mjs:123 and :139, and in the whole-run test.
  • Claim: the split books the slices only in a run whose scope proves targets, and an affected run keeps each slice at its full recorded time. Verified at :171-180.
  • Claim: every Node test file still runs exactly once. Verified: idle changes only cost, and the new split case checks every file lands once.
  • Claim: each slice reads the same scope first through the new runScope, which runSlice uses, and the sequencer reads it at shard time. Verified at proof.mjs:488-506, :523 and vitest-shard-sequencer.mjs:178.
  • Claim: the slices' recorded time is 2,338.5 s across eight slices. Verified against the record.
  • Claim: on most pull requests the slice-holding legs finished early while the heavy CLI files piled into the rest, which is why leg 1 ran into its limit. Consistent with the computed base split (leg 1 at 1,358 s against 928–1,142 s); the run history was not re-measured.
  • Claim: in a log with a job column, only test-node (N/M) and test-node (N) lines count, and a single leg's own log reads as before. Verified: lines with fewer than three columns pass the filter.
  • Claim: a file whose every test skips in a Node leg is recorded at 0. Verified at :149-155 and in the test.
  • Claim: tests cover both recorder rules. Verified.
  • Claim: no package changes and the durations record is unchanged. Verified.
  • Claim: on main's record, a run that reaches no component splits as 890 / 1116 / 1116 / 1115 / 1115 s, where the four slice-holding legs book 441 to 655 s of slice time. Verified exactly on the record at the base.
  • Claim: no public API, product behaviour, visual or policy change, and no internal context. Verified.
  • Claim: the sequencer test (25) passes as is and with a docs-only change, and the scope test passes. Verified, also with a component change, the release re-check's environment and on this branch merged with main.
  • Claim: new cases cover the heavy files spreading, the idle set per scope, and no scope read without a slice, and the shard tests use the run's own idle set. Verified at scripts/vitest-shard-sequencer.test.mjs:330-378, :180-183 and :203-207.
  • File scripts/vitest-shard-sequencer.mjs: clear.
  • File scripts/vitest-shard-sequencer.test.mjs: clear.
  • File scripts/vitest-shard-sequencer.d.mts: clear.
  • File packages/cli/test/swizzle-proof/proof.mjs: clear.

Automated review (maintainer link)

This branch was successfully deployed

1 active deployment
Preview — 265734e8 Deployed Nov 14, 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