Skip to content

Commit f7e02ac

Browse files
committed
ci(test-core): place slice shards by wall and widen Test Core to twelve shards
A split that carries a CLI slice is now placed by modelled wall: slices first, then whole packages onto the slice-free shards while they fit WHOLE_LEG_CAP_SECONDS and keep LOAD_SENSITIVE_APART apart. Twelve shards give the nine slice-free shards room (whole legs 1515-1520s on the 2026-11-23 dataset), so the slice shards run their slice alone. Claude-Session: https://claude.ai/code/session_016WV4cxRDKprCtjpEdtiPFW Co-authored-by: Claude <noreply@anthropic.com>
1 parent e42520c commit f7e02ac

4 files changed

Lines changed: 299 additions & 50 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 38 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,7 @@ jobs:
903903

904904
# Its own self-test, where it runs (check:self-test-wired). Milliseconds.
905905
# A red here fails this job before it publishes a plan, so the matrix
906-
# falls back to all ten shards: a broken planner costs runners, never
906+
# falls back to all twelve shards: a broken planner costs runners, never
907907
# coverage.
908908
- name: Test Core shard planner self-test
909909
run: node scripts/ci/plan-test-core-shards.mjs --self-test
@@ -924,7 +924,8 @@ jobs:
924924
--exclude @objectstack/dogfood --github-output "$GITHUB_OUTPUT"
925925
926926
test:
927-
# Sharded 10-way BY PACKAGE (8-way until #34710, 6-way until #25376): a
927+
# Sharded 12-way BY PACKAGE (10-way until #36646, 8-way until #34710, 6-way
928+
# until #25376): a
928929
# core-touching PR ran the affected suite ~11½ min on one 4-vCPU runner —
929930
# the longest pole in the whole workflow — and at 2 shards the slower shard
930931
# still ran ~10 min, keeping merge-queue builds at ~11 min end-to-end
@@ -967,6 +968,19 @@ jobs:
967968
# packages, at nine six carried ~1954s, at ten the heaviest carries 1769s
968969
# (spec, alone). The partitioner's SHARD_COUNT header carries the figures.
969970
#
971+
# TWELVE since #36646, for the wall, not the cap: a slice shard runs its
972+
# whole packages first and its CLI slice after them, so on a full plan the
973+
# slice shards were the slowest Test Core jobs (whole leg p50 287s, slice
974+
# leg p50 887s, 12 sampled merge_group runs, report 7232799392). The
975+
# partitioner now places a split that carries a slice by modelled wall
976+
# (placeByWall()): slices first, then whole packages onto the slice-free
977+
# shards while they fit WHOLE_LEG_CAP_SECONDS. At ten that puts seven whole
978+
# legs at 1866-1868s, the density #25968 went red at; at twelve the nine
979+
# slice-free shards hold every whole package at <=1520s on the 2026-11-23
980+
# dataset, below the 1696s each carried at ten, and the slice shards carry
981+
# their slices and the reader slice's rider only. Two more runners per full
982+
# plan, ~+3.6 runner-min at the per-shard overhead measured below.
983+
#
970984
# EIGHT before that (#25376; six from #22075 until then): sharding is BY
971985
# PACKAGE, so no shard can finish faster than the heaviest serial task it
972986
# carries. `@objectstack/cli` (2899.02s on the 2026-10-23 dataset) runs as 3
@@ -1037,7 +1051,7 @@ jobs:
10371051
# Branch protection requires the bare "Test Core" context, which a matrix
10381052
# can never publish again — the test-gate job below carries that name
10391053
# (the #3622 lesson; see dogfood-gate).
1040-
name: Test Core (${{ matrix.shard }}/10)
1054+
name: Test Core (${{ matrix.shard }}/12)
10411055
needs: [filter, test-plan, queue-verdict]
10421056
# "Skip only when the filter EXPLICITLY said no core paths changed" — see
10431057
# THE FILTER CONTRACT on the filter job's outputs (#4928). `scripts` is ORed
@@ -1048,7 +1062,7 @@ jobs:
10481062
# The third clause is the plan's (#26084): `[]` is the test-plan job's
10491063
# positive statement that the package set is empty, and only that literal
10501064
# skips. A plan job that died publishes nothing, `'' != '[]'` holds, and the
1051-
# matrix below falls back to all ten shards: half 1 of the contract again.
1065+
# matrix below falls back to all twelve shards: half 1 of the contract again.
10521066
if: ${{ !cancelled() && (needs.filter.outputs.core != 'false' || needs.filter.outputs.crosspkg != 'false') && needs.test-plan.outputs.shards != '[]' }}
10531067
runs-on: ubuntu-latest
10541068
# Backstop only — the stall guard on the test steps is the primary
@@ -1113,7 +1127,7 @@ jobs:
11131127
# payloads of every completed pull_request, merge_group, push and
11141128
# schedule run in it), BOTH guard verdicts -- the window path
11151129
# (p + s + 10m) and the cap-deferred path (p + s + 20m) -- land before the
1116-
# new value on every observation, AND the slowest `Test Core (N/10)` job
1130+
# new value on every observation, AND the slowest `Test Core (N/12)` job
11171131
# wall is at or under 80% of it. Read the pull_request and merge_group
11181132
# runs, not the 4-hourly schedule alone: scheduled runs mostly replay the
11191133
# cache their commit's push run saved. It carries no other expiry — a
@@ -1124,8 +1138,8 @@ jobs:
11241138
contents: read
11251139
# ⭐ ONLY THE SHARDS WITH WORK START (#26084). The list is the test-plan
11261140
# job's: the indices of the bins `partition-test-shards.mjs` fills at
1127-
# SHARD_COUNT (10) for this run's package set. The count stays 10, so a
1128-
# started shard runs exactly the `--shard k/10` slice it ran before, under
1141+
# SHARD_COUNT (12) for this run's package set. The count stays 12, so a
1142+
# started shard runs exactly the `--shard k/12` slice it ran before, under
11291143
# the same name, cache key and attestation; a shard whose bin is empty is
11301144
# simply never created. The literal after `||` is the full roster, read
11311145
# when the plan job published nothing (it died or timed out), and the gate
@@ -1149,7 +1163,7 @@ jobs:
11491163
strategy:
11501164
fail-fast: ${{ github.event_name == 'merge_group' }}
11511165
matrix:
1152-
shard: ${{ fromJSON(needs.test-plan.outputs.shards || '[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]') }}
1166+
shard: ${{ fromJSON(needs.test-plan.outputs.shards || '[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]') }}
11531167

11541168
steps:
11551169
# Depth 1 (the default), then the step below fetches the history this job
@@ -1218,7 +1232,7 @@ jobs:
12181232
# the tail's low end (1063 s), not its top. In `test-ui` neither end
12191233
# fits beside the body inside the 30-minute wall, so its budget only
12201234
# ends the red sooner and names the step. A red `test-plan` falls
1221-
# back to all ten shards, and each fetches for itself.
1235+
# back to all twelve shards, and each fetches for itself.
12221236
# A fetch that stalls is retried after 60 s of silence; one that keeps
12231237
# stalling ends red here, named, instead of eating the wall.
12241238
- name: Fetch this commit's history and the base branch
@@ -1348,7 +1362,7 @@ jobs:
13481362
run: |
13491363
bash scripts/ci/select-shard-packages.sh
13501364
node scripts/partition-test-shards.mjs "$RUNNER_TEMP/turbo-ls.json" \
1351-
--shard ${{ matrix.shard }}/10 --exclude @objectstack/dogfood \
1365+
--shard ${{ matrix.shard }}/12 --exclude @objectstack/dogfood \
13521366
> "$RUNNER_TEMP/shard-packages.txt"
13531367
echo 'Items on this shard (a package name, or a package plus a k/n file-level slice):'
13541368
cat "$RUNNER_TEMP/shard-packages.txt"
@@ -1473,7 +1487,7 @@ jobs:
14731487
# `--if-ran`: an empty shard exits the step above before turbo runs.
14741488
- name: The Turbo remote cache was on for this shard's closure build
14751489
run: |
1476-
node scripts/ci/assert-turbo-remote-cache.mjs --site 'Test Core (${{ matrix.shard }}/10) closure' \
1490+
node scripts/ci/assert-turbo-remote-cache.mjs --site 'Test Core (${{ matrix.shard }}/12) closure' \
14771491
--log .turbo/remote-cache/test-core-closure.json --if-ran \
14781492
--move-summary-to "$RUNNER_TEMP/turbo-remote-cache"
14791493
@@ -1842,7 +1856,7 @@ jobs:
18421856
run: |
18431857
node scripts/ci/report-test-leftovers.mjs report \
18441858
--before "$RUNNER_TEMP/test-leftovers/before.json" \
1845-
--label "Test Core (${{ matrix.shard }}/10)"
1859+
--label "Test Core (${{ matrix.shard }}/12)"
18461860
18471861
# --summarize above costs nothing at runtime and writes
18481862
# `.turbo/runs/<id>.json`: one per-task record with the execution window
@@ -1886,7 +1900,7 @@ jobs:
18861900
continue-on-error: true
18871901
uses: actions/upload-artifact@v7
18881902
with:
1889-
name: test-core-run-summary-${{ matrix.shard }}-of-10
1903+
name: test-core-run-summary-${{ matrix.shard }}-of-12
18901904
path: .turbo/runs/
18911905
if-no-files-found: ignore
18921906
retention-days: ${{ github.event_name == 'schedule' && 4 || 1 }}
@@ -1968,11 +1982,11 @@ jobs:
19681982
shopt -s nullglob
19691983
SUMMARIES=(.turbo/runs/*.json)
19701984
if [ "${#SUMMARIES[@]}" -eq 0 ]; then
1971-
echo "shard-timing-drift: NOT MEASURED -- Test Core (${{ matrix.shard }}/10) wrote no turbo run summary (no packages on this shard)."
1985+
echo "shard-timing-drift: NOT MEASURED -- Test Core (${{ matrix.shard }}/12) wrote no turbo run summary (no packages on this shard)."
19721986
exit 0
19731987
fi
19741988
node scripts/partition-test-shards.mjs --check-drift "${SUMMARIES[@]}" \
1975-
--label "Test Core (${{ matrix.shard }}/10)" --event "$GITHUB_EVENT_NAME"
1989+
--label "Test Core (${{ matrix.shard }}/12)" --event "$GITHUB_EVENT_NAME"
19761990
19771991
# Runs even when the suite failed — that is when it earns its keep. It
19781992
# answers TWO questions about a red suite, and needs both to be able to
@@ -2102,7 +2116,7 @@ jobs:
21022116
node scripts/report-test-timings.mjs --capture \
21032117
--log "$RUNNER_TEMP/test-core.log" \
21042118
--summaries .turbo/runs \
2105-
--shard "${{ matrix.shard }}/10" \
2119+
--shard "${{ matrix.shard }}/12" \
21062120
--out "$RUNNER_TEMP/test-timings/shard-${{ matrix.shard }}.json"
21072121
21082122
# Retention matches the run-summary upload above (4 days on `schedule`,
@@ -2115,7 +2129,7 @@ jobs:
21152129
continue-on-error: true
21162130
uses: actions/upload-artifact@v7
21172131
with:
2118-
name: test-core-timings-${{ matrix.shard }}-of-10
2132+
name: test-core-timings-${{ matrix.shard }}-of-12
21192133
path: ${{ runner.temp }}/test-timings/
21202134
if-no-files-found: ignore
21212135
retention-days: ${{ github.event_name == 'schedule' && 4 || 1 }}
@@ -2158,10 +2172,10 @@ jobs:
21582172
OS_SEED_ONLY: ${{ needs.queue-verdict.outputs.covered == 'true' }}
21592173
run: |
21602174
if [ "$OS_SEED_ONLY" = 'true' ]; then
2161-
node scripts/ci/prune-turbo-cache.mjs --site 'Test Core (${{ matrix.shard }}/10) seed-only' \
2175+
node scripts/ci/prune-turbo-cache.mjs --site 'Test Core (${{ matrix.shard }}/12) seed-only' \
21622176
--cache .turbo/cache --run-summaries "$RUNNER_TEMP/turbo-remote-cache"
21632177
else
2164-
node scripts/ci/prune-turbo-cache.mjs --site 'Test Core (${{ matrix.shard }}/10)' \
2178+
node scripts/ci/prune-turbo-cache.mjs --site 'Test Core (${{ matrix.shard }}/12)' \
21652179
--cache .turbo/cache --run-summaries .turbo/runs \
21662180
--extra-summaries "$RUNNER_TEMP/turbo-remote-cache"
21672181
fi
@@ -2194,14 +2208,14 @@ jobs:
21942208
if: needs.queue-verdict.outputs.covered != 'true'
21952209
run: |
21962210
node scripts/check-shard-attestation.mjs --emit \
2197-
--job test --shard ${{ matrix.shard }} --total 10 \
2211+
--job test --shard ${{ matrix.shard }} --total 12 \
21982212
--out "$RUNNER_TEMP/shard-attestation"
21992213
22002214
- name: Publish this shard's attestation
22012215
if: needs.queue-verdict.outputs.covered != 'true'
22022216
uses: actions/upload-artifact@v7
22032217
with:
2204-
name: shard-attest-test-${{ matrix.shard }}-of-10
2218+
name: shard-attest-test-${{ matrix.shard }}-of-12
22052219
path: ${{ runner.temp }}/shard-attestation/
22062220
if-no-files-found: error
22072221
retention-days: 1
@@ -2317,8 +2331,8 @@ jobs:
23172331
OS_DOWNLOAD_OUTCOME: ${{ steps.attestations.outcome }}
23182332
# The planned roster, spelled exactly as the `test` job's matrix
23192333
# spells it, fallback included: a plan job that died leaves the
2320-
# matrix on 1..10, and the gate then counts 1..10 too (#26084).
2321-
OS_TEST_PLAN: ${{ needs.test-plan.outputs.shards || '[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]' }}
2334+
# matrix on 1..12, and the gate then counts 1..12 too (#26084).
2335+
OS_TEST_PLAN: ${{ needs.test-plan.outputs.shards || '[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]' }}
23222336
OS_TEST_PLAN_RESULT: ${{ needs.test-plan.result }}
23232337
# Read ONLY on the partially-attested-cancelled path above, never
23242338
# otherwise; without it that path fails closed (red, naming the
@@ -2330,7 +2344,7 @@ jobs:
23302344
--dir "$OS_ATTEST_DIR" \
23312345
--filter-result "$OS_FILTER_RESULT" \
23322346
--download-outcome "$OS_DOWNLOAD_OUTCOME" \
2333-
--leg "test/10:$OS_TEST_RESULT" \
2347+
--leg "test/12:$OS_TEST_RESULT" \
23342348
--planned "test=$OS_TEST_PLAN" \
23352349
--plan-result "$OS_TEST_PLAN_RESULT"
23362350

‎scripts/ci/plan-test-core-shards.mjs‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env node
22
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
33
//
4-
// plan-test-core-shards -- which `Test Core (N/10)` shards this run starts,
4+
// plan-test-core-shards -- which `Test Core (N/12)` shards this run starts,
55
// decided ONCE, before any shard runner exists (#26084).
66
//
77
// node scripts/ci/plan-test-core-shards.mjs <turbo-ls.json> --exclude <pkg>... --github-output <file>
@@ -33,10 +33,10 @@
3333
// `fromJSON`. `[]` means nothing to test: the job's `if:` skips it.
3434
// digest a sha256 of the whole plan (every bin's items, in order).
3535
//
36-
// The shard count stays SHARD_COUNT (10 since #34710, read from ci.yml): a
37-
// planned shard runs `--shard k/10` exactly as an unplanned run would, keeps
38-
// its name `Test Core (k/10)`, its cache key and its attestation
39-
// `test-k-of-10`. Only the shards whose bin is empty are not
36+
// The shard count stays SHARD_COUNT (12 since #36646, read from ci.yml): a
37+
// planned shard runs `--shard k/12` exactly as an unplanned run would, keeps
38+
// its name `Test Core (k/12)`, its cache key and its attestation
39+
// `test-k-of-12`. Only the shards whose bin is empty are not
4040
// started, so no package moves to another shard and no shard carries more
4141
// than it did. This is deliberately NOT a re-sizing to fewer, fuller bins:
4242
// every package diff on main reaches @objectstack/cli, spec, core, objectql

0 commit comments

Comments
 (0)