Repository navigation
ci: split lint and serial test shards finer to cut CI wall time - #7
Merged
Merged
Conversation
…rallel lanes 4-wide The serial lane's longest shard carried 30 minutes of one-runner work and was cancelled at its cap. Slice the independent test_* calls of ten long suites across twelve shards, partition lint eight ways, and run the proven-isolated parallel lanes at their proven --jobs 4. No test, check, or threshold is removed or loosened.
… 8 lint and 12 serial shards
…rced test slice gate
…un.sh:907 (`portable_serial_lane_weight()`) was dead code — its only call site had been replaced by `portable_serial_assignments | awk ...` earlier in the same diff, and ShellCheck's SC2329 ("function is never invoked") correctly flags it, which fails the lint step by default severity. Confirmed by reproducing locally: `FM_LINT_JOBS=1 bin/fm-lint.sh --partition 4of8` reported `bin/fm-test-run.sh ... reason=findings rc=1` with the SC2329 hit before the fix, and exits clean (rc=0, no SC2329) after deleting the unused function. Grepped the whole tree to confirm nothing else calls it, so removal (not suppression) is correct per the removal-first rule. This was the only genuine lint finding in the diff; a second PR-noted dead-code item (an unreachable `uniq -d` duplicate check inside `run_coverage_guard`, PR body line ~130) is real but belongs to the separate "Test coverage guard" job, which is not among the failing checks, is not flagged by any tool, and is out of scope for this round's two selected findings — left untouched. For "Behavior portable serial 7" I could not confirm a code-caused defect. I verified the new 12-shard/slice mechanism directly: `bin/fm-test-run.sh --check-coverage` passes cleanly (exact-once coverage, no dup/missing units across all 12 shards), the full `tests/fm-test-run.test.sh` self-test suite passes every case about the new slicing/packing logic ("slice gate runs every call exactly once...", "portable serial shards are a deterministic disjoint cover...", etc.), and a direct manual run of slice 1of8 of the longest split script (tests/fm-watch-triage.test.sh) dispatched exactly 18 of its 141 top-level test_* calls (the expected ~1/8), confirming the slice gate works correctly. Running the actual portable-serial-7of12 lane locally produced only 4 script failures, and each traces unambiguously to this sandbox's missing tooling rather than to the change: no tmux binary (blocks the afk/tmux-dependent fm-supervision-host assertions), no tasks-axi binary and a blocked npm registry (`fail "tasks-axi is required for ..."` in fm-bearings-snapshot and fm-teardown-sandbox), and blocked outbound network (curl 403 fetching a pinned GitHub Action verifier in fm-no-mistakes-required, a pre-existing test untouched by this PR). I could not fetch the actual GitHub Actions job log for shard 7 either — the Actions log-blob endpoint returned 403/"approval required" in this sandbox, matching the task's own "log retrieval incomplete" note. Per the task rules, since every concrete signal I could obtain points at sandbox-only tooling/network gaps rather than the PR's sharding/slicing code (which I verified behaves correctly), I did not invent a speculative fix for this check
…hot.test.sh that broke "Behavior portable serial 7". Rule that was broken: each test must start from a clean remote-ledger fixture, whatever tests ran before it. Cause: call #5 (test_remote_ledgers_share_one_concurrent_budget_and_fall_back_to_cache) leaves $TMP_ROOT/remote-ledger-home-1/state/slow-ledger-read behind, and only call #6 removes it. Slice 1of2 runs #5 but skips #6, so in call #25 (test_landed_preserves_kindless_v1_summary_reports) the fake ssh sleeps 30s against the 15s budget and collection times out. Fix: one line in make_remote_ledger_fleet (line 258), the single place every test builds these homes. After mkdir -p "$remote_home/state" it runs rm -f on slow-ledger-read, unbounded-ledger-read and home-summary.json; write_remote_home_summary then rewrites the summary. All other uses of these marker files are per-test create/remove pairs. The 15s budget and all assertions are unchanged. Verification: (1) a copy of the script calling only #5 then #25 (slice 1of2 order) fails without the line ("structured home ledger collection timed out and no valid cached copy is available") and passes with it; the copy and the leftover untracked tests/_verify-fix.test.sh were deleted. (2) bin/fm-lint.sh exits 0 (ShellCheck 0.11.0, actionlint 1.7.12). A direct shellcheck run shows one SC2034 at line 271 that predates this fix and is not flagged by the project lint. (3) bin/fm-test-run.sh --lane portable-serial-7of12 still exits 1 locally with 4 failures, each from sandbox gaps (no tmux, no tasks-axi, curl 403 fetching the pinned action verifier). The remote-ledger tests in it pass, but the bearings script stops at the tasks-axi requirement before call #25, so only check (1) exercises #25. Nothing was committed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Cut the wall time of a typical PR on the ICBreakerLA/firstmate fork (push to all checks green) toward 5 minutes, from 15-31 minutes today, without weakening, skipping, deleting or waiving any check or test: finer serial sharding (12 shards, long independent suites split by test call), 8 lint partitions, parallel lanes at their proven --jobs 4
What Changed
bin/fm-lint.sh: generalized--partitionfrom a fixed1of2/2of2toKofN(N from 2 to 8) with N-way weighted bin packing, and.github/workflows/ci.ymlnow runs 8 lint partitions instead of 2.bin/fm-test-run.sh: raisedPORTABLE_SERIAL_SHARDSfrom 9 to 12, addedportable_serial_split_hints/--list-split-hintsto split 10 long, independent serial suites into slices that run via the newtests/fm-test-slice-gate.sh(loaded throughBASH_ENV, dispatching every n-th top-leveltest_*call), and extendedrun_coverage_guardto require every slice of every split script to run exactly once (failing a slice that ran no calls)..github/workflows/ci.ymlnow passes--jobs 4to the two portable-parallel lanes;CONTRIBUTING.mdanddocs/fm-test-portable-shards.mdare updated to list the new required check contexts (Lint 1-Lint 8,Behavior portable serial 1-12) and document the slice-splitting mechanism and job layout.🤖 Generated with Claude Code
Risk Assessment
✅ Low: The change is a well-bounded CI/tooling change (finer serial sharding via a DEBUG-trap based call-slicer, 8 lint partitions, --jobs 4 on already-proven-isolated parallel lanes) with generalized, backward-compatible packing math, a coverage guard extended correctly to the new slice unit, and new tests that exercise real execution paths rather than source-text matching; the only findings are two pieces of dead/redundant code left over from the refactor.
Testing
Directly exercised bin/fm-lint.sh and bin/fm-test-run.sh as real CLI tools. The new 8-way lint partitioning is complete/disjoint over 471 canonical files with zero duplicates, and every malformed --partition value is correctly refused. bin/fm-test-run.sh now lists 12 portable-serial-of12 lanes, --list-split-hints reports the 10 scripts slated for slicing matching the diff, and --check-coverage (which validates exact-once slice/script coverage across all 12 shards under budget) passed cleanly. Most decisively, I ran all 8 slices of the real, longest suite in the repo (tests/fm-watch-triage.test.sh, deliberately split 8 ways because it is the long pole) end-to-end through the actual slice gate and confirmed its 141 top-level test_ calls each ran in exactly one slice — no duplicates, no omissions. The pre-existing tests/fm-test-run.test.sh contract suite ran 39 of its tests with no failures (including the new slice-gate and --jobs-scheduler tests) before hitting one unrelated pre-existing test that requires a
rubybinary this sandbox doesn't have; that test is not part of this diff and is about Herdr CI job step timeouts, not sharding. tests/fm-lint.test.sh similarly could not run its real-ShellCheck-execution assertions because shellcheck/actionlint are absent here with no network access to install them via the repo's own pinned installer scripts. Both gaps are sandbox tool-availability limitations, not product defects, and neither touches the partitioning/sharding logic this change actually alters, which was proven correct by direct, live execution above.Evidence: 8-way lint partition union check (471 files, 0 dup, match)
Evidence: Invalid --partition rejections
Evidence: 12 portable-serial lanes + coverage guard pass
Evidence: --list-split-hints output
Evidence: All 8 live slices of the real fm-watch-triage.test.sh suite: exactly-once coverage of 141 test_* calls
Evidence: fm-test-run.test.sh live run, 39 passing checks before an unrelated ruby-gated test
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
bin/fm-test-run.sh:906-portable_serial_lane_weight()is now dead code: its only call site (previously inrun_coverage_guard) was replaced byportable_serial_assignments | awk ...in this same diff, and no other caller remains (verified by grep across bin/ and tests/). Safe to delete since nothing references it.bin/fm-test-run.sh:1178- Theuniq -d/serial_shard_dupsduplicate check that runs after the newcmp -s "$tmp/serial_units_raw" "$tmp/serial_units_expected"check is now unreachable in practice: the preceding cmp already fails on any multiset mismatch between actual and expected per-slice units (a duplicate unit paired with sorted-line comparison against the unique expected set cannot pass cmp while also containing a dup, since dup+missing would shift content at the first differing sorted position). The block can be removed as redundant.CI=true bin/fm-lint.sh --partition {1..8}of8 --list-files union-checked against CI=true bin/fm-lint.sh --list-filesbin/fm-lint.sh --partition <invalid> --list-files for 0of2, 3of2, 1of1, 1of9, 9of8, 1of, 2, 1of2.5bin/fm-test-run.sh --list-lanes | grep portable-serialbin/fm-test-run.sh --check-coveragebin/fm-test-run.sh --list-split-hintsfull live slice-gate run of all 8 slices of tests/fm-watch-triage.test.sh via BASH_ENV=tests/fm-test-slice-gate.sh, checked for exactly-once coverage of every test_* callbash tests/fm-test-run.test.sh (ran to its first failure, which was an unrelated pre-existing test blocked by a missingrubybinary)bash tests/fm-lint.test.sh (blocked early by missing shellcheck/actionlint)✅ **Document** - passed
✅ No issues found.
🔧 **Lint** - 1 issue found → auto-fixed ✅
🔧 Fix applied.
✅ Re-checked - no issues remain.
✅ **Push** - passed
✅ No issues found.