ADR-0340: The shards of a test-file cut share its opening run
Status: Accepted Date: 2026-12-03 Amends: 0013: what a shard's overhead holds, for a cut into parts of the test files; 0195: a streamed shard's estimate
Context
A runner that opens each shard on its suite under coverage pays an opening
run per shard, and the plan charges it to every shard: the cut makes no shard
whose share of the cost is under shards.cutAt times its setup and opening
run (ADR-0013), a target's room is what the target leaves past them, and each
shard's estimate holds the run (ADR-0195). The opening run is the coverage
map's time for the whole suite.
Where splitStream.sharding cuts the test files into parts, a shard streams
its own part and no other, so it pays the opening run of its part. The plan
still charged each shard the whole suite. In run 46924493145 the map held
1,404 s of tests; each of the five shards' estimates (1,562 s to 2,247 s)
held those 1,404 s, while each shard's first pass of its part took 39 s to
131 s. With every shard charged the whole suite, a ten-minute target left no
room and the cutAt floor held the cut to five shards of 25 to 40 minutes.
Decision
- A shard's overhead is its setup and the opening run it pays. A cut into parts of the test files shares the opening run between its shards: where it makes n shards, each pays its setup and one n-th of the run. Any other cut charges each shard its setup and the whole run, as before.
- The cut counts with that overhead: a shard is made only where its share of
the cost is at least
shards.cutAttimes its setup and its share of the opening run; a target fits as many shards as leave each its share of the cost past those; billed minutes count each job at its own overhead. - A shard of a test-file part holds one n-th of the opening run in its estimate, n being the cut's parts.
Consequences
- A large change cut into test parts gets the shards its cost needs within the target, instead of a handful of long ones.
- How long each part's opening run takes is still its even share of the whole; parts are cut to about the same test time, so the share holds as closely as the cut does.