Repository navigation
ci: npm test runs as two shards, one hosted job each - #578
Merged
Merged
Conversation
The `test` gate took 13 to 17 minutes on GitHub's slower hosted macOS machines (16 runs, 2026-11-23 and 24; `npm test` alone 11 to 14 of them), and it is the longest job of a run whenever sandbox-denials is not selected. scripts/test-shard.mjs <index>/<total> reads the pattern from package.json's `test` script, sorts the files and runs every <total>-th with `node --test`. A shard that selects no file exits 2. coverage.mjs takes its reading of `npm test` from the same function, so what it proves "runs under npm test" is what the shards run. .github/ci-kit.yml: `test` becomes `test-1` and `test-2`; test-2 also runs the harness suite through its cleanup check. Neither has `paths` or `on`, so every run selects both and the verdict needs both; test/test-shard.test.mjs holds the file to that, and to naming every shard of one total. `--gates test` is now refused by name, with the known gates listed. Sminos-Session: CI-opt#a45b97a3 (doperpowers on macbook)
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…characters runs node --test reads every positional argument as a glob, so a file selected by the script and passed by name, such as test/widget-[ab].test.mjs, matched as a pattern: Node ran zero tests for it and exited 0, and a file npm test runs ran in no shard. The script now passes package.json's own pattern with --test-shard=<index>/<total>, so discovery and selection are Node's. Its own glob stays for the progress line and the empty-shard guard; a test pins its deal to Node's by running every shard of a fixture and comparing the files that ran with the file list. Sminos-Session: CI-opt#a45b97a3 (doperpowers on macbook)
SSFSKIM
added a commit
that referenced
this pull request
Nov 24, 2026
…at/117-m5 (refs #506) Sminos-Session: cursor235#b93055dd (cua on macbook)
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.
What this changes
The
testgate becomes two gates,test-1andtest-2, each a hosted macOS job running half of the filesnpm testruns.Why: over the 16 finished
ciruns of 2026-11-23 22:51Z to 11-24 03:44Z the gate took 13.3 to 17.0 minutes on 13 of them (npm testalone 11.5 to 14.0 min) and 6.4 to 6.7 on the other 3. GitHub's macos-latest fleet has machines about 2.2x apart in speed on the same image (macos-26-arm64 20261117.0516), and which one a job gets is not ours to choose. On the slower machines the gate is the longest job of a run wheneversandbox-denialsis not selected.scripts/test-shard.mjs <index>/<total>reads the pattern from package.json'stestscript and runsnode --test --test-shard=<index>/<total> <pattern>, so discovery and selection are Node's (602 files today). Its own glob is for the progress line and the empty-shard guard; a test runs every shard of a fixture and compares what ran with the script's own deal. It exits asnode --testdoes; a shard that selects no file, a malformed shard, or atestscript that is no longernode --test "<pattern>"exits 2.scripts/repl-parity/coverage.mjstakes its reading ofnpm testfrom the same function (npmTestPattern), so the file it proves "runs under npm test" is a file the shards run..github/ci-kit.yml:test-1runs shard 1/2;test-2runs shard 2/2, thennpm run test:linux-engine-diff(the harness suite through its cleanup check). Both keepCUA_ENGINE_UNITS_GATE. Neither haspathsoron, so every run selects both andci / verdictneeds both.test/test-shard.test.mjs: the shards of this repository'snpm testrun every file once and none is empty (1, 2, 3 and 5 shards); an empty shard fails; ci-kit.yml names every shard of one total, astest-<index>, with nopathsoron, and no gate runsnpm testwhole beside them.test/linux-engine-diff/leak-check.test.mjs: its reading of the gate follows (exactly one test shard runs the cleanup check).package.json'stestscript is unchanged:npm testlocally is what it was.What a caller sees
ci-gate --gates testis now refused by name, with the known gates listed; the form is--gates test-1,test-2.Durations
node --testtest-1test-2testtest"Slower" and "faster" are read from the same CPU-bound tests' times inside each log. Both runs with
engine-swiftselected, so the Swift unit suite is skipped in the first three rows; the last row ran it (88 s).The halves are not equal: shard 1 holds about 59% of the work (387 s on a slower machine is about 168 s on a faster one, against shard 2's 118 s). The harness suite on shard 2 evens it: on a slower machine each job comes to about 7 minutes, against 13 to 17 for the single job.
Review
One independent review (low): one finding, fixed in the second commit. The first commit passed its share as explicit arguments, and
node --testreads each argument as a glob, so a file named with glob characters (widget-[ab].test.mjs) would have run in no shard, with exit 0.Not verified
node --testpasses it.engine-linuxfailed once in this run onclipboard::tests::an_unconfirmed_paste_s_current_time_refusal_covers_the_next_paste_too, which tech-debt-tracker.md already lists; this branch touches no Rust. The job is rerun.test/native-engine-units.test.mjs(shard 1 today) follows its place in the sorted list, so whenengine-swiftis not selected one shard carries that suite (87 to 206 s) and the balance moves with the file list.Sminos-Session: CI-opt#a45b97a3 (doperpowers on macbook)