Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 38 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,7 @@ jobs:

# Its own self-test, where it runs (check:self-test-wired). Milliseconds.
# A red here fails this job before it publishes a plan, so the matrix
# falls back to all ten shards: a broken planner costs runners, never
# falls back to all twelve shards: a broken planner costs runners, never
# coverage.
- name: Test Core shard planner self-test
run: node scripts/ci/plan-test-core-shards.mjs --self-test
Expand All @@ -924,7 +924,8 @@ jobs:
--exclude @objectstack/dogfood --github-output "$GITHUB_OUTPUT"

test:
# Sharded 10-way BY PACKAGE (8-way until #34710, 6-way until #25376): a
# Sharded 12-way BY PACKAGE (10-way until #36646, 8-way until #34710, 6-way
# until #25376): a
# core-touching PR ran the affected suite ~11½ min on one 4-vCPU runner —
# the longest pole in the whole workflow — and at 2 shards the slower shard
# still ran ~10 min, keeping merge-queue builds at ~11 min end-to-end
Expand Down Expand Up @@ -967,6 +968,19 @@ jobs:
# packages, at nine six carried ~1954s, at ten the heaviest carries 1769s
# (spec, alone). The partitioner's SHARD_COUNT header carries the figures.
#
# TWELVE since #36646, for the wall, not the cap: a slice shard runs its
# whole packages first and its CLI slice after them, so on a full plan the
# slice shards were the slowest Test Core jobs (whole leg p50 287s, slice
# leg p50 887s, 12 sampled merge_group runs, report 7232799392). The
# partitioner now places a split that carries a slice by modelled wall
# (placeByWall()): slices first, then whole packages onto the slice-free
# shards while they fit WHOLE_LEG_CAP_SECONDS. At ten that puts seven whole
# legs at 1866-1868s, the density #25968 went red at; at twelve the nine
# slice-free shards hold every whole package at <=1520s on the 2026-11-23
# dataset, below the 1696s each carried at ten, and the slice shards carry
# their slices and the reader slice's rider only. Two more runners per full
# plan, ~+3.6 runner-min at the per-shard overhead measured below.
#
# EIGHT before that (#25376; six from #22075 until then): sharding is BY
# PACKAGE, so no shard can finish faster than the heaviest serial task it
# carries. `@objectstack/cli` (2899.02s on the 2026-10-23 dataset) runs as 3
Expand Down Expand Up @@ -1037,7 +1051,7 @@ jobs:
# Branch protection requires the bare "Test Core" context, which a matrix
# can never publish again — the test-gate job below carries that name
# (the #3622 lesson; see dogfood-gate).
name: Test Core (${{ matrix.shard }}/10)
name: Test Core (${{ matrix.shard }}/12)
needs: [filter, test-plan, queue-verdict]
# "Skip only when the filter EXPLICITLY said no core paths changed" — see
# THE FILTER CONTRACT on the filter job's outputs (#4928). `scripts` is ORed
Expand All @@ -1048,7 +1062,7 @@ jobs:
# The third clause is the plan's (#26084): `[]` is the test-plan job's
# positive statement that the package set is empty, and only that literal
# skips. A plan job that died publishes nothing, `'' != '[]'` holds, and the
# matrix below falls back to all ten shards: half 1 of the contract again.
# matrix below falls back to all twelve shards: half 1 of the contract again.
if: ${{ !cancelled() && (needs.filter.outputs.core != 'false' || needs.filter.outputs.crosspkg != 'false') && needs.test-plan.outputs.shards != '[]' }}
runs-on: ubuntu-latest
# Backstop only — the stall guard on the test steps is the primary
Expand Down Expand Up @@ -1113,7 +1127,7 @@ jobs:
# payloads of every completed pull_request, merge_group, push and
# schedule run in it), BOTH guard verdicts -- the window path
# (p + s + 10m) and the cap-deferred path (p + s + 20m) -- land before the
# new value on every observation, AND the slowest `Test Core (N/10)` job
# new value on every observation, AND the slowest `Test Core (N/12)` job
# wall is at or under 80% of it. Read the pull_request and merge_group
# runs, not the 4-hourly schedule alone: scheduled runs mostly replay the
# cache their commit's push run saved. It carries no other expiry — a
Expand All @@ -1124,8 +1138,8 @@ jobs:
contents: read
# ⭐ ONLY THE SHARDS WITH WORK START (#26084). The list is the test-plan
# job's: the indices of the bins `partition-test-shards.mjs` fills at
# SHARD_COUNT (10) for this run's package set. The count stays 10, so a
# started shard runs exactly the `--shard k/10` slice it ran before, under
# SHARD_COUNT (12) for this run's package set. The count stays 12, so a
# started shard runs exactly the `--shard k/12` slice it ran before, under
# the same name, cache key and attestation; a shard whose bin is empty is
# simply never created. The literal after `||` is the full roster, read
# when the plan job published nothing (it died or timed out), and the gate
Expand All @@ -1149,7 +1163,7 @@ jobs:
strategy:
fail-fast: ${{ github.event_name == 'merge_group' }}
matrix:
shard: ${{ fromJSON(needs.test-plan.outputs.shards || '[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]') }}
shard: ${{ fromJSON(needs.test-plan.outputs.shards || '[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]') }}

steps:
# Depth 1 (the default), then the step below fetches the history this job
Expand Down Expand Up @@ -1218,7 +1232,7 @@ jobs:
# the tail's low end (1063 s), not its top. In `test-ui` neither end
# fits beside the body inside the 30-minute wall, so its budget only
# ends the red sooner and names the step. A red `test-plan` falls
# back to all ten shards, and each fetches for itself.
# back to all twelve shards, and each fetches for itself.
# A fetch that stalls is retried after 60 s of silence; one that keeps
# stalling ends red here, named, instead of eating the wall.
- name: Fetch this commit's history and the base branch
Expand Down Expand Up @@ -1348,7 +1362,7 @@ jobs:
run: |
bash scripts/ci/select-shard-packages.sh
node scripts/partition-test-shards.mjs "$RUNNER_TEMP/turbo-ls.json" \
--shard ${{ matrix.shard }}/10 --exclude @objectstack/dogfood \
--shard ${{ matrix.shard }}/12 --exclude @objectstack/dogfood \
> "$RUNNER_TEMP/shard-packages.txt"
echo 'Items on this shard (a package name, or a package plus a k/n file-level slice):'
cat "$RUNNER_TEMP/shard-packages.txt"
Expand Down Expand Up @@ -1473,7 +1487,7 @@ jobs:
# `--if-ran`: an empty shard exits the step above before turbo runs.
- name: The Turbo remote cache was on for this shard's closure build
run: |
node scripts/ci/assert-turbo-remote-cache.mjs --site 'Test Core (${{ matrix.shard }}/10) closure' \
node scripts/ci/assert-turbo-remote-cache.mjs --site 'Test Core (${{ matrix.shard }}/12) closure' \
--log .turbo/remote-cache/test-core-closure.json --if-ran \
--move-summary-to "$RUNNER_TEMP/turbo-remote-cache"

Expand Down Expand Up @@ -1842,7 +1856,7 @@ jobs:
run: |
node scripts/ci/report-test-leftovers.mjs report \
--before "$RUNNER_TEMP/test-leftovers/before.json" \
--label "Test Core (${{ matrix.shard }}/10)"
--label "Test Core (${{ matrix.shard }}/12)"

# --summarize above costs nothing at runtime and writes
# `.turbo/runs/<id>.json`: one per-task record with the execution window
Expand Down Expand Up @@ -1886,7 +1900,7 @@ jobs:
continue-on-error: true
uses: actions/upload-artifact@v7
with:
name: test-core-run-summary-${{ matrix.shard }}-of-10
name: test-core-run-summary-${{ matrix.shard }}-of-12
path: .turbo/runs/
if-no-files-found: ignore
retention-days: ${{ github.event_name == 'schedule' && 4 || 1 }}
Expand Down Expand Up @@ -1968,11 +1982,11 @@ jobs:
shopt -s nullglob
SUMMARIES=(.turbo/runs/*.json)
if [ "${#SUMMARIES[@]}" -eq 0 ]; then
echo "shard-timing-drift: NOT MEASURED -- Test Core (${{ matrix.shard }}/10) wrote no turbo run summary (no packages on this shard)."
echo "shard-timing-drift: NOT MEASURED -- Test Core (${{ matrix.shard }}/12) wrote no turbo run summary (no packages on this shard)."
exit 0
fi
node scripts/partition-test-shards.mjs --check-drift "${SUMMARIES[@]}" \
--label "Test Core (${{ matrix.shard }}/10)" --event "$GITHUB_EVENT_NAME"
--label "Test Core (${{ matrix.shard }}/12)" --event "$GITHUB_EVENT_NAME"

# Runs even when the suite failed — that is when it earns its keep. It
# answers TWO questions about a red suite, and needs both to be able to
Expand Down Expand Up @@ -2102,7 +2116,7 @@ jobs:
node scripts/report-test-timings.mjs --capture \
--log "$RUNNER_TEMP/test-core.log" \
--summaries .turbo/runs \
--shard "${{ matrix.shard }}/10" \
--shard "${{ matrix.shard }}/12" \
--out "$RUNNER_TEMP/test-timings/shard-${{ matrix.shard }}.json"

# Retention matches the run-summary upload above (4 days on `schedule`,
Expand All @@ -2115,7 +2129,7 @@ jobs:
continue-on-error: true
uses: actions/upload-artifact@v7
with:
name: test-core-timings-${{ matrix.shard }}-of-10
name: test-core-timings-${{ matrix.shard }}-of-12
path: ${{ runner.temp }}/test-timings/
if-no-files-found: ignore
retention-days: ${{ github.event_name == 'schedule' && 4 || 1 }}
Expand Down Expand Up @@ -2158,10 +2172,10 @@ jobs:
OS_SEED_ONLY: ${{ needs.queue-verdict.outputs.covered == 'true' }}
run: |
if [ "$OS_SEED_ONLY" = 'true' ]; then
node scripts/ci/prune-turbo-cache.mjs --site 'Test Core (${{ matrix.shard }}/10) seed-only' \
node scripts/ci/prune-turbo-cache.mjs --site 'Test Core (${{ matrix.shard }}/12) seed-only' \
--cache .turbo/cache --run-summaries "$RUNNER_TEMP/turbo-remote-cache"
else
node scripts/ci/prune-turbo-cache.mjs --site 'Test Core (${{ matrix.shard }}/10)' \
node scripts/ci/prune-turbo-cache.mjs --site 'Test Core (${{ matrix.shard }}/12)' \
--cache .turbo/cache --run-summaries .turbo/runs \
--extra-summaries "$RUNNER_TEMP/turbo-remote-cache"
fi
Expand Down Expand Up @@ -2194,14 +2208,14 @@ jobs:
if: needs.queue-verdict.outputs.covered != 'true'
run: |
node scripts/check-shard-attestation.mjs --emit \
--job test --shard ${{ matrix.shard }} --total 10 \
--job test --shard ${{ matrix.shard }} --total 12 \
--out "$RUNNER_TEMP/shard-attestation"

- name: Publish this shard's attestation
if: needs.queue-verdict.outputs.covered != 'true'
uses: actions/upload-artifact@v7
with:
name: shard-attest-test-${{ matrix.shard }}-of-10
name: shard-attest-test-${{ matrix.shard }}-of-12
path: ${{ runner.temp }}/shard-attestation/
if-no-files-found: error
retention-days: 1
Expand Down Expand Up @@ -2317,8 +2331,8 @@ jobs:
OS_DOWNLOAD_OUTCOME: ${{ steps.attestations.outcome }}
# The planned roster, spelled exactly as the `test` job's matrix
# spells it, fallback included: a plan job that died leaves the
# matrix on 1..10, and the gate then counts 1..10 too (#26084).
OS_TEST_PLAN: ${{ needs.test-plan.outputs.shards || '[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]' }}
# matrix on 1..12, and the gate then counts 1..12 too (#26084).
OS_TEST_PLAN: ${{ needs.test-plan.outputs.shards || '[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]' }}
OS_TEST_PLAN_RESULT: ${{ needs.test-plan.result }}
# Read ONLY on the partially-attested-cancelled path above, never
# otherwise; without it that path fails closed (red, naming the
Expand All @@ -2330,7 +2344,7 @@ jobs:
--dir "$OS_ATTEST_DIR" \
--filter-result "$OS_FILTER_RESULT" \
--download-outcome "$OS_DOWNLOAD_OUTCOME" \
--leg "test/10:$OS_TEST_RESULT" \
--leg "test/12:$OS_TEST_RESULT" \
--planned "test=$OS_TEST_PLAN" \
--plan-result "$OS_TEST_PLAN_RESULT"

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