Skip to content

CI: run perpr as four legs balanced by recorded test time - #2161

Merged
remigiusz-antczak merged 2 commits into
mainfrom
land/wave-13
Oct 31, 2026
Merged

remigiusz-antczak merged 2 commits into
mainfrom
land/wave-13

Conversation

@remigiusz-antczak

@remigiusz-antczak remigiusz-antczak commented Oct 31, 2026 •

Copy link
Copy Markdown
Collaborator

Wave 13 runs the CI perpr job as four legs balanced by recorded test time; on the committed table the slowest leg's serial tests drop from 682 to 364 seconds.

What changes

  1. scripts/ci-tests-shard.sh gives each serial test, longest first, to the least-loaded leg, by seconds in scripts/ci-durations.tsv (CI run 41148962559). Unlisted tests count as the median.
  2. Four legs: this PR's three-leg run took 5:48 / 5:34 / 9:54, its slow leg also running the heaviest background test. Each background test now has its own leg and logs bg elapsed: <test> <seconds> s.
  3. New test scripts/test-perpr-shard-balance.sh; CONTRIBUTING.md says when and how to rebuild the table.

Verification

  • The rebuild command reproduces all 284 table rows.
  • Table predictions, not CI measurements: old 283 / 489 / 682 s, new 364 / 364 / 364 / 363 s. The balance test fails on the old helper.
  • Affected suites: 26 of 26 sections passed on the head. The three-leg version's independent review blocker is fixed.

Keep bar: revert unless, on each of the next 3 PRs, the slowest perpr leg is ≤ 9:10 and total perpr runner minutes rise ≤ 10%.

🤖 Generated with Claude Code

remigiusz-antczak and others added 2 commits October 31, 2026 02:56
scripts/ci-tests-shard.sh dealt the serial scripts/ci-tests.d registrations out
round-robin by sorted position, so the slowest leg set the job's wall clock, and
one inserted registration moved every later test to the next leg.

scripts/ci-durations.tsv now holds whole seconds per serial registration: the
seconds between consecutive "== <registration>" lines of the three perpr job
logs of public CI run 41148962559 (2026-10-31), rounded, at least 1. The helper
takes the serial registrations longest first (ties by name, C locale) and gives
each to the least-loaded leg (ties to the lowest index). A registration with no
valid row counts as the table's median, so adding a test needs no table edit.
Background (*.bg.sh) registrations stay round-robin, so only serial seconds are
balanced. The slices are still disjoint and complete for any N, a malformed
SHARD still exits 2 and an empty slice still exits 1.

On the committed table (every test counted at least 1 s, so these are
predictions from the table, not CI measurements) the old split gives legs of
283, 489 and 682 s of serial tests, and 544, 355 and 556 s once this change's
own new registration moves every later test to the next leg; the new split
gives 485, 485 and 485 s, so the slowest predicted leg drops from 682 to 485 s.

New test scripts/test-perpr-shard-balance.sh, registered as
scripts/ci-tests.d/perpr-shard-balance.sh: the table format, disjoint and
complete slices for N = 1 to 5, the slowest of 3 legs within 1.1x of the mean
(it fails on the old split), a fixture that pins the assignment, the median
default and the background round-robin, and the awk command CONTRIBUTING.md
gives for rebuilding the table, run on synthetic job logs. test-perpr-shard.sh
drops its "slices differ by at most 2 registrations" case, which only the
round-robin guaranteed. CONTRIBUTING.md describes the new split, says when to
refresh the table (the slowest leg's Per-PR tests step more than 20% over the
fastest on a PR run) and gives the rebuild command.

Tests: 10/10 affected sections passed (run-ci-tests.sh --affected 2e7e099,
including perpr-shard-balance, perpr-shard, ci-shards and conflict-free-prs);
size ratchet, fragments gate and privacy clean.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The perpr job ran three legs, balanced by recorded test time. It now runs four:
the matrix is shard 1 to 4, each leg passes SHARD=i/4, and the comment above the
job says so. The selftests job keeps three legs.

On the committed scripts/ci-durations.tsv (predictions from the table, not CI
measurements) the old helper with three legs on the tree before this change gave
legs of 283, 489 and 682 s of serial tests; the new split over four legs gives
364, 364, 364 and 363 s.

The wrapper that runs a background test (*.bg.sh) now writes the end time to
<test>.end before it publishes <test>.rc. The "Per-PR tests" step prints one
"bg elapsed: <test> <seconds> s" line after the test's log: the end time minus
the background start, or "?" when no end time was written. The line does not
start with "==", so the awk command in CONTRIBUTING.md that rebuilds the table
still ignores it. scripts/test-perpr-shard.sh checks that every fixture leg
logs exactly one.

scripts/test-perpr-shard-balance.sh no longer hard-codes three legs: it reads N
from the SHARD=i/N that ci.yml's perpr legs pass, with the same 1.1x-of-mean bar.
CONTRIBUTING.md and a comment in scripts/ci-tests-shard.sh no longer name the
number of legs, and the rebuild command reads leg*.log, so the next change of N
needs no doc edit. The changelog fragment now describes four legs.

Tests: test-perpr-shard-balance 6/6, test-perpr-shard 21/21, test-ci-shards
1/1; 26 of 26 sections passed (run-ci-tests.sh --affected 2e7e099, privacy
and trigger lint included); size ratchet, fragments gate and privacy clean. On
the old helper the four-leg balance case fails (legs 380/247/544/284 s).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@remigiusz-antczak remigiusz-antczak changed the title Wave 13: balance the CI perpr legs by recorded test time CI: run perpr as four legs balanced by recorded test time Oct 31, 2026
@remigiusz-antczak
remigiusz-antczak merged commit e91de69 into main Oct 31, 2026
11 checks passed
@remigiusz-antczak
remigiusz-antczak deleted the land/wave-13 branch October 31, 2026 04:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant