Repository navigation
perf(ci): refresh server test shard weights from CI timings (slowest shard 146.5 s → 125.1 s median) - #30866
perf(ci): refresh server test shard weights from CI timings (slowest shard 146.5 s → 125.1 s median)#30866Pyseph wants to merge 1 commit into
Conversation
pingdotgg#20044 rebuilt shardWeights.json from CI wall times; since then weights were scaled and edited by hand and new test files were added, so the table names 214 of 463 server test files and rates git-heavy files at a fraction of their CI time (GitVcsDriverCore 7.2 s recorded, about 32 s on the shard runners). The 8 shards ended up 90-180 s apart. Replace the table with the per-file median of the vitest Duration lines from 20 recent successful ci.yml runs, written in the format update-test-shard-weights.ts uses (0.1 s rounding, files of 0.5 s or more, sorted keys). Only which files share a runner changes; each file still runs alone through test:cached. The four entries for deleted test files are gone as a side effect.
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This refresh changes server-test shard timing weights, affecting runner balance rather than product behavior or test coverage. The change is confined to an ignored data path, with no material operational exposure identified. Notes:
You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
Note Written by Claude Opus 5.5 on behalf of Pyseph This PR's own CI run, 41842144065, is one real sample of the refreshed table. Its 8 Test Server jobs took 129-166 s, a 37 s spread. For comparison, here are the 32 other successful
The runners were slower this afternoon than in the 08:30-09:50 UTC window the table was built from, so these times don't compare directly with the 173 -> 148 s in the description. It's still a single run. Run IDs (job durations from
|
Problem
Test Serversplits the 463 server test files over 8 runners withWeightedShardSequencer, balanced onapps/server/src/testUtils/shardWeights.json. #20044 rebuilt that table from CI wall times on Oct 15; since then #22557 scaled the weights, #22717 and #22753 edited entries by hand, and new test files were added, so it no longer describes the CI runners:scripts/dev-replay-agent.test.ts9.1 s,userInputAttachments.test.ts9.5 s,KiroReplayFixtures8.3 s,ClaudeAdapterV26.2 s,RemoteDelegation5.8 s).GitVcsDriverCore.test.ts7.2 s recorded, 32.6 s median in CI;GitManager.test.ts13.7 s vs 33.6 s;storageCleanup.test.ts1.4 s vs 12 s.So the weight sums per shard are even (about 68 s each) but the real shards are not. In the 20 runs below the slowest shard's tests took a median 147 s, the fastest 91 s (a 55 s median spread). The slowest
Test Serverjob is the longest job of a PR in 8 of those 20 runs (every run where Test Web did not run), and in 10 of 20 once the 22 s step that #30752 moves out of Test Web is gone.Change
Data only: replace
shardWeights.jsonwith the per-file median of the vitestDurationline from 20 recent successfulci.ymlruns (160 shard logs), written in the same format asupdate-test-shard-weights.tswrites (0.1 s rounding, files of at least 0.5 s, keys sorted, two-space indent, trailing newline; the old file round-trips through that formatting byte for byte). The measure differs from the generator's: vitest'sDurationincludes import time, as the sequencer's comment asks, where the generator records local test time. It also differs from #20044, which used the gaps between shard log lines; weights built from those gaps scored worse here (slowest shard 128.8 s against 125.1 s). 299 files are recorded instead of 214: 114 newly, and 29 old entries dropped (25 files whose CI median is below 0.5 s, plus the 4 deleted files).Nothing else changes: the sequencer,
test:cached, the matrix and the tests are untouched. Only which files share a runner changes; each file still runs alone in its ownvitestprocess, so test isolation (fileParallelism: false) and per-file cache keys are the same.Why not the generator:
update-test-shard-weights.tsruns the whole suite once on the machine it is started on and records that machine's timings. I did not change it; like #20044, this is a CI-derived data refresh. Teaching the generator to read thetest-cache-NJSON that shards already upload would keep the table fresh, but that is a larger change I would only attempt after a maintainer asks for it.Relation to #28746 ("drop shard weights for deleted test files"): this file contains none of the four deleted entries that PR removes, so it is a superset of it. Whichever lands first, the other conflicts textually in this one file; if #28746 lands first, rebase this on it and keep this version of the table (the same four keys are absent). If this lands first, #28746 becomes a no-op.
Scope and approval
No issue or discussion: behaviour-preserving CI maintenance of a data file that the repo already regenerates by hand (#14025, #20044, #22557, #22717, #22753 all updated it). No test, product or workflow code changes. If you would rather discuss it first, I am happy to move it to an Ideas discussion.
Verification
Method and raw rows:
Durationof everyvp test run '<file>'in the 8 shard logs of 20 successfulci.ymlPR runs (41800013420 ... 41810223239, 2026-11-04 08:30-09:50 UTC, 160 jobs, no task-cache hits), viagh api repos/pingdotgg/t3code/actions/jobs/<id>/logs.WeightedShardSequencer.shard()(sort by weight descending then path, greedy to the first least-loaded shard) and applied it, with the current table, to each run's file list: all 9,357 file placements in the 20 runs match the shard each file actually ran on. I also ran the repository's realweightedShardSequencer.ts(only the vitest base class stubbed) over the 463 files with the old and the new table: identical split to the port in both cases.vp test runto the start of the next). The slowest shard's tests, current table -> refreshed table:A perfectly even split would be 112 s (mean shard), so 125 s leaves 13 s of noise and the 10-17 s per-shard task-runner overhead. Run-to-run noise on the git-heavy files is large (25-48 s for
GitVcsDriverCore), which is why weights from a single run would not do.3. Different time of day: the table from the 20 runs, scored on 9 older runs from 05:51-06:19 UTC (vitest
Duration+ 0.25 s per file): slowest shard 141.8 -> 123.4 s median, 8 of 9 improved, one 1 s worse.4. Job level (real job durations, shard job time adjusted by the simulated change of its own shard sum): the slowest
Test Serverjob over the 20 runs 173 -> 148 s median. Where a server shard was the longest job of the run (8 of 20), the longest job gets 20.4 s shorter at the median (7.4-35.1 s, 12.0 % of the job). Where Test Web is longer the PR does nothing for that run (it is not slower anywhere).Not checked: the real effect in CI (this PR's own run shows one more sample); the weights will go stale as tests are added, like the current ones did.
Claude Sonnet 5.5 and Claude Opus 5.5 in T3 Code (Claude Code harness).