Repository navigation
Description
Context
#4109/#4134 delivered the hosted determinism job. The later #4137/#4143 delivery requests two repetitions at ready confirmation and the default five at other PR cadences, under CPU load. The reviewed weights in scripts/test-shard-costs.json reduce the count uniformly when needed for the 600 weighted-second budget, with a floor of two. A selection too heavy for the floor still runs every file twice and is reported over budget; nothing is skipped.
The job runs the whole selection in one invocation, under a 40-minute step limit. Measured over the last 150 first-parent commits on main before #4109 (to 78e326c80), using the reviewed weights:
- 142 of 150 selections weigh at most 120 seconds, so they get five repetitions inside the budget.
- 4 of 150 weigh more than 600 seconds. At the floor of two they cost 1,554 to 2,654 weighted seconds before any slowdown from the load. The largest was a 388-file fixture migration.
A selection of that size can exceed the step limit. It then fails visibly by timeout, never green, but the pull request has no way through the gate other than splitting the change.
First hosted measurement (run 43986946575 on #4118, four burners on four CPUs): 552 seconds elapsed for about 174 weighted seconds, so about 3.2 elapsed seconds per weighted second. At that ratio a selection exactly at the 600-second budget needs about 32 of the 40 minutes. A selection over budget at the floor of two exceeds the limit once one pass weighs more than about 375 seconds. That is one run of eight tooling files, so it is not yet a calibration.
Decided (maintainer, 2026-11-17): A, shard by reviewed weight, as unit is sharded.
Scope
- A selection whose estimated cost at its repetition count exceeds one job's capacity is split across several
determinismpartitions by reviewed weight. A selection within capacity stays one job, as today. - One owner holds the capacity and the maximum partition count; the planner, the workflow matrix, the command each partition runs, the aggregates and the workflow lint all read it.
- Each selected file runs in exactly one partition, at no fewer than two repetitions. The aggregate refuses a partition set that differs from the plan, and a selected file that no partition ran.
- A selection too heavy even at the maximum partition count fails before it runs, naming the selection's weight and the limit. It is never skipped and never reduced below the floor.
- Recalibrate the capacity, the 600-second budget and the 40-minute step limit from the hosted runs that now exist (elapsed against estimated seconds in each job's report), and record the runs and the ratio in
docs/decisions/ci-utility.md.
Out of scope
- Lowering the floor below two, or skipping a selected file.
- Any retry that turns a failure green.
- Running workers inside one job, and an exception path for large migrations: both declined in the ruling.
- The repetition count at ready confirmation (ci: the determinism job can be the longest job in a ready confirmation and hold the merge lease #4137).
Acceptance criteria
- A selection the size of the largest observed (about 2,654 weighted seconds at two repetitions) plans several partitions, each within capacity, covering every file exactly once. A test shown failing first.
- A selection within capacity plans one partition and the job's output is unchanged.
- The aggregate refuses a missing, extra or failed partition, and the merge path refuses a confirmation whose partition set is not the planned one. A mutation that drops one partition fails the named test.
-
bun run lintrefuses a workflow whose matrix or command disagrees with the planner. - A selection beyond the maximum fails with a message naming the weight and the limit.
- The decision record names the hosted runs behind the recalibrated numbers.
- The PR's own
determinismjob runs green.
Verification
bun run check:pr --base origin/main, with failing-first and mutation receipts.- The PR's own hosted run.
Contract impact
None. CI tooling only.
2026-11-17 triage: folded the first measured elapsed-to-weighted ratio from the comment into Context. Declared the dependency on #4109, whose determinism job is not on main yet (scripts/test-determinism.ts is absent at 9e7429a91).
2026-11-17 triage at main d974052166f335cbf57b385fddc13875da1b98de: Verified the actual #4109 output in merged #4134 (be0bb0708): planRepetitions (scripts/test-determinism.ts:71-90) and the hosted job (.github/workflows/ci.yml:645-699) implement the unchanged five/default, floor-two, no-skip gate. Retired the satisfied canonical dependency; project-sync already removed blocked and posted its dated explanation. The oversized-selection choice remains unresolved under the existing decision prompt; this is no longer an implementation prerequisite.
The confirmation-cadence amendment is verified at eb9191c4bf523bbadefe52a0c727a4f0df2388eb: repetitionsFor (scripts/test-determinism.ts:41-43) and the production hosted-command caller select two without changing the floor or oversized-selection behavior. #4137 is delivered; this issue's remaining partition/capacity choice is still unresolved.
2026-11-17: the maintainer chose A (shard by weight); the options were replaced by scope and acceptance criteria.
Activity
schlessera commentedon Nov 17, 2026
First measured ratio, from the job's first hosted run on #4118 (run 43986946575, four burners on four CPUs): 552 seconds elapsed for about 174 weighted seconds, so about 3.2 elapsed seconds per weighted second.
At that ratio a selection exactly at the 600-second budget needs about 32 minutes of the 40-minute step limit. A selection over budget at the floor of two exceeds the limit once it weighs more than about 375 seconds per pass. This is one run of eight tooling test files; recalibrate from more runs before changing the budget or the limit.
schlessera commentedon Nov 17, 2026
Decision needed (triage, 2026-11-17). What does the
determinismjob do with a selection too heavy to finish two repetitions inside its step limit?unitis sharded. Each shard stays inside the step limit, and the floor of two and no-skip both hold. Cost: more runners for large PRs (about 4 of the last 150 selections), plus a shard-count rule kept in step withscripts/test-shard-costs.json.scripts/unit-workers.tsdoes. One job and fewer runners. Cost: the workers share the job's CPUs with the four load burners, so measured elapsed time under load gets worse, and the 3.2 ratio has to be re-measured with workers.Recommendation (not approval): A. It keeps the gate the same for every PR without an exception path, and reuses sharding that already exists. Whichever option is chosen, first recalibrate the 600-second budget and the 40-minute limit from more hosted runs than the single eight-file run so far.
Completion evidence: a
**Decision (maintainer, <date>):**comment choosing A, B or C. Acceptance criteria then follow from that choice. Implementation also waits for #4109 to merge.schlessera commentedon Nov 17, 2026
Unblocked: #4109 is closed, so
scripts/sync-project.tsis removing theblockedlabel.schlessera commentedon Nov 17, 2026
Decision (maintainer, 2026-11-17): A, shard the job by reviewed weight, as
unitis sharded. A selection within one job's capacity stays one job; an oversized one is split, every file still runs at least twice, and a selection beyond the maximum partition count fails before it runs instead of timing out. Workers inside one job and an exception path for large migrations are declined. Recalibrate the capacity, budget and step limit from the hosted runs that now exist.schlessera commentedon Nov 17, 2026
Claimed for implementation. Claim token:
claim-76a6203d. Branch:chore/4117-shard-determinism.none; scripts/pr-status.ts and scripts/test-shard-costs.json are left untouched for the workers editing them
chore(ci): shard an oversized determinism selection by reviewed weight (
chore(ci): repeat a PR's changed Vitest specs under load in the pinne…