Commit d7feb3c
ci: shard the test phase across 3 runners (#118)
`verify` took 9m03s as a single job on PR #116, and the test phase is ~95%
of it. Splitting the phases into a `static` job and a 3-way sharded `tests`
matrix cuts the gate to roughly 3-4 minutes. Nothing about what is checked
changes.
WHY SHARDING AND NOT A SETTING. Measured locally: the suite is 497s of CPU
in 68s of wall, ~7.5x on 12 cores (8 performance + 4 efficiency). Raising
parallelism on one box is already exhausted - CLAUDE.md records maxWorkers
4/8/11 at 74.7/61.7/61.8s against a 61.2s default. More machines is the only
remaining lever. Two other candidates were measured and rejected:
- `isolate: false`: 66 of 171 files FAIL. The same files pass individually
with --no-isolate, so it is cross-file module-state pollution, not a
misconfiguration. It also only bought 7.6% (68.24s -> 63.07s).
- `environment: node` by default (only ~30 of 164 spec files touch
document/window): worth ~3s. Real but not worth the churn on its own.
WHY THREE, MEASURED NOT GUESSED. vitest splits by FILE, so one file is an
unsplittable floor, and `test/previewAgreement.spec.ts` is 67s of the 68s
suite. Slowest-shard wall, which is what the gate waits on:
N=3 55.7 / 25.0 / 18.0 -> 55.7s 159 runner-seconds
N=4 53.5 / 37.1 / 23.4 / 16.9 -> 53.5s 211 runner-seconds
N=4 is 2.3s faster - inside run-to-run noise - for 33% more runner minutes,
because both are pinned by the same file. So 3 is the cost-optimal point,
not merely an adequate one. Raise it only after splitting previewAgreement
into its three independent tests, and re-measure rather than assuming.
The shards are unbalanced (55.7 vs 18.0) because the split is by file count,
not duration. That costs nothing here: even a perfect balance could not beat
the 67s file floor.
ANTI-DRIFT. The old single job ran `pnpm run verify` verbatim so CI could not
drift from local. That rule is kept by a different mechanism: this workflow
names only package.json SCRIPTS, never the underlying commands, and
`verify`, `verify:static` and `verify:shard` all compose the same
`verify:lint`. There is still one definition of each phase.
REQUIRED CHECK. Ruleset `EJ` requires a check named `verify`, so the
aggregating job keeps that id - a required check that never appears blocks
every PR forever. It asserts `needs.*.result` explicitly, because a `needs:`
job whose dependency failed is SKIPPED, and a skipped required check does not
block a merge. No ruleset change is needed.
NO BLOB REPORTS. `--reporter=blob` works, but `vp test --merge-reports` does
not merge - it re-runs, reporting 114 files from a 57-file shard's blob. The
directory stays gitignored anyway: running that reporter by hand drops a
~500 KB JSON in the repo root that `vp check`'s format step trips over.
Claude-Session: https://claude.ai/code/session_018AB7J1qK6kSBnJJmgDqMst
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent cc44aa7 commit d7feb3c
3 files changed
Lines changed: 90 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
10 | 30 | | |
11 | 31 | | |
12 | 32 | | |
| |||
52 | 72 | | |
53 | 73 | | |
54 | 74 | | |
55 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
56 | 79 | | |
57 | | - | |
58 | 80 | | |
59 | 81 | | |
60 | 82 | | |
61 | 83 | | |
62 | 84 | | |
63 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
64 | 110 | | |
65 | 111 | | |
66 | 112 | | |
| |||
89 | 135 | | |
90 | 136 | | |
91 | 137 | | |
92 | | - | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
93 | 163 | | |
94 | 164 | | |
95 | 165 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
24 | 32 | | |
25 | 33 | | |
26 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
17 | 20 | | |
18 | 21 | | |
19 | 22 | | |
| |||
0 commit comments