Repository navigation
test: make parallel-flaky files safe to run together (HACK-2727) - #1282
Conversation
Five test compiles ran `bun build --compile` with the checkout as their working directory. Bun stages the executable as a transient `.<hash>.bun-build` there, so every other file's checkout write guard that read `git status` meanwhile failed its run. Compile in the test's own directory, and add a scan that keeps it that way. Give the in-process env migration cases, the SIGKILL boundary case, the sync-spawn scan and the five-CLI extra-hosts case load budgets, with the measured reasons written next to each. Make the TTY fixture signal only after its worker has finished all input and output. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…rd (HACK-2727)
Bun.build({ compile }) also stages its .bun-build in the compiling
process's working directory. step-store compiled in the test runner's
process and the renderer-loading control compiled in a child started in
the checkout. Spawn the step-store compile in its own root and move the
control to its outfile's directory before it compiles.
Rewrite the compile scan over the TypeScript syntax tree: tie cwd to
the call that runs the argv, recognize more names for the checkout,
cover command strings, Bun shell and Bun.build({ compile }), and skip
the scan's own samples.
Give doctor-fix-noninteractive a file-scoped 30 s budget, with the
measured reason written next to it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ACK-2727) Both wait on no timer and crossed Bun's 5 s default beside the suite's compile-heavy files; the measured reasons sit next to each budget. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hdir targets (HACK-2727) cli-compile-define read compile-working-directory's sample code as real CLI compiles; list it with the other description-only files. The Bun.build rule now also refuses a process.chdir into the checkout before the compile. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Update at
|
|
Merged At this head:
@codex review |
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. |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
Resolved to the tree tested in batch run m3:z494 (lead train sync). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
Several test files failed when the suite ran 12 files at a time on a 16-CPU Mac, then passed alone (HACK-2727). The batch logs point to two causes, and load reruns found a third. None is a product bug.
bun build --compileandBun.build({ compile })write the executable as a transient.<hash>-<n>.bun-buildfile in the compiling process's working directory, then rename it to the outfile.<n>counts up per process (-00000000,-00000001, ...). Seven compile sites ran with the checkout as that directory, either named or inherited: fivebun build --compilespawns, the in-processBun.build({ compile })helper instep-store(called three times), and aBun.build({ compile })in a fixture child started in the checkout. While one of them compiled, every other file's checkout write guard (HACK-1343) that readgit statussaw an untracked file and failed its run, even though all of its cases had passed. In the retained batch logs, every file entry the guard named was a?? .<hash>-<n>.bun-build; most end in-00000000, and the Nov 26 batch also has a-00000002.env-migration-journalwas the repeat offender. When a case timed out, it kept running afterafterEachhad removed its root, and its stranded work then threw errors into the next case.input.txtexisted, but the worker creates that file before it writes it and before it prints its stdout and stderr.sequenceDiagram participant A as test file A (compile) participant FS as checkout root participant B as test file B (guard) A->>FS: bun build --compile, cwd = checkout FS-->>FS: .<hash>.bun-build appears B->>FS: afterAll: git status FS-->>B: ?? .<hash>.bun-build B-->>B: guard fails the run A->>FS: rename to --outfile (file gone)Per-file causes and fixes
tests/host-exec-tty.test.tsindex.tswithcwdset to the checkoutcwdset to the test's temp directory.bun-buildduring the file before the fix and 0 aftertests/v4-upgrade.test.tscwd: repositorycwd: buildRoottests/native-interactive-exec.test.tscwd: root, so the scan can tie the cwd to ittests/prerelease-plan.test.tscwd: roottests/daemon-systemd-cli.test.tscwd: REPO_ROOT. Its own Nov 26 failure was the guard seeing another file's.bun-buildcwd: f.roottests/step-store.test.tsBun.build({ compile })calls ran in the test runner's process, whose cwd is the checkoutbun build --compile(same entry and defines) withcwdset to the test's roottests/fixtures/cli-renderer-loading.tscli-renderer-loading.test.tsstarts this control with the checkout as cwd, and itsbuildmode callsBun.build({ compile })thereprocess.chdirinto its outfile's owned directory before compilingtests/fixtures/tty-cancellation.py(host-exec-ttyiocase)input.txtappeared. Under load the worker was cancelled before its writes and prints finished (input, stdout and stderr all empty, exit 143)io.doneafter all input and output; the probe waits for that filetests/env-migration-journal.test.tsgitprobes plus private-file writes. The slowest takes 1.7 s alone, others took 4.4 s in a batch, and several crossed 5 s. The SIGKILL boundary case reached 106 s of its 120 s budget in batchessetDefaultTimeout(60_000)and a 300 s budget for the SIGKILL case. Each is written down as a load bound, following HACK-1439. No assertion changedtests/prerelease-plan.test.ts(MCP packaging case)tests/doctor-fix-noninteractive.test.tshack doctor --fixin process (Docker mocked). The HACK-1695 case takes 1.05 s alone and passed at up to 4.94 s in batches; on Nov 26 it timed out, and the stranded case then failed the next one with an ENOENTsetDefaultTimeout(30_000), matching the 30 s most cases there already name, with the reason recordedtests/sync-spawn-bound.test.ts.bun-build). Under more load, its scan, which TypeScript-parses about a thousand files (1 s alone, 3.6 s in batches), also crossed 5 stests/internal-extra-hosts-worktree.test.tssubprocess-signal,native-image-tags,project-config,host-exec-lifetime,native-host-plan-transport(unchanged).bun-build. I found no shared temp path, port, process-group signal or env leaktests/compile-working-directory.test.ts(new)tests/**/*.tsandscripts/**/*.tswith the TypeScript compiler and finds:"--compile"argv arrays and single-stringbun build … --compilecommands, which must name acwdin the options of the spawn call that receives them (tied to that call, not to a nearby one) and not the checkout; Bun shell$`bun build … --compile`, which must chain.cwd(...); andBun.build({ compile }), which is refused in test files and helpers and needs a priorprocess.chdirin fixtures and scripts. Names it treats as the checkout:REPO,REPO_ROOT,ROOT,repository,repoRoot,checkout,process.cwd(), and anything built fromimport.meta.dir/url/path(includingdirname(import.meta.dir)andresolve(import.meta.dir, "../..")). It skips its own sample code andscripts/build-release.ts(no test runs that one)origin/nextsources it flags all seven old sites. The first version of this file failed on itself once tracked (its samples matched); it now excludes itself, and its sample cases are unit testssync-spawn-boundalso failed in 7 batches for a different reason. Those trains added an unboundedspawnSyncthat also failed alone, so those were real regressions in the PRs under test, not flakes.Nothing is marked serial, and no assertion, retry or guard was weakened.
Validation
native-image-tagsran 25 times. With the compile's cwd in the checkout, 20 of 25 runs failed with?? .<hash>.bun-build. With an owned cwd, 0 of 25 failed..bun-buildfiles at the checkout root duringhost-exec-tty,v4-upgrade,native-interactive-exec,prerelease-plan(1 each),step-store(3) andcli-renderer-loading(1) before the fix, and none after.daemon-socket-permissions,compose-startup-phases,prerelease-platforms,project-target-inspect,system-tool), 17bun testprocesses at once, each with its own temp HOME, beside 3 CPU burners. A recursive watcher on the checkout ran through every round and recorded 0.bun-buildfiles. Other sessions share this Mac, so each round started only after the 1-minute load fell below 12 (on 18 CPUs). Load during the rounds was 10–25. Result: 169/170 passed. The one failure was in round 10:cli-renderer-loading's source-mode controls hit that file's own fixed 10 s per-child budget at 11–13 s. That is 7× their batch maximum of 1.7 s. This change does not touch that path (only thebuildmode compile moved), so I left the budget alone.yesburners and TLA+ runs, load 25–61) also ran past internal wall-clock bounds that no batch comes near: thev4-upgradefixture's 30 s per-command bound, the interactive frontend's 15 s readiness deadline, and the 20 s budgets of the journal key-publication cases. None of those runs saw a.bun-buildfile.bun run typecheckandbun run checkpass, the changed files passbiome check,privacy:checkpasses after staging, and gitleaks found no leaks in either staged diff.HACK_DAEMON_AUTOSTART_DISABLE=1and used a temp HOME.pgrep -x hackdshowed 0 before and after. No VM or krun binary ran, andcandidate-daemon-identitywas not run.Not covered here
env-migration-provider("production CLI explicitly repairs Compose…") also hit Bun's 5 s default in older batches. It looks like the same class but was outside this ticket's list.bun build --compileare not checked.private-env-file,native-interactive-launcherandsystem-tool) failed in batches only through the.bun-buildguard, so this change should clear them too.🤖 Generated with Claude Code