Skip to content

ci: the Node record refresh takes each leg's slowdown out and rewrites only new and far-off entries - #11910

Merged
cixzhang merged 3 commits into
mainfrom
ci/node-record-normalized-legs
Nov 19, 2026
Merged

cixzhang merged 3 commits into
mainfrom
ci/node-record-normalized-legs

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Who this helps

Authors waiting on CI. The Node legs balance by scripts/vitest-node-durations.json, and #11900's refresh keeps that record current from main's full unit runs. When it refreshes, it regenerates the record with the plain recorder (vitest-shard-sequencer.mjs record), so every file that run reached takes that run's raw time. A run on a slow runner raises every entry it reached, and one on a fast runner lowers them, so the record moves with the runner rather than with the tests, and a lowered entry under-books its leg on the next slower run.

What changes

  • .github/scripts/node-record-refresh.mjs: a regenerate --log <run log> command. It groups the run's lines by Node leg and divides each leg's times by that leg's own slowdown: the drift check's legFactor (the median measured ÷ recorded over the leg's recorded files, never below 1). Then:
    • a file the record lacks takes its time;
    • a recorded file takes it only when it is 1.5 times off its entry (RATIO), either way, and at least 5 s away (RETIME_MIN_S); a lower time is taken only after that division;
    • every other entry keeps its value. Files that no longer exist drop out, as with the recorder.
  • .github/workflows/node-record-refresh.yml: the regenerate step calls it instead of the plain recorder. When the refresh runs is unchanged.
  • The refresh pull request's body says how the times were taken.
  • Unchanged: when a refresh opens (ci: keep the recorded Node test times fresh from main on a schedule, and never fail a pull request on them #11900's coverage and drift checks), the one fixed branch, the pull request it opens, the plain recorder for manual use, and the Node legs themselves.

This is #11644's rule (each leg divided by its own factor; new files, plus entries far off either way), applied by the refresh.

Evidence

  • node-record-refresh.test.mjs, new cases:
    • a leg that ran everything twice as slow books its unrecorded file at half its time and keeps the entries that only ran slow with it;
    • a file 1.5 times off either way is re-timed, and a move under 5 s is not, however large the ratio;
    • a slow leg's lower time is taken only after its slowdown is taken out;
    • the factor never drops below 1, so a fast leg's times are taken as measured;
    • the regenerate command rewrites the record's file through the workflow's own call and keeps the file's other fields; the workflow step calls it;
    • a log with no Node leg time fails the command (exit 1, as the recorder does) and leaves the record as it was, so a refresh that is due never ends green without one. The printed count is what the merge changed.
  • 109 tests passed across node-record-refresh, node-time-drift, vitest-shard-sequencer and ci-tooling-routing at the first head; with main's script and workflow, the 6 new cases fail. After the no-Node-time fix, node-record-refresh and node-time-drift pass 50 of 50, and its new case fails on the previous head.
  • actionlint and prettier pass.

CI impact: none on pull requests. The refresh pull request carries fewer, steadier changes.

Specs

spec:AST-030 FR22: "it regenerates the record from that run's Node legs" stays true: the regeneration still comes from that run's Node legs, now with each leg's slowdown taken out. No record text changes here.

Overlap check

Merged with main after #12657 (the refresh reads each leg's whole log and stops on a leg that misses files) and #12687 (colour codes kept; a log with no Node legs stops). Both change how the refresh reads the log; neither changes which entries regenerate rewrites or takes a leg's slowdown out, so this is not redundant with them. regenerate now groups the lines through main's nodeLegLogs.

No open pull request changes node-record-refresh.mjs, its test or its workflow (also checked file by file on the open pull requests with more than 100 files), except our own #11921 (the early warning). The two change different behavior in the same script but conflict textually where both add lines in the same places: the file header's @input/@output lines, the import lists, the new functions inserted before refreshReasons, and the workflow's header comment. Each conflict resolves by keeping both sides; whichever lands second merges main and does that.

Overlap checked: #11921 (our own: the early warning in the same refresh; textual conflicts only, each resolved by keeping both sides)

Owning session: noopbot (a61f66c2), under CI & Release (ca77f950). Land path: the shipper, through merge-guard.

…s only new and far-off entries

The refresh regenerated the record with the plain recorder, so every file a run reached took that run's raw time, a slow runner raised every entry and a fast one lowered them. Now each leg's times are divided by that leg's own slowdown (the drift check's leg factor, never below 1); a file the record lacks takes its time, and a recorded file takes it only when it is 1.5 times off its entry, either way, and at least 5 s away.
@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 18, 2026 11:14pm 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

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 19, 2026, 2:19 AM UTC

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 7c05403

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.

CI impact: 0 job-min per update · pool 0% · time to green −8.3 min · standard runners · 1 other workflow changed (not measured) · 2 CI action or script files changed (not measured)
Before After Change
Job-minutes per PR update 173.5 173.5 0
Runner pool, runner-minutes a day 51,781 51,781 0 (0%)
Average concurrent jobs 36 36 0
Time to green (median → this run) 27.8 min 19.6 min −8.3 min
Runs a day 298 298 0

Other workflows: node-record-refresh.yml changed: runs on workflow_run, schedule (41 */6 * * *), workflow_dispatch; standard runners; its minutes are not measured here

Not measured (the jobs that use these keep their recent minutes above): .github/scripts/node-record-refresh.mjs, .github/scripts/node-record-refresh.test.mjs.

Assumptions: before is each job's average over the last 20 pull-request runs; after keeps that for unchanged jobs and uses this run's minutes for added or changed ones, weighted by how often each changed job ran in those runs; runs a day averages the seven whole days before today; time to green compares this run with the median of those runs that ran the same jobs.


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 for one fix in the new regenerate command.

  • regenerate in .github/scripts/node-record-refresh.mjs (lines 299-316) exits 0 when the run log yields no Node leg times, where the vitest-shard-sequencer.mjs record call it replaces exits 1, so a refresh that is due because coverage fell under nine in ten can finish green with no pull request; return 1 with the recorder's message in that case and add a test for it.

The per-leg division and the 1.5× / 5 s gate behave as described, and the new cases fail against main's script and pass here. Non-blocking: the printed re-timed count includes swizzle-proof slices whose entry the merge keeps unchanged (see the inline note).

Claims and files checked

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

  • Claim: the current refresh regenerates with the plain recorder, so every reached file takes that run's raw time. Verified: the workflow step on main and the recorder's merge in scripts/vitest-shard-sequencer.mjs.
  • Claim: regenerate groups the log by Node leg and divides by that leg's slowdown factor, the median, never below 1. Verified: node-record-refresh.mjs:137-155, node-time-drift.mjs:65-77.
  • Claim: a new file takes its time; a recorded file only when 1.5× off either way and at least 5 s away; a lower time only after the division. Verified: node-record-refresh.mjs:144-150.
  • Claim: every other entry keeps its value and deleted files drop out. Verified: scripts/lib/duration-split.mjs:162-175.
  • Claim: the workflow's regenerate step calls the new command and when the refresh runs is unchanged. Verified: node-record-refresh.yml:89; triggers untouched.
  • Claim: the refresh pull request's body says how the times were taken. Verified: node-record-refresh.mjs:205, :210.
  • Claim: the coverage and drift checks, branch, pull request, plain recorder and Node legs are unchanged. Verified: the diff only extracts the leg grouping the drift check already used.
  • Claim: it applies an earlier hand re-record's rule (per-leg factor; new files plus entries far off either way). Verified against that pull request's description.
  • Claim: new cases cover a slow leg, the 1.5× / 5 s gate, a lower time after division, the factor floor, and the workflow call keeping the file's other fields. Verified: node-record-refresh.test.mjs.
  • Claim: 109 tests pass across the four named suites, and the six new cases fail with main's script and workflow. Verified: 109 pass here; with this test file on main's code, 6 fail and 20 pass.
  • Claim: actionlint and prettier pass. Prettier verified; actionlint not verified (Lint has not run on this draft).
  • Claim: no CI impact on pull requests, and the refresh pull request carries fewer, steadier changes. Verified: no pull-request job changes; a run at record pace rewrites 0 entries where the plain recorder rewrites 493.
  • Claim: the CI spec's FR22 regeneration clause stays true and no record text changes. Verified.
  • Claim: no open pull request changes these files, and a companion pull request edits other functions. Not verified: a title and body search found none; not checked file by file.
  • File .github/scripts/node-record-refresh.mjs: blocking finding above; non-blocking re-timed count.
  • File .github/scripts/node-record-refresh.test.mjs: clear, apart from the missing case for a log with no Node times.
  • File .github/workflows/node-record-refresh.yml: clear.

Automated review (maintainer link)

Comment thread .github/scripts/node-record-refresh.mjs Resolved
Comment thread .github/scripts/node-record-refresh.mjs Resolved
…what the merge changed

As the recorder does, a log with no Node leg time exits 1 and leaves the record as it was, so a refresh that is due never ends green without one. The printed count compares the merged record with the old one, so a swizzle-proof slice the merge keeps at its largest time is not counted.

@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: CI has not run on this head yet.

Both points from the last review are fixed: regenerate now exits 1 and leaves the record untouched when the run log has no Node leg time, with a test for it, and its summary line counts only what the merge changed. The per-leg division and the 1.5× / 5 s rule behave as described, and the new case fails on the previous revision and passes here.

Claims and files checked

Review mode: incremental; reason: none

  • Changed rules (0): none.
  • Claim: the current refresh regenerates with the plain recorder, so every reached file takes that run's raw time. Verified: the base workflow's regenerate step and the recorder's merge (scripts/lib/duration-split.mjs:162-175).
  • Claim: regenerate groups the log by Node leg and divides by that leg's slowdown factor, the median, never below 1. Verified: node-record-refresh.mjs:137-155, node-time-drift.mjs:65-77.
  • Claim: a new file takes its time; a recorded file only when 1.5× off either way and at least 5 s away; a lower time only after the division. Verified: node-record-refresh.mjs:143-150.
  • Claim: every other entry keeps its value and deleted files drop out. Verified: scripts/lib/duration-split.mjs:162-175 and a probe at this head.
  • Claim: the workflow's regenerate step calls the new command and when the refresh runs is unchanged. Verified: node-record-refresh.yml:89; triggers untouched.
  • Claim: the refresh pull request's body says how the times were taken. Verified: node-record-refresh.mjs:205, :210.
  • Claim: the coverage and drift checks, branch, pull request, plain recorder and Node legs are unchanged. Verified: the diff only extracts the leg grouping the drift check already used.
  • Claim: it applies an earlier hand re-record's rule (per-leg factor; new files plus entries far off either way). Verified against that pull request's description.
  • Claim: new cases cover a slow leg, the 1.5× / 5 s gate, a lower time after division, the factor floor, and the workflow call keeping the file's other fields. Verified: node-record-refresh.test.mjs:161, :257 on.
  • Claim: a log with no Node leg time fails the command with exit 1 and leaves the record as it was. Verified: node-record-refresh.mjs:309-312, node-record-refresh.test.mjs:215-255, and a probe.
  • Claim: the printed count is what the merge changed. Verified: node-record-refresh.mjs:317-322 and a probe with an idle swizzle-proof slice.
  • Claim: 109 tests passed across the four named suites at the first revision, and the six new cases fail with main's script and workflow. Verified by the last review on that revision.
  • Claim: after the fix, the refresh and drift suites pass 50 of 50 and the new case fails on the previous revision. Verified: 27 and 23 pass here; on the previous revision with this test file, 1 fails and 26 pass.
  • Claim: actionlint and prettier pass. Prettier verified; actionlint not verified (Lint has not run on this draft).
  • Claim: no CI impact on pull requests, and the refresh pull request carries fewer, steadier changes. Verified: no pull-request job changes; a run at record pace rewrites 0 entries where the plain recorder rewrites 493.
  • Claim: the CI spec's FR22 regeneration clause stays true and no record text changes. Verified.
  • Claim: only the companion early-warning pull request also changes these files, with textual conflicts only. Partly verified: it changes all three files; other open pull requests were checked by text search, not file by file, and the conflict resolution was not checked.
  • Claim: notes on who owns and lands the change. Context, not checked.
  • File .github/scripts/node-record-refresh.mjs: clear; both earlier findings fixed.
  • File .github/scripts/node-record-refresh.test.mjs: clear.
  • File .github/workflows/node-record-refresh.yml: clear.

Automated review (maintainer link)

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 7c05403

@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 and Lint pass on this head.

regenerate divides each Node leg's times by that leg's own slowdown and rewrites only new and far-off entries, as described; it exits 1 and leaves the record untouched when the log has no Node leg time, and the seven new or changed cases fail against main's script and workflow and pass here. A fast runner still lowers large entries because the factor is clamped at 1, as the description says.

  • Non-blocking: the overlap check could also name #12760, a draft that changes coverage and openOrRefresh in the same script; it merges cleanly with this branch.
Claims and files checked

Review mode: same-head; reason: none

  • Claim: the refresh regenerated the record with the plain recorder, so every reached file took that run's raw time — verified (the base workflow's regenerate step; the recorder merges every measured time, vitest-shard-sequencer.mjs:262-288).
  • Claim: a slow runner raises every entry and a fast one lowers them — verified (simulated runs over the head's record).
  • Claim: regenerate --log groups the log by Node leg and divides each leg's times by the drift check's leg factor, never below 1 — verified (node-record-refresh.mjs:124-128; node-time-drift.mjs:65-77).
  • Claim: a file the record lacks takes its time — verified (node-record-refresh.mjs:134).
  • Claim: a recorded file is re-timed only when 1.5× off either way and at least 5 s away, and a lower time only after the division — verified (node-record-refresh.mjs:130-133; tests at node-record-refresh.test.mjs:386 and :402).
  • Claim: every other entry keeps its value and files that no longer exist drop out — verified (node-record-refresh.mjs:333-335).
  • Claim: the workflow's regenerate step calls it and when the refresh runs is unchanged — verified (node-record-refresh.yml:105; triggers unchanged).
  • Claim: the refresh pull request's body says how the times were taken — verified (node-record-refresh.mjs:208, :213).
  • Claim: the coverage and drift checks, the fixed branch, the pull request it opens, the plain recorder and the Node legs are unchanged — verified (no change to those functions or files).
  • Claim: this applies the earlier by-hand re-record's rule (per-leg factor, new files, entries far off either way) — verified against #11644's description.
  • Claim: the listed new test cases exist and cover each behaviour, and the printed count is what the merge changed — verified (node-record-refresh.test.mjs:208, :271, :326, :374, :386, :402, :413; count at node-record-refresh.mjs:339-345).
  • Claim: 109 tests passed at the first head and the 6 new cases failed with main's script — describes an earlier head; at this head 118 pass across the four named suites and the 7 new or changed cases fail on the base.
  • Claim: after the no-Node-time fix two suites passed 50 of 50 and its new case failed on the previous head — describes an earlier head; at this head those suites pass 56 of 56 and that case fails on the base.
  • Claim: actionlint and prettier pass — verified (the Lint workflow at this head, its actionlint and formatting steps included).
  • Claim: no CI impact on pull requests — verified (the workflow runs only after Main's run, on a schedule and by hand).
  • Claim: the refresh pull request carries fewer, steadier changes — verified in simulation (0 rewritten entries on slow or at-pace runs, against 835 to 1,072).
  • Claim: the spec's "regenerates the record from that run's Node legs" stays true and no record text changes — verified.
  • Claim: merged with main after the two log-reading fixes, and regenerate reads legs through the shared nodeLegLogs — verified (node-record-refresh.mjs:124; both fixes are in the base).
  • Claim: the only overlapping open pull request is the early-warning one (#11921), with textual conflicts — the conflicts are verified in all three files; out of date: #12760, opened later, also changes node-record-refresh.mjs and merges cleanly.
  • File .github/scripts/node-record-refresh.mjs: clear.
  • File .github/scripts/node-record-refresh.test.mjs: clear.
  • File .github/workflows/node-record-refresh.yml: clear; consistent with the script and pinned by the test.

Automated review (maintainer link)

@cixzhang
cixzhang marked this pull request as ready for review November 19, 2026 01:11
@cixzhang
cixzhang marked this pull request as draft November 19, 2026 01:51
@cixzhang
cixzhang marked this pull request as ready for review November 19, 2026 01:52
@cixzhang
cixzhang merged commit 7f2e0e8 into main Nov 19, 2026
172 of 203 checks passed
@github-actions
github-actions Bot deleted the ci/node-record-normalized-legs branch November 19, 2026 06:04

This branch was successfully deployed

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