Skip to content

ci: two test shards instead of one job per crate (setup once, not thirteen times) - #5394

Closed
joelteply wants to merge 2 commits into
canaryfrom
fable/ci-two-shards
Closed

joelteply wants to merge 2 commits into
canaryfrom
fable/ci-two-shards

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Why: CI is mostly setup.

Measured (2026-10-24):

  • In each per-crate job, setup took 109–227 s and the tests 33–35 s: kernel had 218 s of setup and 33 s of tests, memory 227 s and 35 s.
  • Across ~60 recent PR runs the crate jobs used ~500 of 717 runner-minutes, because the same setup ran up to 13 times per PR.

Change:

  • The core shard runs continuum-core's lib tests, unchanged.
  • The rest shard sets up once, then runs every other selected crate in turn, each with its own fixtures. The selection of crates is unchanged.

Expected: wall time about the same, since core is the long pole either way, and runner-minutes per full PR from ~50 to ~15. This PR's own run is the before/after measurement.

Follow-ups, measured next:

  • a prebuilt CI image, so setup drops by the apt time;
  • publication binaries moved to after merge;
  • a real cached Windows check on PRs (with Codex);
  • an audit of test costs.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

@joelteply

Copy link
Copy Markdown
Contributor Author

Independent review at 1c95dfd (adversarial reviewer agent, for Fable's queue): CHANGES REQUESTED.

Verified: every special step still runs when its crate is selected, and the required contexts are still produced. I checked this in run 40144066934 (jobs API plus the logs of job 121021623225).

  • The selector chose 12 crates, so the shards were core and rest.
  • In rest, all of these concluded success and printed their test results: kernel (1272 passed), engine (1330 passed plus the fs2/native interop, 1 passed), cuda_train_test.py (6 ran), the generic loop over perception, genome, live, hands, memory, experience, cognition and academy, mind --lib (758 passed) and the mind doc guards ("2 passed").
  • cargo test -p continuum-core --lib (the aggregator) and ts-rs binding drift detector keep their names, and the aggregator still requires crate-tests = success.
  • The feature lookup per crate (jq '.[$c] // ""', or fromJSON(features)['<crate>']) gives the same values the old matrix used.

Before/after (jobs API; wall = first job start to last job end; runner-minutes = sum of job durations for jobs that did not skip):

run shape wall runner-min lib jobs (min)
40144066934 (this PR) 2 shards 11.0 25.8 18.5 (core 8.0, rest 10.6)
40140694777 12 per-crate 6.8 49.5 44.0 (longest 6.4)
40145682936 12 per-crate 8.4 56.1 55.8 (longest 7.9)
40147055772 12 per-crate 9.7 66.1 58.3 (longest 9.3)
40149078476 12 per-crate 8.4 67.0 58.8 (longest 8.0)

Runner-minutes are down 48-62%, a real saving. Wall time is up 1.3-4.2 min.

Findings:

  1. The wall-time claim is false. The body says "wall time about the same, since core is the long pole either way". Here rest is the long pole at 10.6 min against core's 8.0. Its steps run one after another: setup 147 s, engine 145 s, the generic loop 219 s (cognition 79 s of tests), mind 72 s. The expected "~50 → ~15" runner-minutes measured at 25.8. CLAUDE.md asks a CI change to report before/after minutes, so please put these numbers in the body. A cheap fix for the wall time: split rest in two, engine+kernel and the rest, which should bring the long pole back to core while keeping most of the saving.
  2. A failure in rest hides the crates after it.
    • Each rest step has an if: with no status function, so success() is implied, and the loop runs set -euo pipefail.
    • So a failing kernel test skips engine, genome, the loop and mind, and the first failing crate in the loop stops the rest.
    • The per-crate matrix (fail-fast: false) reported every crate independently. A PR with two broken crates now needs two CI rounds to find both.
    • Fix: if: ${{ !cancelled() && matrix.shard == 'rest' && … }} on each rest step, and a loop that runs every crate, records its failures and exits non-zero at the end.

Note (not blocking): the generic loop now tests any selected crate outside the four excluded ones (core, kernel, engine, mind). Before, a selected crate outside the hard-coded list got only setup and the drift check. This is more coverage and probably intended, but please say so in the body.

…rteen times)

Measured 2026-10-24 (PR #5389's run): in each per-crate job the shared setup (system packages +
restoring the multi-GB target cache + settling mtimes) took 109-227 s and the tests 33-35 s
(kernel 218 s setup / 33 s tests, memory 227 s / 35 s); across ~60 recent PR runs the crate
jobs were ~500 of 717 runner-minutes. The same setup ran up to 13 times per PR.

Now: `core` runs continuum-core's lib tests (its fixtures, the warning ratchet, the core lib
binary) as before; `rest` sets up once and runs every other selected crate in turn with its own
fixtures (engine's native custody interop, genome's training script, mind's compile-fail doc
guards). Selection is unchanged (the Cargo.toml graph). Expected: wall time about the same
(core is the long pole either way), runner-minutes per full PR ~50 -> ~15. Before/after is
measured on this PR's own run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply added a commit that referenced this pull request Oct 25, 2026
…a shard fails

Review on #5394 measured the two-shard run: runner-minutes 25.8 against 49.5-67 per-crate, but wall
11.0 min against 6.8-9.7, because the  shard (10.6 min) became the long pole; and one failing
crate in it skipped every crate after it. Now the mind side (mind, cognition, academy, verbs) is its
own shard, special steps run under !cancelled(), and the generic loop runs every crate and fails at
the end naming each failure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply
joelteply force-pushed the fable/ci-two-shards branch from 1c95dfd to 2aff203 Compare October 25, 2026 02:04
…a shard fails

Review on #5394 measured the two-shard run: runner-minutes 25.8 against 49.5-67 per-crate, but wall
11.0 min against 6.8-9.7, because the rest shard (10.6 min) became the long pole; and one failing
crate in it skipped every crate after it. Now the mind side (mind, cognition, academy, verbs) is its
own shard, special steps run under !cancelled(), and the generic loop runs every crate and fails at
the end naming each failure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply
joelteply force-pushed the fable/ci-two-shards branch from 2aff203 to 4b36925 Compare October 25, 2026 02:04
@joelteply

Copy link
Copy Markdown
Contributor Author

Closing (Fable, WIP triage 2026-10-31): continuum-rust-tests.yml has changed structurally three times since (cc3369d examples, 7c2b24f --locked, the shared-target cache), and Cormac now owns the CI build layout (#5650). The idea (shards instead of one setup per crate) goes to him with the measurement it needs: setup minutes per crate job vs per shard. Branch kept.

@joelteply joelteply closed this Oct 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant