Repository navigation
perf(ci): shard the helper suites so Package invariants fits its cap - #899
Merged
Merged
Conversation
The 141 helper suites ran one after another for over 30 minutes, so Package invariants hit its timeout on every pull request. Split them over six legs balanced by measured run time, keep Package invariants as an aggregate that fails unless every discovered suite passed on exactly one shard, print each suite's time, and run the acceptance matrix's read-only fixture arms in parallel. Assisted-by: ClaudeCode:claude-opus-5-5
Run 41646864752 put 146 s of suites on shard 0 and 393 s on shard 5, because the table still held the pre-prefetch time of the acceptance matrix. With the measured per-suite seconds the split predicts 302 to 303 s per shard. The quarantined suite keeps its old weight. Assisted-by: ClaudeCode:claude-opus-5-5
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.
Package invariantsis a required check on main and hits its 30-minute timeout on every pull request (#888, #896, #897, #898, and others' PRs), so it reads CANCELLED. This PR makes it fit without raising the cap and without dropping a suite.Why it got slow
The job runs all 141
scripts/lib/test_*suites one after another. Per-suite times from CI run 41600349698 (deltas between PASS lines), which reached 133 suites at 29 minutes:Most of the time is full
run-hydra-gates.shruns over fixtures (about 3 s each in CI, 100 gates at a fraction of a second each; no single gate dominates, gate 122 is the largest at about 13 percent). The suite count keeps growing with every gate, which is why a 10-minute job in September is a 30+ minute job now. The 8 suites aftertest_gate_scope_matrix.shhad not run in CI at all while it timed out.What changes
run-helper-suites.shtakesHELPER_SHARDS/HELPER_SHARDand runs only its shard.tests/partition_helper_suites.pysplits longest-first by the measured times intests/helper-suite-timings.tsv. A suite missing from the table gets a default weight, so a stale table can only unbalance the shards, never drop a suite. Discovery, the quarantine and its rot check are unchanged; each quarantine entry is checked on the shard that owns it.invariants-shardruns 6 legs (Package invariants (shard N of 6)), each with the old 30-minute cap. The bin invariant suite and the no-Ajv manifest check run on shard 0. Each leg uploads its per-suite verdicts.Package invariantsstays the required name. It is now the aggregate.tests/check-helper-shard-reports.pyre-discovers the suites and fails unless every one has exactly one PASS or QUARANTINED verdict from exactly one shard, every shard left a report, and the matrix succeeded. A cancelled, crashed or lossy shard cannot read green.test_gate_acceptance_matrix.shruns its 82 read-only fixture arms up front,nprocat a time (HYDRA_ACCEPT_JOBS, 1 keeps the old sequential path), then grades in the same order from the stored output. The other heavy suites mutate one fixture between runner calls, so they are left sequential.ajv ajv-formats(under a second).Verified locally
tests/test-partition-helper-suites.py: 12 cases, including every real suite on exactly one shard, a suite missing from the table still running, and the aggregate refusing a lost suite, a duplicate, a FAIL, a missing shard report, an unknown suite and a cancelled matrix.git statusclean).assert-run-steps-resolvable.pyOK.CI result
Run 41646864752 on 6bb8df8:
Package invariants(the aggregate) passed, and so did all 6 legs.The slowest leg took 6m42s against the 30-minute cap that the single job used to hit. The 6 shard reports hold 141 suites, each exactly once: 140 PASS and 1 QUARANTINED (
test_gate_orphaned_capability_fixtures.sh, as documented).The suites that never ran before now pass. Run 41600349698 timed out before reaching them. All 11 suites that are absent from its log pass here:
test_gates_23_33_never_green_over_nothing.sh,test_generate_mock_register.py,test_js_scope.js,test_lib_commonjs_scope.sh,test_manifest_diff_scope.py,test_manifest_scope_filter.js,test_or_abstraction_exceptions.sh,test_or_abstraction_pdok.sh,test_php_template_scope.py,test_source_scope.pyandtest_vendored_schema_freshness.js. This includes the 8 aftertest_gate_scope_matrix.sh.Rebalanced. The legs were uneven (146 to 393 suite seconds), mainly because the table still held the acceptance matrix at 268 s, while the prefetch brought it down to 124 s. ebaafd5 replaces the table with the per-suite seconds measured in this run. The quarantined suite keeps its old weight. Fed the measured times, the old table reproduces the observed loads exactly, and the new table predicts 302 to 303 s on every shard.
tests/test-partition-helper-suites.pypasses (12 tests). That commit gets a new CI run, and I have not read it.AI disclosure: prepared with Claude Code (Opus 5.5).
🤖 Generated with Claude Code