Split long-pole runtime test files to unlock file-level parallelism - #551
Merged
Conversation
bun runs test files in parallel but tests within a single file serially, so a large file becomes a serial critical path that caps the suite's wall-clock time on multi-core runners regardless of core count. The runtime suite was bounded by chat-task.test.ts (154 tests) at ~23s on a 16-core runner. Split the eight files over ~4s (chat-task, http, tunnel, jobs, email-watchers, chat, chat-needs-input, approval-mode) into balanced parts, preserving every test and each describe's own setup hooks. Give each part a per-file-unique temp root via import.meta.file so parts running in separate worker processes no longer race on a shared /tmp directory. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
Splits the eight slowest runtime test files (
http.test.ts,chat-task.test.ts,tunnel.test.ts,jobs.test.ts,email-watchers.test.ts,chat.test.ts,chat-needs-input.test.ts,approval-mode.test.ts) into balanced.partN.test.tsfiles.Why
bun runs test files in parallel but tests within a single file serially, so a large file becomes a serial critical path that caps the suite's wall-clock time on multi-core runners regardless of core count. The runtime suite was bounded by
chat-task.test.ts(154 tests) at ~23s on a 16-core runner. Splitting the long-pole files lets CI's file-level sharding actually use the cores.Every test is preserved, each
describekeeps its own setup hooks, and each part gets a per-file-unique temp root viaimport.meta.fileso parts running in separate worker processes don't race on a shared /tmp directory.Test plan
test(/it(declaration counts match the originals for all 8 split groups (261/104/34/19/154/29/171/74).bun test --parallel packages/runtime/src: 4384 tests across 222 files on this branch vs 4384 tests across 209 files on main — identical totals, nothing dropped or duplicated.bun run typecheckandbun run test(full suite) pass.🤖 Generated with Claude Code