Skip to content

Split long-pole runtime test files to unlock file-level parallelism - #551

Merged
Sheldenshi merged 1 commit into
mainfrom
perf/split-long-pole-tests
Jul 8, 2026
Merged

Split long-pole runtime test files to unlock file-level parallelism#551
Sheldenshi merged 1 commit into
mainfrom
perf/split-long-pole-tests

Conversation

@Sheldenshi

Copy link
Copy Markdown
Collaborator

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.ts files.

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 describe keeps its own setup hooks, and each part gets a per-file-unique temp root via import.meta.file so parts running in separate worker processes don't race on a shared /tmp directory.

Test plan

  • Per-group 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 typecheck and bun run test (full suite) pass.

🤖 Generated with Claude Code

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>
@Sheldenshi
Sheldenshi merged commit dfe4a9f into main Jul 8, 2026
8 checks passed
@Sheldenshi
Sheldenshi deleted the perf/split-long-pole-tests branch July 8, 2026 02:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants