Skip to content

ci(tests): seed pinned bats files by measured cost, not @test count (#847) - #1175

Merged
fujibee merged 1 commit into
mainfrom
agdev-cc3-847-pin-seed
Sep 13, 2026
Merged

ci(tests): seed pinned bats files by measured cost, not @test count (#847)#1175
fujibee merged 1 commit into
mainfrom
agdev-cc3-847-pin-seed

Conversation

@fujibee

@fujibee fujibee commented Sep 13, 2026

Copy link
Copy Markdown
Owner

What

Re-fit the PINNED_APART seed in .github/scripts/shard-tests.sh so a pinned
heavy file is seeded into its shard by its measured cost, not by its
@test count.

Why

The pinned-apart files (#847/#848) wait far more than they compute, so their
@test count (refusal 9, liveness 31) badly understates their real cost --
that is the whole reason they are pinned. Seeding the pin at that count left
its shard looking almost empty, and the greedy LPT pass piled an average
count-share of other files on top of an already-679s file. On the first green
run to record per-file timings (#1159), that overfilled shard ran 1475s
while the others ran 636-737s.

Fix

Seed each pin at what its wall time is worth in average tests:
round(measured macOS wall / whole-suite avg s/test).

Measured against GitHub Actions run 34664794167 (#1159, tests.yml bats job,
macos-latest, 5 shards): whole-suite macOS wall 4212s over 1749 @tests =>
avg 2.408 s/test. So refusal 679s -> 282, liveness 293s -> 122.

Simulating the partition against the measured per-file seconds (the simulator
reproduces the observed 1475s under the old seed, so it is trustworthy) brings
the worst shard 1475s -> 987s.

The seed is tied to each file's OWN measured cost, not to a count the suite
outgrows, so it does not drift as the suite grows -- which is exactly what
#1107 was: a partition sized against a count baseline left behind as the suite
roughly tripled. The header now records what the values were measured against,
and that the numerator (per-file wall) and divisor (whole-suite avg) must be
refreshed together off one green run.

Safety

Placement is unchanged (slot % total), so the pins still land in distinct
shards. tests/test_ci_sharding.bats stays green (11/11 locally), including
the #847/#848 pin-separation and positive-control tests. CI-only change.

…847)

The pinned-apart heavy files (#847/#848) were seeded into their shards at
their @test count (file_weight): refusal 9, liveness 31. That count is
exactly the metric these files defeat -- both wait far more than they
compute -- so a 9-unit seed left refusal's shard looking almost empty and
the greedy LPT pass piled an average count-share of other files on top of an
already-679s file. Measured on the first green run to record per-file
timings (#1159), that overfilled shard ran 1475s while the others ran
636-737s.

Seed each pinned file instead at what its measured wall time is worth in
average tests: round(measured macOS wall / whole-suite avg s/test). Off run
34664794167 (4212s over 1749 @tests => 2.408 s/test) that is refusal 282,
liveness 122. Simulating the partition against the measured per-file seconds
(the simulator reproduces the observed 1475s under the old seed, so it is
trustworthy) brings the worst shard from 1475s to 987s.

The seed is tied to each file's OWN measured cost rather than to a count the
suite outgrows, so it does not drift as the suite grows -- which is what
#1107 actually was, a partition sized against a count baseline left behind
as the suite roughly tripled. The header records what the values were
measured against and that numerator and divisor must be refreshed together.

Placement is unchanged (slot % total), so the pins still land in distinct
shards; tests/test_ci_sharding.bats stays green (11/11).
@fujibee
fujibee merged commit a4fc81f into main Sep 13, 2026
24 checks passed
@fujibee
fujibee deleted the agdev-cc3-847-pin-seed branch September 13, 2026 04:32
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