Skip to content

ci: shadow the unit tests with a parallel run - #155

Closed
HMarzban wants to merge 8 commits into
mainfrom
ci/shadow-parallel-unit-tests
Closed

HMarzban wants to merge 8 commits into
mainfrom
ci/shadow-parallel-unit-tests

Conversation

@HMarzban

@HMarzban HMarzban commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The parallel unit-test shadow run. This PR used to carry more: its merge-queue runbook settings, CPU logging and shard notes have landed through #141 and #175. It now has main merged in, and the diff contains only:

  • The shadow step: after the serial Unit tests gate, the checks job runs bun test --parallel --path-ignore-patterns 'tests/unit/stress/**' with continue-on-error.
  • The compare script: scripts/compare-unit-runs.ts compares the two JUnit reports file by file (passed, failed and skipped counts). It warns on each file that differs and fails only the shadow step.
  • The serial gate is unchanged. It still gates and now also writes a JUnit report.
  • Tests: tests/unit/ci/compare-unit-runs.test.ts, plus a ci-workflow.test.ts case pinning that the serial step gates and the parallel one does not.
  • Docs: TESTING note and CHANGELOG entry.

Shadow results so far: matched on 6 of 6 CI runs. Each had 2,079 passed in both runs, about 57 s serial against 26 s parallel. Promoting it to the gate needs three things: 5 identical runs, the owner's sign-off, and the timing-budget unit tests moved to a serial pass first.

The A/B below drove #175, which packs shards by duration.

A/B (sharded CI, 3 shards + perf)

Baselines are 44999283346 and 45000072391. The rest are this branch's runs:

  • 12bd729: no library project;
  • f60d4a4: with the library project and per-job CPU logging.

Times are job execution; "queue" is time spent waiting for a free runner.

Run Total Queue + gate wait Checks Perf Shards 1 / 2 / 3 Gap Shadow
44999283346 (baseline, dispatch) 7m28s 3 s + 46 s 2m50s 4m58s 6m22s / 6m21s / 5m51s 31 s n/a
45000072391 (baseline, PR) 8m49s 10 s + 3 s 2m26s 5m44s 6m28s / 8m16s / 6m05s 2m11s n/a
45002118422 (PR) 17m48s 2m36s + 2 s 2m54s 5m07s 5m55s / 8m27s / 7m04s 2m32s match
45003534039 (dispatch) 9m24s 3 s + 43 s 2m43s 5m30s 7m17s / 8m17s / 5m47s 2m30s match
45004270523 (dispatch) 11m44s 18 s + 93 s 3m30s 5m13s 6m26s / 8m54s / 6m08s 2m46s match
45005050458 (PR) 24m23s 6m11s + 230 s 2m53s 5m05s 7m04s / 8m44s / 5m18s 3m26s match
45007001367 (dispatch) 28m50s 2m15s + 658 s 2m48s 5m14s 9m15s / 8m19s / 6m50s 2m25s match
45009375557 (dispatch) 38m45s 8m42s + 31 s 3m29s 5m29s 6m41s / 8m31s / 6m42s 1m50s match

Against the targets (this branch's 6 runs):

Target Result Met?
Median total ≤ 8 min 20m51s no: runner queueing
Median slowest shard ≤ 7 min 8m38s no
Median gap < 60 s 2m31s no
--list count unchanged 575 tests in 49 files (556 chromium + 19 library) yes
Shadow matches serial 6 of 6 runs; per run, 2,079 passed in both, about 57 s serial vs 26 s parallel yes

CPU per shard (runs logging it):

Run Shard 1 Shard 2 Shard 3 Perf
45005050458 Xeon 6975P, 6.1 min of tests EPYC 7763, 7.9 min Xeon 6975P, 4.3 min EPYC 9V74, 4.3 min
45007001367 EPYC 7763, 8.6 min Xeon 8573C, 7.6 min EPYC 7763, 6.1 min EPYC 9V45, 4.6 min
45009375557 Xeon 6975P, 5.7 min EPYC 7763, 7.8 min EPYC 7763, 6.1 min EPYC 9V45, 4.9 min

What this shows:

  1. Hardware is a lottery worth about 40%. The same shard took 4.3 min on a Xeon 6975P and 6.1 min on an EPYC 7763.
  2. Shard 2 is heavier on any CPU. It took 7.6 min even on a Xeon 8573C. Its contiguous range holds the slow-per-test specs: palette, selection-bubble, paint-format, slash-menu and outline-overlay. The structural gap is about 1.5–2.5 min, not the 50 s estimated from one fast-hardware run.
  3. Total wall time is now set by runner queueing, not by the work. Up to 8m42s passed before the first job started, and up to 11 min before the gate got a runner, while about 12 sessions shared the organisation's 20 concurrent jobs. A run now takes 8 jobs (with desktop).

Test plan

  • bun test tests/unit/ci passes (86 tests), including the compare script's unit tests and the shadow step's shape.
  • The shadow step on CI matches the serial run per file (6 of 6 runs).
  • A/B: median wall time ≤ 8 min. Not met; see A/B. The --list count is unchanged (575 tests in 49 files).

🤖 Generated with Claude Code

After the serial gate, the checks job runs the same files with
`bun test --parallel` (continue-on-error) and compares the two JUnit
reports file by file, so the parallel runner can be promoted once it has
matched the serial one.
Three entries of about seven jobs each would take 21 of the free plan's 20 concurrent jobs.
@HMarzban
HMarzban changed the base branch from ci/sharded-e2e-merge-queue to main November 22, 2026 08:53
@HMarzban HMarzban changed the title ci: shadow parallel unit tests; merge queue builds two entries ci: shadow the unit tests with a parallel run Nov 22, 2026
@HMarzban

Copy link
Copy Markdown
Contributor Author

Folded into #186, which makes the parallel unit tests the gate. Unit tests run with --parallel, the clock-budget files serially after; UNIT_SERIAL=1 falls back. The compare script moves to the nightly unit-runs job. The shadow step matched the serial run on 6 of 6 runs here.

@HMarzban HMarzban closed this Nov 22, 2026
@HMarzban
HMarzban deleted the ci/shadow-parallel-unit-tests branch November 22, 2026 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant