GeezerVison is showing github.com — perf(ci): split Test Web over two runners with vitest --shard (modelled: 56 s median off a web PR's longest job, 109 s on web-only PRs) by Pyseph · Pull Request #31035 · pingdotgg/t3code
Conversation
Problem
Test Web is the longest job of a pull request that touches web code. Measured from the CI logs of 22 pull_request runs of ci.yml (the 22, out of the 29 newest successful runs, in which Test Web ran; 2026-11-04 13:58-14:43 UTC; rows in measured.tsv, rows.json, crit.json at https://gist.github.com/Pyseph/f072acc53038e3550506eae0c813e01f):
| Step of Test Web (8 vCPU) |
median |
min |
max |
| Whole job |
246.5 s |
201 |
424 |
| Set up job, Checkout, Setup Vite+, Chromium restore |
23.5 s |
19 |
45 |
| Test step |
199.5 s |
154 |
354 |
| Boot the built web client |
22 s |
21 |
26 |
- Test Web was the longest job in 16 of the 22 runs. In the other 6 a server shard ended 2-48 s later.
- 6 runs were web-only (no Test Server shard ran). The next-longest job was Build and Typecheck, ending 59-91 s into the run, against Test Web ending 219-312 s.
- 16 runs were web + server. The slowest server shard ended at a median of 215.5 s into the run, against Test Web at a median of 258 s.
- Test step, 14 of the 22 logs parsed (
webfiles.json): 515 files (343 unit, 172 browser). The first file finishes at about 13 s (startup, repeated by every runner). About 103 small browser files then take 55-139 s after the last unit file, roughly 0.7 s per file: per-file overhead that divides by the number of files per runner.
Change
One file, .github/workflows/ci.yml, 14 lines added and 3 removed:
test_web gets strategy: { fail-fast: false, matrix: { shard: [1, 2] } }.
- The Test step becomes
vp run --filter @t3tools/web test --shard ${{ matrix.shard }}/${{ strategy.job-total }}. vitest cuts the files (unit and browser alike) by a hash of the path. No config or code change in apps/web.
- "Boot the built web client" runs on shard 1 only (
if: matrix.shard == 1); the build does not depend on which test files ran.
- Check names:
Test Web becomes Test Web 1 and Test Web 2. "Test Web" is not a required check (ruleset 13856153 requires Test, Check, Mobile Native Static Analysis, Release Smoke, Test Server 1-3, Rust); it gates through Check, whose needs already contains test_web. A matrix job reports one needs.test_web.result, which the existing jq expression accepts unchanged. I found no other reference to "Test Web" in the repo. When Test Web is skipped, the skipped job shows as Test Web ${{ matrix.shard }}, cosmetic.
release.yml is not touched.
- If perf(ci): boot the built web client in Build and Typecheck, not Test Web (about 22 s off the longest job) #30752 (moves the boot step to Build and Typecheck) lands first, the boot step leaves this job and the
if: matrix.shard == 1 line goes away together with it; a trivial rebase either way.
Expected effect
Modelled from the CI durations above (model.py, sim2.py, sim-summary.tsv), not measured on sharded runners. This PR's own CI run will be the first real sample.
Model: shard time = 13 s startup (repeated) + 189 s variable part x the heaviest shard's share, plus the 23.5 s setup repeated per runner. At N = 2 the heaviest share is 0.50 (258 / 257 files). Shard job: 246.5 s -> 134 s (median).
| PR kind |
runs |
critical-path saving, median (range) |
| web-only |
6 |
109 s (94-141) |
| web + server |
16 |
40 s (0-153); 6 of the 16 save 0 because a server shard already ends last |
| all |
22 |
56 s (0-153) |
The 153 s maximum comes from one outlier run where Test Web took 424 s. Cost: about +24 runner-seconds per PR (about +10%), because the per-file overhead halves per runner while only about 23 s of setup is duplicated.
Why not 3 or 4 shards: on web + server PRs the server shards (about 215 s) are the critical path once Test Web is about 134 s, so the median saving stays 40 s at any N. On web-only PRs, 3 or 4 hash shards gain 5-35 s over N = 2 at best, depending on where the one 87 s file (AttachmentFilePreview.browser.test.tsx) lands, for 3-10 times the extra runner-seconds (+82 to +270 s). Balancing them would need a weighted sequencer and weights file, which is new code to maintain.
Scope and approval
I read the "Establish the problem and scope first" section of CONTRIBUTING.md. This is CI maintenance that is meant to preserve behaviour: the same 515 test files run with the same commands, and only the job layout and two visible check names change. I do not have a triaged issue or an Ideas discussion for it yet, and I am not claiming an exception. If maintainers want a discussion first, I am happy to close this PR and open one.
Verification
- Local
--shard completeness and disjointness (runshards.sh, real-shards.json): stub one-line test files at the real 515 paths with the same include/exclude globs, real vite-plus 1.4.0 / vitest 5.0.5, vp test run --shard=i/N. N = 2: 258 + 257 files. N = 3: 172 + 172 + 171. N = 4: 129 + 129 + 129 + 128. For each N the union is exactly the 515 files, with no duplicates and no gaps.
vp run test --shard 2/2 forwards the flag to vp test run (257 files), the same way release.yml already passes --shard to the server tests.
- The workflow file parses as YAML (js-yaml, Node 26);
test_web has the matrix and the if as intended. git diff origin/main shows only these changes.
Not checked
- Browser-mode behaviour under
--shard: the stubs ran in the node pool, so this is unverified until CI runs. vitest does not treat the browser project specially when sharding.
- The real web suite on sharded runners; the CPU use of the 8 vCPUs; the floor set by the 87 s browser file; any effect on browser-test flakiness or timeouts (all unmeasured).
- The saving figures are a model over one 45-minute window of PR runs (no push runs).
- No Blacksmith runner run of the patched workflow yet.
Claude Sonnet 5.5 and Claude Opus 5.5 in T3 Code (Claude Code harness).
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Test Web is the longest job of web pull requests; vitest --shard halves its files per runner.
The boot step runs on shard 1 only; Check still gates on test_web as a whole.
Approvability
Verdict: Approved at 052b5f5
Macroscope's review found this PR approvable — Splits web tests across two CI runners while keeping the built-client boot check on one shard and requiring both shards through the existing aggregate gate. Effects are limited to CI scheduling and modest additional runner usage; product behavior and permissions are unchanged.
You can add or adjust custom eligibility rules. Learn more.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Nov 4, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

Walkthrough
-
The CI workflow runs web tests in two matrix shards with fail-fast disabled. Each shard receives its index and the total shard count.
Changes: Web CI
| Layer / File(s) |
Summary |
Shard web tests .github/workflows/ci.yml |
The test_web job runs as two named matrix shards with fail-fast disabled. The test command receives the shard index and total shard count. |
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Refactor
Possibly related issues
pingdotgg/t3code#28013: The issue reports web browser test timeouts under parallel CI load. This change distributes web tests across two shards, but its effect on timeouts is not established.
pingdotgg/t3code#22324: The issue reports browser test flakes in full web suite runs. This change distributes test files across CI shards, but its effect on flakiness is not established.
Suggested reviewers: t3dotgg
Merge Risk: Minimal · up to cc874
-
Web tests now run across two jobs. No merge-blocking issue was established.
Pre-merge checks: 3 · 1
-
Failed checks: 1 warning
| Check name |
Status |
Explanation |
Resolution |
| Description check |
 |
The description covers the problem, change, and verification. It lacks the required scope approval, and the author does not claim an exception. |
Link a triaged issue or discussion with explicit maintainer approval of the direction and scope, including the approval comment. Alternatively, explain why the change qualifies for an exception in the template. |
Passed checks: 3 passed
-
| Check name |
Status |
Explanation |
| Title check |
 |
The title identifies the main change: splitting web tests across two CI runners. |
| Linked Issues check |
 |
Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check |
 |
Check skipped because no linked issues were found for this pull request. |
Finishing Touches
-
Generate unit tests (beta)
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Usage-based review receipt
Note This review was completed with usage-based billing: files reviewed beyond your plan's included limits are billed at $0.25/file. View usage-based billing.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Note Written by Claude Opus 5.5 on behalf of Pyseph
This PR's own CI run, 41880861744, is the first real sample, and it falls short of the model:
| Shard |
Job |
Test step |
Files |
| Test Web 1 |
153 s |
108 s, plus 23 s boot |
258 |
| Test Web 2 |
246 s |
214 s |
257 |
The 12 unsharded Test Web jobs that succeeded in the same window (17:35-18:10 UTC) took 226-348 s, with a median of 278.5 s. The longer shard therefore finished about 32 s before the same-window median. The model predicted a job of about 134 s.
The gap comes from the split. --shard divides files evenly by count (258/257), but not by time, and the 87 s AttachmentFilePreview.browser.test.tsx landed in shard 2. To get close to the model, the split has to weigh files by duration. The server suite already does that with WeightedShardSequencer and shardWeights.json. I'll work on reusing that for the web suite, and either update this PR or close it if the balanced version doesn't hold up. This is still a single run.
Same-window unsharded run IDs
41880896497 41880875054 41880870266 41880478923 41880421591 41880321728 41880258022 41880111006 41879709827 41879639759 41879599486 41879228790
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Note Written by Claude Opus 5.5 on behalf of Pyseph
A correction to my last comment. A closer look at the first sample says the gap came mostly from a slow runner, not from the split. Shard 2 was slow at every phase:
- Setup Vite+ took 16 s against 9 s on shard 1.
- Its first test file finished at 28.0 s against 12.8 s.
- Its browser files ran at 2.0x their median time.
- The 80 s file took 144 s.
The Test Server shards in that run were slow as well.
On median per-file durations from 22 unsharded runs, this PR's path-hash cut gives 103 s and 110 s of tests per shard. A duration-weighted cut gives 106 s and 106 s. I built and simulated the weighted version: about 2 s better, for a new sequencer copy and a weights file, so I'm not adding it. Its only real advantage is robustness when heavy test files are added or renamed.
The modelled longest-job saving for this PR stays at a median of 96 s (74-176 s) over those 22 runs, or 111 s once #30752's boot-step move lands. A second sharded run would show whether the first one was an outlier.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Keeps the branch current and gives the sharded jobs a second real CI sample.
Note Written by Claude Opus 5.5 on behalf of Pyseph
Second real sample, from a merge of main (run 41999451279). It supports the model, and the first run looks like an outlier from a slow runner.
| Shard |
Job |
Test step |
|
| Test Web 1 |
126 s |
85 s |
plus 21 s boot |
| Test Web 2 |
126 s |
100 s |
|
The model predicted about 134 s per shard. The 13 unsharded Test Web jobs that succeeded within 40 minutes of this run took 185-272 s, with a median of 208 s, so the longest Test Web job finished about 82 s sooner. Two runs are still only two runs: the earlier one came out at 246 s for its slower shard.
Same-window unsharded run IDs
41999229833 41999046127 41999028227 41998989145 41998244812 41997925389 41997473245 41997128375 41996973419 41996949607 41996689172 41995693214 41994417006
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
# Conflicts:
# .github/workflows/ci.yml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Note Written by claude-opus-5-5 on behalf of Maria
Merged current main into this branch (merge commit cc87444ded, no rebase) to clear the conflict in .github/workflows/ci.yml.
#30752 moved "Boot the built web client" out of test_web into Build and Typecheck, so the resolution takes main's side there and drops this PR's if: matrix.shard == 1 gate on that step. The rest of the change is unchanged: the [1, 2] matrix, fail-fast: false, the Test Web N names, and --shard ${{ matrix.shard }}/${{ strategy.job-total }}.
CI on cc87444ded is green. Test Web 1 ran 263 files and Test Web 2 ran 262, each in about 2 minutes. vp run check:changed also passes.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Thanks for this. Main has the change since #34554.
Main now implements your complete workflow diff: Test Web 1 and 2, fail-fast disabled, a [1, 2] shard matrix, and the identical Vitest --shard command. I compared your full diff with the merged and current ci.yml; main also applies the split to release tests.
Closing as superseded.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
size:S
10-29 changed lines (additions + deletions).
vouch:unvouched
Author is not yet trusted in the VOUCHED list.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|