Repository navigation
ci: keep the recorded Node test times fresh from main on a schedule, and never fail a pull request on them - #11900
Conversation
…and never fail a pull request on them
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
/approve-spec e0cbd3b |
There was a problem hiding this comment.
Requesting changes: the scheduled refresh matches the FR22 text an engineering owner approved for this head, but two points need fixing.
node-time-drift.mjs:199and:254no longer fail a pull request that makes a recorded test file much slower than its entry, yet the approved FR22 sentence exempts only a missing recorded time and the scheduled job re-records only when fewer than nine in ten files have a time (node-record-refresh.mjs:49), so a slowed file's low entry can land and stay and later legs planned from it can run past the fifteen-minute budget that FR22 and DEC-17 require; keep::errorand exit 1 for drifted changed files with notices only for unrecorded ones, or amend FR22 to cover drift and make the refresh also fire on drifted entries.- The claim that a stale record never breaks a leg's time budget (
node-record-refresh.mjs:7-8, andnode-time-drift.mjs:8-9,node-record-refresh.yml:5and the description) does not hold, because the planner books an unrecorded file at about 10 s whilevitest-node-legs.mjs:34-37notes one that ran 290 s, and this head's slowest Node leg ended about 85 s before its watchdog; say instead that a stale record costs leg balance and can make a leg run long until it is refreshed.
Non-blocking: each scheduled run force-pushes a new commit to the refresh branch while main's record stays stale, even when the record already matches the open pull request, so a CI run started by reopening that pull request goes stale every six hours; comparing with the branch before pushing avoids that.
Claims and files checked
Review mode: full; reason: no-earlier-review
- Claim: a per-pull-request guard failed when fewer than nine in ten Node test files had a recorded time. Verified: the removed test in
scripts/vitest-shard-sequencer.test.mjs. - Claim:
main's record times 1,240 of 1,381 Node test files (89.7%). Verified: the repository's own file list and record at the base give 1,240 of 1,381. - Claim: the leg planner books an unrecorded file at the ninetieth percentile. Verified:
scripts/vitest-node-legs.mjs:34-38and:85-90. - Claim: a stale record costs leg balance only, never correctness or the time budget. The correctness part is verified (every file runs in exactly one leg). The time-budget part is false; see above.
- Claim: only the coverage guard leaves the pull-request path, and every other sequencer test stays. Verified: the diff removes one test and one import.
- Claim: the new workflow runs every six hours and by hand, on
mainonly, with write scopes only in its one job. Verified:node-record-refresh.yml:18-42. - Claim: below the bar it re-records from
main's latest successful full unit run, force-pushes one commit to a fixed branch as the Actions bot, opens or edits one pull request, and never pushes tomain. Verified:node-record-refresh.yml:52-84andnode-record-refresh.mjs:103-136. - Claim: the drift step reports the same facts and suggested entry, as notices, and always exits 0. Verified:
node-time-drift.mjs:180-254. - Claim: re-recording a recent full run of
maintimes 1,262 files. Not verified: that run's logs were not available to this review. - Claim: pull-request jobs keep their runner classes and job-minutes. Verified: the
ci.ymledits are comments only. - Claim: the new job costs about ten to fifteen runner-minutes a day. Not measured.
- Claim: CI on the refresh pull request starts when someone with write access reopens it. Verified:
ci.yml:21runs onreopened. - Claim: the listed test runs and formatting and knowledge checks pass. Verified: all seven Node legs and Lint passed at this head, including the sequencer test (23 tests),
node-record-refresh.test.mjs(14) andnode-time-drift.test.mjs(23). .github/scripts/node-record-refresh.mjs: finding (lines 7-8; the trigger at line 49 ignores drift)..github/scripts/node-record-refresh.test.mjs: clear..github/scripts/node-time-drift.mjs: finding (lines 199 and 254)..github/scripts/node-time-drift.test.mjs: clear..github/workflows/ci.yml: clear..github/workflows/node-record-refresh.yml: non-blocking note (push churn) and the claim at line 5.docs/specs/AST-030/spec.md: clear; an engineering owner approved it at this head.scripts/vitest-shard-sequencer.test.mjs: clear.
PR Analysis Report🔎 Preview ·
|
| Before | After | Change | |
|---|---|---|---|
| Job-minutes per PR update | 173.3 | 173.3 | 0 |
| Runner pool, runner-minutes a day | 69,333 | 69,333 | 0 (0%) |
| Average concurrent jobs | 48.1 | 48.1 | 0 |
| Time to green (median → this run) | — | 9.8 min | — |
| Runs a day | 400 | 400 | 0 |
Other workflows: node-record-refresh.yml added: 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, .github/scripts/node-time-drift.mjs, .github/scripts/node-time-drift.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
…ly a missing entry is a notice
|
Thanks, all three points are addressed in 74a155c:
The FR22 text is unchanged. |
…main, on low coverage or drift; drift stays a notice on pull requests
…r a recorded time's drift
|
/approve-spec 3eb8e40 |
There was a problem hiding this comment.
Approved pending CI: CI has not finished on this head yet.
The scheduled refresh, the notice-only drift step and the removed coverage guard match FR22 as an engineering owner approved it for this head, and both earlier points are fixed: the refresh now also fires when a recorded file drifts in main's run, and the comments no longer say a stale record cannot break a leg's time budget.
Non-blocking:
- While a refresh is due, each successful full unit run of
main(about hourly) commits a new record toci/node-durations-refresh, because each new run's times differ from the branch's, so a CI run started by reopening the bot pull request goes stale within the hour; checking the branch's record first and skipping the commit when it is already fresh would keep that run current. - The checkout keeps the job's write-scoped token in
.git/configwhile setup runspnpm installwith lifecycle scripts;persist-credentials: false, with the token given only to the fetch and push, keeps it out of the install.
Claims and files checked
Review mode: full; reason: spec-record
Claims:
- The per-pull-request guard failed when fewer than nine in ten Node test files had a recorded time: verified, the removed test in
scripts/vitest-shard-sequencer.test.mjs. main's record timed 1,240 of 1,382 Node test files (89.7%): verified at the merge base with this head's file list;mainhas since been re-recorded by hand to 99.1%.- The planner books an unrecorded file at the ninetieth percentile, so a missing entry never drops a file but costs leg balance and can make a leg run long: verified,
scripts/vitest-node-legs.mjs:34-38and:85-90, and the "exactly one leg with no record" test. - Only the coverage guard leaves the pull-request path and every other sequencer test stays: verified, one test and one import removed; 23 sequencer tests pass.
- A drifted or unrecorded changed test file is a notice, the step always exits 0, and it reports the same facts and suggested entry: verified,
node-time-drift.mjs:198-212and:255, and the notice-mode tests. - The job runs after a completed Main run on
main, every six hours and by hand, and counts only a successful, dispatched, same-repository run ofmain: verified,node-record-refresh.yml:19-28and:41-47. - A refresh is due under nine in ten coverage or when a recorded file drifts by the pull-request rule with the same margin, each leg's slowdown taken out separately: verified,
node-record-refresh.mjs:35-41and:77-110. - When due, it regenerates with the existing recorder, force-pushes one commit to the fixed branch as the Actions bot, skips the push when the branch already carries that record, opens or edits one pull request, and never pushes to
main: verified,node-record-refresh.yml:84-111andopenOrRefresh; the skip fires only on a re-read of the same run (see the note above). - Only this job has
contents: writeandpull-requests: write, plusactions: read: verified,node-record-refresh.yml:30and:50-54. - FR22 states both triggers and that no pull-request check fails on the record's coverage or a recorded time's drift, with a verification row: verified,
docs/specs/AST-030/spec.md:532-540and the new FR22 row. - A dry run on a recent full unit run found both reasons and
recordtimed 1,262 files: not checked, since that run's log was not available to this review; the merge base does recordtheme-stress.test.mjsat 36.6 s. - Pull-request jobs keep their runner classes and minutes, and the drift step does the same work: verified, the
ci.ymledits are comments only; the new job's minutes a day are an estimate. - A pull request opened or pushed with the workflow token starts no workflow, so CI on it starts on reopen: verified,
ci.yml:21runs onreopened. - The
.github/scriptsand sequencer test runs, Prettier, the ESLint ignore and the knowledge check: verified, 146 files under.github/scripts, the refresh, drift and sequencer suites pass (22, 23, 23), Prettier is clean,eslint.config.js:209ignores.github/scripts/**, and the knowledge check passes.
Files:
.github/scripts/node-record-refresh.mjs: clear..github/scripts/node-record-refresh.test.mjs: clear..github/scripts/node-time-drift.mjs: clear..github/scripts/node-time-drift.test.mjs: clear..github/workflows/ci.yml: clear; the comments match the notice-only step..github/workflows/node-record-refresh.yml: two non-blocking notes above.docs/specs/AST-030/spec.md: clear; the FR22 text and row match the code.scripts/vitest-shard-sequencer.test.mjs: clear.
| run: | | ||
| # A branch that already carries this record keeps its commit, so a | ||
| # CI run on the open pull request stays current. | ||
| if git fetch --quiet origin refs/heads/ci/node-durations-refresh && |
There was a problem hiding this comment.
Non-blocking: while a refresh is due, check compares each run with main's record, so every successful full unit run (about hourly) regenerates, and record gives each measured file that run's time, so this comparison with the branch matches only when the six-hour backstop re-reads a run already recorded. A CI run started by reopening the bot pull request then goes stale at the next Main run. Running check against the branch's record too, and skipping the commit when that record is already fresh with no drift against this run, would keep it current.
| contents: write | ||
| pull-requests: write | ||
| steps: | ||
| - uses: actions/checkout@v7 |
There was a problem hiding this comment.
Non-blocking: this checkout keeps the job's contents: write token in .git/config while ./.github/actions/setup runs pnpm install --frozen-lockfile with lifecycle scripts. persist-credentials: false, with the token given only to the fetch and push below, keeps it out of the install.
Maintainer impact
A merge that adds Node test files leaves
scripts/vitest-node-durations.jsonbehind. A per-pull-request guard inscripts/vitest-shard-sequencer.test.mjsfailed when fewer than nine in ten of the Node project's test files had a recorded time, so the first Node leg failed on every open pull request until someone re-recorded by hand. The leg planner books an unrecorded file at the ninetieth percentile (about 10 s), so a missing entry never drops a file, but a missing or low entry costs leg balance and can make a leg run long until the next refresh. A contributor cannot produce a CI-comparable time, so the record is kept fresh from main's own runs instead of by pull requests.Intended invariant
AST-030 FR22: Node legs split by recorded time; which files run never depends on the times. This adds: no pull-request check fails on the record's coverage or on a recorded time's drift, and after each successful full unit run of
main(with a six-hour backstop) a job re-records when coverage drops below nine in ten or a recorded file drifted past its entry.Change
scripts/vitest-shard-sequencer.test.mjs: the "nine in ten" coverage guard leaves the per-pull-request path. Every other sequencer test stays..github/scripts/node-time-drift.mjs: a drifted or unrecorded changed test file is a::noticeinstead of an::error, and the step always exits 0. It reports the same facts and the same suggested entry..github/workflows/node-record-refresh.yml:workflow_runon the Main workflow (completed,branches: [main]), every six hours as a backstop, and by hand. A completed run counts only when it succeeded, was a full unit run (a dispatch; a push runs no Node leg), and is this repository'smain..github/scripts/node-record-refresh.mjs check. A refresh is due when fewer thanMIN_RECORDED_SHARE = 0.9of the Node test files have a recorded time, or a recorded file ran far past its entry by the pull-request drift rule (driftedfrom node-time-drift.mjs, withDRIFT_MARGIN_S = MARGIN_S), each leg's slowdown taken out separately.node scripts/vitest-shard-sequencer.mjs record, force-pushes one commit to the fixed branchci/node-durations-refreshasgithub-actions[bot](skipped when the branch already carries that record), and opens the pull request or edits the open one. It never pushes tomain.contents: writeandpull-requests: write, plusactions: readto read main's run logs.Evidence
mainthe record times 1240 of 1382 Node test files (89.7%), so the guard failed the first Node leg on every pull request.main: refresh due for both reasons (89.7% coverage;packages/cli/api/theme-edit/theme-stress.test.mjsran 103.1 s against its recorded 36.6 s).recordon that log times 1262 files and brings the record over the bar.test-nodeandswizzle-proofdoes the same work and only changes its annotation level. New job on standardubuntu-latestafter each successful full unit run ofmain(about hourly) plus four backstop runs a day: about three minutes each (setup, one log read, one check), about one more on a run that regenerates the record; about 80 runner-minutes a day, under 0.06 average concurrent jobs. Time to green for pull requests improves when the record is stale, since the first Node leg no longer fails.Scope
Components: none
A pull request opened or pushed with the workflow token starts no workflow, so CI on the refresh pull request starts when someone with write access reopens it.
Testing
pnpm exec vitest run --project node .github/scripts/: 143 files passed, 3 skipped (3390 tests).pnpm exec vitest run --project node scripts/vitest-shard-sequencer.test.mjs: 23 passed.node-record-refresh.test.mjs: workflow shape (theworkflow_runtrigger on Main, completed, main; success, full-unit-run and same-repository conditions; the backstop schedule; permissions; the fixed branch, force-push only to it, skipped when unchanged); the coverage bar at and below nine in ten; a drift-triggered refresh with full coverage (one recorded file far past its entry → refresh, and the pull request names it); no refresh within the drift rule; a leg that ran slow throughout; only Node-leg lines read;recordover a fixture Main log lifting the share over the bar; one pull request across repeated runs; every Node file in exactly one leg with an empty record; the pull-request drift step exiting 0 for an unrecorded slow file and for a recorded file far past its entry.node-time-drift.test.mjs: notice mode (notices, never errors; exit 0; exit 2 only for missing arguments).lintjob runspnpm check:repo(step "Check repository guardrails", which includescheck:cldr-weekdaysandcheck:knowledge) and Prettier over the changed files (step "Check formatting of changed files"). The latest commit also passed the full local hook.pnpm check:knowledgepasses.Writing rubric results
R1 narration: none; the new FR22 sentences state what the system does in the present tense. A draft sentence ("A missing or low recorded time never fails a pull-request check") overstated the rule, since a missing time still counts at the ninetieth percentile toward the over-eight-legs failure; it now reads "No pull-request check fails on the record's coverage or on a recorded time's drift", and the verification row's failure column matches.
R2 research: none in the record.
R3 evidence: the verification row names a test file and the states it covers, not a change.
R4 rejected alternatives: none added.
R5 change references: none.
R6 open questions: none added.
R7 project status: none.