Repository navigation
chore(ci): shard an oversized determinism selection by reviewed weight (#4117) - #4157
Merged
Merged
Conversation
The repetition count is decided over the whole selection; the selection is then split into the fewest partitions that each fit one job's capacity. A file whose repetitions alone exceed the capacity runs by itself, and a selection that needs more than the maximum is refused with its weight and the limit. DETERMINISM_PARTITIONS owns the capacity, the maximum, the step limit and the measured load ratio; the repetition budget is the capacity, recalibrated from 600 to 300 weighted seconds. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ns (#4117) The planner publishes determinism_shards and the determinism job becomes a matrix over it; each partition's command reads its files from the same plan and refuses a divisor that is not the planned count. The hosted aggregate refuses a published set that differs from the plan, the merge path requires one successful job per published partition, and the workflow guard refuses a literal matrix, divisor, shared artifact name or foreign step limit. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…4117) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This was referenced Nov 17, 2026
schlessera
marked this pull request as ready for review
November 17, 2026 13:49
|
This PR's squash |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #4117
What changed
The hosted
determinismjob no longer has to run a whole selection in one invocation. The repetition count is still decided over the whole selection; a selection that fits one job at that count stays one job with the same command and report, and one that does not is split by reviewed weight intodeterminism (1..n), each within one job's capacity, with every file in exactly one partition at no fewer than two repetitions. A selection that needs more than ten partitions fails in the metadata job before anything runs, naming its weight and the limit. The capacity and the repetition budget are recalibrated from 600 to 300 weighted seconds from the hosted runs that now exist; the 40-minute step limit stays.DETERMINISM_PARTITIONSinscripts/proof-shards.tsholds the capacity (300), the maximum (10), the step limit (40 minutes) and the measured load ratio (6.84). The planner, each partition's command, the hosted aggregate, the merge path and the workflow guard read it.scripts/determinism-plan.ts(new, pure) holdsplanRepetitions(moved fromscripts/test-determinism.ts, which re-exports it) andplanPartitions: the fewest partitions, balanced longest file first withbalanceTests, in which every partition fits. Because the budget is the capacity, a selection is only ever split at the floor of two, so ci: the determinism job can be the longest job in a ready confirmation and hold the merge lease #4137 composes: the count first, then the partitions for that count.scripts/ci-plan.tspublishesdeterminism_shards; thedeterminismjob is a matrix over it with the matrix's own job total as divisor, asunitis.scripts/ci-proof.ts determinism --shard=M/Nreads its files from the same plan and refuses a divisor that is not the planned count.validateSelectionsrefuses a published set that differs from the plan; the merge path requires one successfuldeterminism (n)per published number;bun run lintrefuses a literal matrix, a literal divisor, a shared artifact name or a step limit other than the owner's.heavy-feedback.ymlis regenerated.Recalibration
35 hosted
determinismjobs had produced a report when this was written (all 2026-11-17, four burners on four CPUs; 32 passed, 3 failed). Five passing jobs repeated at least 90 weighted seconds, where the weights dominate:The first run (43986946575) measured 3.17 before it failed in its last file, and the first two-repetition confirmation (44036241499, #4143) 1.82 on 11.4 estimated seconds. At the worst ratio the old 600-second budget needed 68 minutes, so it never fitted its 40-minute step. 300 weighted seconds need 34 minutes at 6.84 and 27 at the median 5.40. The decision record has the full table, the per-file spread (1.1 to 6.9) and the effect on the 150 pre-gate merges (100 of 111 selections still get five repetitions; six are split, the 388-file migration into nine).
Why this shape
The maintainer's ruling on the issue chose sharding by weight, as
unitis sharded, and declined in-job workers and an exception path. Three choices inside that ruling:Proof
Failing first, with the partition loop replaced by the pre-change single job (
for (let count = 1; count <= 1; …) … if (true) return):Mutations, each applied alone, run against the named test and restored:
validateSelectionsignoresdeterminism_shardstests/ci-plan.test.ts"the executable publishes the planned partitions, and the aggregate refuses any other set"DROPPED_PARTITION:draft=true: did not throwtests/test-determinism.test.ts"a selection the size of the largest observed…"SEVERAL_PARTITIONS:draft: expected 9, received 8tests/integration-proof.test.ts"the merge path accepts a confirmation only with exactly its planned determinism partitions"ONE_PLANNED_ONE_RAN: inventory differstests/ci-workflows.test.ts"the determinism matrix, divisor and step limit come from the planner and its one owner"LITERAL_ONE_MATRIX: received[]tests/test-determinism.test.ts"a selection beyond the maximum partition count is refused, naming its weight and the limit"tests/hosted-proof.test.ts"an oversized selection runs as planned partitions…"WITHIN_CAPACITY: expected <= 300, received 320COUNT_DECIDED_OVER_THE_SELECTION:draft[1]tests/ci-plan.test.ts"the executable publishes the planned partitions…"SPLIT_BY_WEIGHT:draft=trueFocused runs, all green:
tests/ci-plan.test.ts,tests/test-determinism.test.ts,tests/red-main.test.ts,tests/check-receipt.test.ts,tests/local-checks.test.ts,tests/heavy-feedback.test.ts,tests/candidate-proof.test.ts,tests/integration-command.test.ts,tests/proof-inventory.test.ts(214 tests), andtests/ci-workflows.test.ts,tests/hosted-proof.test.ts,tests/integration-proof.test.ts(125 tests).Off-main qualification
This PR's own draft run exercises the changed planner, matrix and partition command on head
44894204f: thedeterminism (1)job of the run linked below repeats the five Bun test files this PR changes. It qualifies the unsplit path; a split selection is covered by tests only (see Anything left open).44894204ff19dee9d72111424978b85777e31a32).0df7ea4eac22bb84bbfa9225ff4dcbf48475fc12). The planner, matrix and partition command are the ones this PR changes; the merge added no change to them.{"version":1,"kind":"brain-check-pr-receipt","head":"0df7ea4eac22bb84bbfa9225ff4dcbf48475fc12","base":"origin/main","mode":"focused","startedAt":"2026-11-17T13:33:28.480Z","finishedAt":"2026-11-17T13:34:57.997Z","checks":[{"name":"all lint and leakage gates","categories":["changeset"],"outcome":"passed","elapsedMs":12807.143018},{"name":"environment documentation","categories":["changeset"],"outcome":"passed","elapsedMs":117.05235100000027},{"name":"pending changeset package names","categories":["changeset"],"outcome":"passed","elapsedMs":97.26018799999838},{"name":"contribution changeset","categories":["changeset"],"outcome":"passed","elapsedMs":20.95357999999942},{"name":"affected fast invariants","categories":["verify","unit"],"outcome":"passed","elapsedMs":76455.43136999999}]}A split selection on hosted runners. #4157's own selection is one partition, so a throwaway draft (#4158, closed unmerged) added a comment to six heavy root test files on top of this branch at
44894204f. Run https://github.com/schlessera/brain-kit/actions/runs/44050951291 on that headdcd767842planned four partitions at two repetitions, and all four passed:determinism (1)determinism (2)determinism (3)determinism (4)Every partition stayed under the 300-second capacity and far inside the 40-minute step.
draft gatesaccepted the four-partition set.Checklist
packages/ui-react/,packages/ui-kit/,packages/ui-server/orpackages/core/carries a recorded independent review of its head (bun scripts/review-receipt.ts check <pr>), or it touches none of them.docs/reflect the change, or nothing documented moved.docs/decisions/provider-history.md): the provider-history guard passes, or nothing on a turn's path changed.Guard checklist: the refusal beyond the maximum
tests/ci-plan.test.ts"the executable publishes the planned partitions…": the refused head fails while the same fixture's earlier head still plans and validates.Anything left open
determinism (2..n)has run only in tests. The matrix, divisor and per-partition artifact follow theunitjob's proven wiring. A throwaway draft that touches a few heavy tooling tests would exercise it for real, at the cost of about three runners.determinism (1). A branch that has not merged main carries a merge path that expectsdeterminism, and refuses the new inventory until it is refreshed.scripts/test-shard-costs.jsonis in progress elsewhere. The capacity rests on five runs of tooling and backend tests under the current table; the decision record says to recalibrate from the reports when the table or the mix changes.🤖 Generated with Claude Code