Repository navigation
ci: split the whole-tree test run into named suites - #210
Merged
Merged
Conversation
This was referenced Sep 6, 2026
The `CLI tests` job ran a bare `bun test`, which walks the whole tree: run 33955204147 logged "Ran 5111 tests across 400 files", including 87 files in packages/rules, 46 in packages/audit-engine and 43 in packages/crawler. packages/* already gated every PR, invisibly, under a job named for apps/cli. Split that one command into a step per suite so a red step names the package, and add scripts/test-suites.ts as the single source of truth for the split. `rest` is the complement of the named suites, computed from the tree, so a new package is covered the day it lands. `--check` runs in the quality job and fails if a test file escapes every suite, if two suites would run the same file, if a named suite points at a package that no longer exists, or if ci.yml stops running one of them. Roots are passed as `./<root>`: a bare `bun test` filter is a path SUBSTRING, so `scripts` also selects apps/cli/scripts/ and `packages/report` also selects a future packages/report-v2. The job keeps the name `CLI tests` because that exact string is a required status check in the repo ruleset. Renaming it, or moving to a matrix, renames the check and blocks every PR until the ruleset changes. Sequential steps leave the 251.6s total unchanged, cheapest suite first. Refs squirrelscan/repo#1670 Signed-off-by: Nik Cubrilovic <[email protected]>
nc9
force-pushed
the
ci/package-test-matrix
branch
from
September 6, 2026 03:11
f24c56a to
ddf200b
Compare
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.
Refs squirrelscan/repo#1670.
The issue's premise was wrong, and that is the finding
squirrelscan/repo#1670 says "packages/* test suites never run in public-repo CI". They do, and they always have. The
CLI testsjob ran a barebun test, and a barebun testwalks the whole tree, unlikebun run test(which iscd apps/cli && bun test).Evidence from the last green run before this branch, run 33955204147, job
CLI tests:Those 400 files, counted from the per-file group markers in that log:
So a failure in
packages/rulesalready failed the PR. What was missing was legibility: it happened under a job named for apps/cli, in one 400-file log, with nothing stating the arrangement or stopping it from silently changing.What changed
Before: one step,
bun test, in a job calledCLI tests.After: one step per suite in the same job, so a red step names the package. Same file set, verified below.
scripts/test-suites.tsis the single source of truth.restis the complement of the named suites computed from the tree, not a hand-kept list, so a new package is covered the day it lands.--checkruns in the quality job (first, ~20ms) and fails if:restquietly absorbed the files),Roots are handed to bun as
./<root>. A bare filter is a path substring, verified:bun test reportmatches 48 files across the tree,bun test scriptspicks upapps/cli/scripts/as well, andpackages/reportwould also select a futurepackages/report-v2../scriptsmatches 3 files wherescriptsmatches 4.Acceptance criteria
packages/report: the step exits 1.engine-testsandrelease-toolingare untouched. Both deliberately re-run files the new steps also cover, and the comment now says so, along withrelease.yml, which still runs its own bare whole-treebun test.timeout-minutes.The job could not be renamed
CLI testsis a required status check in this repo's ruleset (Protect main, id 19657274), alongsideFormat, lint, and typecheck,Audit engine golden testsand others. Renaming the job, or moving to astrategy.matrix(which renames checks toUnit tests (cli)and so on), makes the required check never report and blocks every PR until someone edits the ruleset. So the job keeps its name and the split lives in steps.A matrix would cut this job from ~275s to ~160s of wall time, and since
engine-testsalready runs 179s in parallel it would take the whole workflow off this job's critical path. That is a real win, but it needs a ruleset edit landed in the same change. Happy to follow up if you want it.Verification
Locally, per suite, file counts matching the CI table exactly:
actionlintclean,bun run format:checkclean,--checkgreen.audit-engine was verified in two halves rather than as one run: its 29 non-golden files pass in 0.72s, and the 17 golden/streaming/deadline files are exactly what the already-green
engine-testsjob runs. The combined 46-file run peaks over 1.3GB, above my local test watchdog's ceiling, so CI is the arbiter for the union. It is a strict subset of the 400 files that run in one process today, so it should not be new pressure.One thing to know:
packages/crawlerhas a pre-existing, load-dependent flake. Running its 43 files on a loaded machine failed once in each of two runs, a different test each time (trailing-slash-canonical-crawlandseed-redirect-pinning), and passed clean on the third. Both pass in isolation. This branch touches nothing in that package, and CI has been green, but the timing-sensitive redirect tests are worth knowing about. Filed separately.