Repository navigation
unit-pure shards: two bun processes, fresh timings - #2423
Merged
Merged
Conversation
test/unit-pure-timings.json was a month old and missed 262 of the 1012 pure files. bun weighs an unnamed file as almost nothing, so they all landed in shard 1 (466 of 992 files). The table is now the mean of two green runs (45885080028, 45866731179) and ci-tier-routing.unit.test.ts fails when a pure file is missing from it or it names a file that is gone. Tested: bun test test/ci-tier-routing.unit.test.ts (119 pass).
A shard whose runner runs out of memory goes silent until the time limit instead of failing (#2351). Print free memory and the largest processes every 15 s to the log and keep them in the shard artifact. Also corrects the refresh note for the timings table.
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR2423Version: 🤖 Updated on each push. |
A bun worker keeps the memory of every file it ran. On the 16 GB runner shard 1's workers climbed from 2.9 to 8.6 GB over its last ~250 short files (run 45905930817), and the old 466-file shard 1 ran out of memory, which hangs the job until its limit (#2351). Each shard now runs bun's parts 2k-1 and 2k of a 2N split one after the other, keeps every guard per part, and runs both parts even when one fails. Same change in deploy-backend.yml's test-gate. Tested: the extracted step on a stub tree (all six shards, 1012 files once each; a failing part exits 1 after both run); ci-tier-routing and workflow-yaml tests pass.
neuromechanist
marked this pull request as ready for review
November 26, 2026 23:01
Review round 1 of #2423: the sampler subshell inherited set -euo pipefail, so a failed command or a SIGPIPE from ps into head could end it silently. It now turns both off, awk reads all of ps's output, and cleanup also ends the sampler's in-flight sleep. Tested: the extracted sampler with stand-in free and ps prints every interval and leaves no process.
Review round 1 of #2423: a part whose bun run printed no header or summary exited the step before the next part ran. It is now recorded and the step fails after the loop, which also refuses an empty sum over the parts. Same in deploy-backend.yml's test-gate. The comments now say the junit reports are uploaded per part, not merged, and that the nesting of the 12 parts in the old slices is an observation the checks do not rely on. Tested: the extracted step of both workflows on a stub tree, green and with a part whose worker exits; both parts run and the step exits 1.
Review round 1 of #2423: test/scrub/timings.json missed three suites (identifier-dates, git/canonical-key, git/location-logs-at). It is refreshed as the mean of runs 45907601198 and 45905930817, which moves the slowest of five slices from 721 to 585 s of summed time, and the scrub refresh note no longer says an unnamed file is only balanced less well. ci-tier-routing now fails when a scrub suite is missing from that table or it names a file that is gone, and when either pure shard matrix stops running two bun parts of a 2N split (mutation-checked: reverting test.yml to one --shard per job, and dropping a scrub entry, each fail one test). The redundant --timings match is gone. Tested: bun test test/ci-tier-routing.unit.test.ts (123 pass).
Review round 1 of #2423: 1,012 files and about 28,500 tests (run 45907601198), not 650 and 17,000.
This was referenced Nov 26, 2026
neuromechanist
added a commit
that referenced
this pull request
Nov 27, 2026
Merged
This branch was previously deployed
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.
Fixes #2351.
Root cause
The shard does not hang on a test: the runner runs out of memory. A bun
--parallelworker keeps the memory of every file it has run (each file gets a fresh global under--isolate, and the old ones are not given back), so a worker's memory grows with the number of files it runs, fastest in the tail of short files that bun schedules last. The staletest/unit-pure-timings.jsonmade shard 1 by far the largest: bun weighs a file the table does not name as almost nothing, and 262 of the 1012 pure files were missing from it, so they all landed in shard 1 (466 of 992 files, against 26 to 187 in the others).Evidence:
identifier-screen-flow,data-integrity-sweep-route,mail-screening), after 295 to 369 of their 466 files. No test fails and nothing is printed after the cut; the second ends##[error]Process completed with exit code 143.andThe runner has received a shutdown signal, 12 s after its last test line and 18 minutes before the time limit. A test waiting on a socket would leave the runner alive and reporting; this is the runner itself going away.manifest-source,compute-end-callers,data-route-manifest-stream,compute-runner-end-callers), and the 250 shortest files of shard 1 alone filled a 3.8 GB Linux container (bun 1.4.3, two workers). ForcingBun.gc(true)after every file did not change that, so the memory is retained, not uncollected.Fix
test/unit-pure-timings.jsonis refreshed from two green runs (45885080028 and 45866731179, mean per file), covering all 1012 pure files.test/ci-tier-routing.unit.test.tsnow fails when a pure file is missing from the table, when the table names a file that is not a pure test file, or when an entry is not a positive whole number of milliseconds; it also checks that both shard matrices pass the table to--timings. The refresh note aboveunit-pure-shardgives the averaging command.2k-1and2kof a2Nbun shard split, balanced on the same table. On bun 1.4.4 the 12 parts nest inside the old six slices; that is an observation, and the checks do not rely on it: they hold each part to its own header and summary, and the gate holds the union across shards to the classifier's list. Every guard (header, summary, pass count, assigned vs ran, discovered vs classifier, non-empty) is kept per part and on the sum, and both parts run even when one fails or leaves no summary. The timings of the two parts are merged into the artifact'stimings.jsonas before; the junit reports are uploaded per part asjunit-1.xmlandjunit-2.xml, not merged. The same change is made indeploy-backend.yml'stest-gate-shard, which runs the same file sets.[memory] used ... largest: ...) to the log, where it survives a runner that dies, and keeps it in the shard artifact asmemory.txt.No test was changed, skipped or given a longer timeout.
Shard timings
The summed per-file durations per shard are now 469 to 537 s (were 239 to 852 s). The worst shard now peaks at half the runner's memory where one had reached 84%.
Tests
bun test test/ci-tier-routing.unit.test.ts(119 pass; with the old table it fails on the 262 missing files, the stale entries and a zero entry)bun test test/workflow-yaml.test.tsand the other workflow-reading suites (191 pass)bun run typecheck,bun run lint, actionlint (no new findings)Found on the way, not changed here
backend/test/compute-pipeline-input.test.tspicks dataset ids at random (freshId, line 135), and two of them collided once locally (UNIQUE constraint failed: datasets.dataset_idin "a Zarr input digest is stored only when the record shows it covers every store").Review round 1
set -euo pipefailand a SIGPIPE frompsintohead: the subshell now starts withset +e +o pipefailand awk reads all of ps's output (35efdca).sleepwithpkill -P(35efdca).test/scrub/timings.json, which missed three suites, is refreshed from runs 45907601198 and 45905930817 (slowest of five slices 721 to 585 s of summed time), andci-tier-routingnow checks its coverage (2b06629).--timingsmatch is dropped, and a new test fails when either matrix stops running two$part/$partsbun processes, mutation-checked by reverting test.yml to one process (2b06629).origin/dev(6aa188b); the PR diff touches only.github/workflows/test.yml,.github/workflows/deploy-backend.yml,test/ci-tier-routing.unit.test.ts,test/unit-pure-timings.jsonandtest/scrub/timings.json.