Skip to content

ci(tests): shard the bats suite 5 ways, not 4, to clear the 30-min macOS cap (#1107) - #1160

Merged
fujibee merged 2 commits into
integration/terminal-driver-v1from
agdev-cc3-1107-shard-total
Sep 11, 2026
Merged

ci(tests): shard the bats suite 5 ways, not 4, to clear the 30-min macOS cap (#1107)#1160
fujibee merged 2 commits into
integration/terminal-driver-v1from
agdev-cc3-1107-shard-total

Conversation

@fujibee

@fujibee fujibee commented Sep 11, 2026

Copy link
Copy Markdown
Owner

Stopgap for #1107. Unblocks the merge gate on integration/terminal-driver-v1 (which #1155 / #1156 / #1157 are all waiting on). A main-targeted twin follows separately.

What #1107 actually is

Not a hang — a slow shard hitting the 30-min wall-clock cap while still passing tests (the workflow's own #848/#857 note warns these look identical). Measured from the hang-samples time series, the cancelled macOS 4/4 was progressing the whole way; it just had too much to do.

Why one shard is overloaded

The suite grew ~2.85x (788 → 2246 @tests) since the partition was tuned. shard-tests.sh seeds each pinned file at one shard's average share (total_tests/total = 561 now), which over-reserves the two pinned shards; the greedy pass then fills the non-pinned shards first. Measured 4-shard @test weights:

1/4 = 281   2/4 = 302   3/4 = 832   4/4 = 831  (cancelled on macOS)

This change

SHARD_TOTAL: 4 → 5 (+ the matrix and the display-name /N, kept in step; test_ci_sharding.bats reads all three and is green at 5). Worst-case non-pinned shard total*(N+2)/N^2: 842 → 629 (measured 633), ~21 min on macOS with margin. New weights:

1/5 = 185   2/5 = 207   3/5 = 633   4/5 = 632   5/5 = 632

Five, not six: the account runs at most five macOS jobs at once (the concurrency header). A sixth macOS shard would queue behind the other five of its own run and inflate the wall clock past what the lighter shard buys — the very "per-shard shorter but overall longer" failure the header cautions about. Five fits the slots exactly.

Not the fix

The scaling property remains and is tracked in #847: pin_seed grows with the suite, and @test count under-values the wait-dominant files (measured on the cancelled shard: test_remote 7.5m / test_remote_sync 5.0m / test_watch 3.0m — none of them the currently pinned pair, which never appeared in the 22-min window). The real re-fit (re-pin by measured seconds-per-test / cap the seed) waits for #1159's per-file timings.

…cOS cap (#1107)

The suite grew ~2.85x (788 -> 2246 @tests) since the partition was tuned, and
shard-tests.sh seeds each pinned file at one shard's average share
(total_tests/total = 561 now). That over-reserves the two pinned shards, so the
whole real load lands on the non-pinned ones: measured 4-shard @test weights were
281/302/832/831, and macOS 4/4 (831 tests) reached the 30-minute cap while still
passing tests -- a slow shard, not a hang (the workflow's own #848/#857 note).

Five shards instead of four drops the worst-case non-pinned shard from
total*(N+2)/N^2 = 842 to 629 (measured 633), ~21 min on macOS with margin. Five,
not six, because the account runs at most five macOS jobs at once (the
concurrency header): a sixth macOS shard would queue behind the other five of
its own run and inflate the wall clock past what a lighter shard buys.

test_ci_sharding.bats reads SHARD_TOTAL and the matrix, so the three edits stay
in step; it is green at 5.

This is a stopgap, not the fix for #1107. The scaling property remains -- pin_seed
grows with the suite, and @test count under-values the wait-dominant files
(test_remote 7.5m / test_remote_sync 5.0m / test_watch 3.0m on macOS, none the
currently pinned pair). #847 carries the real re-fit once #1159's per-file
timings land.
…ecks

test_ci_workflow.bats greps the workflow for the exact `bats (… /N)` job name to
prove the docs-only skip reports the same required contexts as a real run (#798),
and again in the mutation control. Both literals said /4 and did not follow the
SHARD_TOTAL 4 -> 5 change, so the real check failed on every shard while the
mutation control still passed by luck. Point both at /5.

They stay literal for now; deriving the name from SHARD_TOTAL so the next N never
breaks them is left to #847 with the rest of the partition work, to keep this
change to opening the gate.
@fujibee
fujibee merged commit 63a33f7 into integration/terminal-driver-v1 Sep 11, 2026
77 of 79 checks passed
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