Repository navigation
ci(macos): split the macOS suite into three shards under the same 20-minute cap - #6983
Conversation
…minute cap The two macOS shards reached their 20-minute job limit with tests still passing: run 38214884055 cancelled macos 2/2 with 68 of 1118 files left. Across seventeen dev dispatches (2026-10-04..10-12) the slower half's test step grew from 867s to 1155s while the unsharded control grew from 1696s to 2170s, so the suite outgrew two halves rather than one shard misbehaving. Replaying the duration assignment against those runs' measured per-file times reproduces the cancel (1205s of tests on the slow half) and puts the slowest of three shards at 635-796s, about 14 minutes with setup. The cap stays 20 so a wedged shard (#4956) is cut off as early as before; failure handling in run-bun-test-batches.sh is unchanged. The contract tests now pin the three-shard matrix, check that the check name and TEST_SHARD divisor match the matrix length, and run the batch ownership fixture at the workflow's real divisor with failures injected into the shard that owns the target file. Refs #6978
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to The three-shard configuration appears ready to merge after normal checks. Pre-merge checks |
|
|
✅ Deterministic PR hygiene checks passed. |
Ingwannu
left a comment
There was a problem hiding this comment.
Reviewed the complete five-file diff at 736e7bf04e570974c0217b37c7de136c00a03b38 against a0191a1b6fd921a6e5a9d12cb123c8df88b023e7 for workflow correctness and regression behavior. Matrix [1,2,3], job-name /3 and TEST_SHARD /3 move together; the 20-minute cap, process shape, failure verdict, triggers and permissions remain unchanged.
Independent bounded Linux/Bun 1.4.0 execution of macos-serial-lanes.test.ts with pattern every actual workflow|same basenames|assertion failure stops: 4 pass, 0 fail, 71 assertions; 22 filtered out. This runs the real workflow batch command and shell selection with synthetic files/fake Bun children, checking each file once across all three shards, basename collisions and injected assertion failures in the owning shard. Disposable homes; verified CPU 75%, RAM high/max 1280/1536 MiB, swap 0, tasks 64, nice 10, finite deadline. It is not a real macOS timing or full-suite receipt.
I closed my independently prepared headroom-only alternative #6985 unmerged after discovering this broader evidence-backed approach. Exact-head hosted PR run 38222137968 and full dispatch 38222141865 are still queued at this check; replay estimates are not their results. No new scan or dispatch was initiated by this review, and this ordinary correctness review does not stand in for the explicit independent workflow-boundary review required by policy.
|
Maintainer integration into |
Summary
The macOS test shards (
macos 1/2,macos 2/2) had grown to their 20-minute job limit. Full dispatch run 38214884055 cancelledmacos 2/2at the cap with 68 of its 1,118 files left, and every test it had run was passing. This splits the macOS suite into three shards and keeps the 20-minute cap.Where the time went. I parsed the shard and control logs of the seventeen
workflow_dispatchruns ondevfrom 2026-10-04 to 10-12 withparseJobLogfromscripts/ci/test-durations.ts.Across all seventeen control runs the fitted trend is about +22 s of test time and +25 files per day (about 1.2% a day; individual runs range from 1,687 s to 2,170 s, so the two endpoints overstate it). The problem is the suite outgrowing two halves, not one misbehaving shard. Two smaller effects add to it. Runner variance moves the same recorded file set between 636 s and 864 s per shard. The shard balancer also uses a duration table from 2026-09-23 where 678 files have no row and weigh 157 ms, while on macOS they average about 0.7 s, so two shards predicted at 683 s each can differ by up to about 190 s in one run. That table is filed separately as #6982, because refreshing it also changes Linux and Windows shard membership.
Why three shards and not a longer cap. Replaying the exact assignment algorithm against measured per-file macOS times reproduces the cancellation: the slow half needed 1,205 s of tests, plus about 55 s of setup, which is more than 20 minutes. The same replay puts the slowest of three shards at 635–796 s across the last five runs, about 14.2 minutes with setup, which leaves about 5.8 minutes under the 20-minute cap. That is a replay estimate, not a completed run. The hosted dispatch below is the actual measurement.
#4905/#5028 sized the unsharded control's cap from a measured complete run because sharding that lane would remove its purpose. This lane is the reverse case. It was sharded so macOS stays off the critical path, and it runs in the
main/previewpush runs thatrelease.ymlgates on. Keeping two shards at 25–30 minutes would leave a 21-minute or longer macOS leg on that path, and the leg would keep growing with the suite. By the rule intests/helpers/test-budget.ts, a budget goes up only when the wait is intrinsic to what is being tested, and this wait comes from suite size. Keeping 20 minutes also means a wedged shard (#4956) is cut off just as early as before.What does not change. Failure handling is untouched.
scripts/ci/run-bun-test-batches.shstill fails a shard on the first assertion failure, process timeout or Bun crash, with no retry and no exclusions. The aggregatecigate checksplatform-macosat the job level,release.ymlrequires a successful push-event run, and no ruleset ondev/main/previewlists a required status check. So the check name changing frommacos N/2tomacos N/3affects no gate.Changes:
.github/workflows/ci.yml(platform-macosonly): check namemacos ${{ matrix.shard }}/3,matrix.shard: [1, 2, 3],TEST_SHARD: ${{ matrix.shard }}/3, and the comment rationale.timeout-minutes: 20is unchanged.tests/ci-workflows/ci-workflows.test.ts: pins the three-shard matrix and/3, and asserts that the check-name divisor and theTEST_SHARDdivisor both equal the matrix length.tests/ci-workflows/macos-serial-lanes.test.ts: reads the shard count from the workflow matrix instead of hard-coding 2, checks ownership across every shard, and injects assertion and crash failures into the shard that owns the target file. With three shards the serial target moves to shard 3, so injecting into shard 1 would have made those cases vacuous.structure/ops/docs-and-release.md,structure/overview.md: shard names1/3, 2/3 and 3/3.Refs #6978
Verification
bun run typecheck: exit 0bun test --isolate --timeout 60000 ./tests/ci-workflows/: 1536 pass, 3 skip (Windows-only), 0 fail across 80 files, exit 0After the final comment fix:
ci-workflows,macos-serial-lanes,ci-review-lanesandci-scope-reductiontests passed (196 pass, 0 fail, exit 0)bun run structure:checkpassed;bun run privacy:scanpassedactionlint .github/workflows/ci.yml: only the three SC2016 infos thatorigin/devalready reports in the aggregate job script; no new diagnosticsAblation: reverting only the check name to
/2failsci-workflows.test.tsat the new divisor assertionThe full local
bun run testwas not run. This change touches only workflow shape, its contract tests and docs, and the suite the workflow runs is the hosted dispatch below.Hosted, exact head
736e7bf04e. Both runs completed all three macOS shards successfully:lane=alldispatch 38222141865: job / test stepThe slowest shard takes 15.4 minutes, 4.6 minutes under the 20-minute cap, so the cap is 30% above the measured duration. On the PR run, the measured per-shard times were 795/842/672 s against the replay's 796/740/657 s for the same files. The extra time on 2/3 is spread across several integration files, which matches the runner variance seen on
dev. Shard 2/3 was the heaviest in both runs, which is the imbalance [Bug][CI]: shard duration table is three weeks stale and under-weights 678 unrecorded test files #6982 addresses. The macOS jobs waited 22–30 minutes for runners in these runs, which is also why this stops at three shards instead of four.Checklist
AGENTS.mdplaces behind explicit security review. The workflow change is limited to theplatform-macosmatrix (shard list, check name,TEST_SHARDdivisor) and its comments. It adds or changes no permission, secret, action reference, trigger, runner label,if:condition or timeout. An independent review compared the parsed workflow againstdevand found only those three semantic changes.