Skip to content

[CI] Speed up expensive test fixtures (23–82% less time) - #26000

Merged
nwparker merged 4 commits into
mainfrom
nwparker/test-clock-fixture-waits
Oct 7, 2026
Merged

nwparker merged 4 commits into
mainfrom
nwparker/test-clock-fixture-waits

Conversation

@nwparker

@nwparker nwparker commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Expensive test fixtures finish sooner while exercising the same timeouts, real files, and binary responses.

What Changed

Advance a simulated clock after real Codex terminal/host setup finishes. Reuse the existing Claude stop-deadline helper to confirm the request is pending at 2,999ms and settles at its unchanged 3,000ms grace boundary. Preserve the recorded terminal screens and original readiness budgets. Wait for the Stop timer to be installed, verify it is still pending at 4,999ms, and advance through its original 7,000ms completion bound.

Create all 40,120 file-listing fixture files synchronously inside their isolated workers. Preserve paths, contents, real ripgrep listings, ignore/cap checks and deadlines.

Use native byte equality for large binary responses. Assert frame count, Buffer type, order and every byte, retaining the original comparison for mismatch diagnostics. Keep the independent complete-frame encoder and the real 1 MiB HTTP response, headers and streaming checks.

Why

Known timer waits, Promise scheduling before listing can start, and recursive Buffer-property comparisons add substantial fixture work. These changes exercise the same contracts directly. Production behavior and real runtime-contract clocks remain unchanged.

Measured on macOS arm64/M4 Max, Node 24.20.0, Bun 1.4.2, Vitest 5.0.3:

Independently measured fixture cohort Cases / workers Before median After median Improvement
Codex timeout fixtures 40 / 2 38.2808s 7.8690s 79.44% less time; 4.86×
Real file-listing fixtures 3 / 2 8.2665s 6.3319s 23.40% less time; 1.31×
Binary response fixtures 18 / 1 10.3646s 3.8750s 62.61% less time; 2.67×
Claude stop-note fixture (one file) 5 / 1 18.4809s 3.3680s 81.78% less time; 5.49×

Each cohort used three sequential complete pnpm test runs before, then three after, on an unchanged checkout except its measured fixture changes. No excluded warmup. Times include startup, setup, real operations, assertions, cleanup, reporting and exit. All 24 measured runs passed with identical file/case identities and outcomes in their cohort. These separate gains must not be added together. The 2× full-suite target remains unmet.

Raw samples in seconds:

Cohort Before After
Codex timeouts 38.789460, 38.202129, 38.280835 7.823094, 7.868973, 7.960189
File-listing 8.390994, 8.249583, 8.266466 6.331862, 6.795455, 6.206055
Binary responses 10.417165, 10.318498, 10.364640 3.860057, 3.875026, 3.922501
Claude stop note 18.622375, 18.442917, 18.480852 3.335497, 3.399079, 3.367961

Ranges: Codex 38.2021–38.7895s → 7.8231–7.9602s; files 8.2496–8.3910s → 6.2061–6.7955s; bytes 10.3185–10.4172s → 3.8601–3.9225s. Claude range: 18.4429–18.6224s → 3.3355–3.3991s, measured at 334f83de115d with only its test file changed. The byte comparison was measured at 9cec1c4706f4 with only its two test files changed; the reference frame generator was byte-identical before/after.

Reproduce each cohort separately:

ORCA_BACKGROUND_LAUNCH=1 pnpm test src/main/runtime/launched-agent-composer-readiness-codex.test.ts src/main/runtime/structured-agent-session-codex-turn-end-settlement.test.ts --maxWorkers=2
ORCA_BACKGROUND_LAUNCH=1 pnpm test src/main/ipc/filesystem-quick-open-options.integration.test.ts src/relay/fs-handler-list-files-candidates.integration.test.ts --maxWorkers=2
ORCA_BACKGROUND_LAUNCH=1 pnpm test src/relay/relay-watcher-shared-byte-index.test.ts src/main/runtime/rpc/static-web-client-handler-stream.test.ts --maxWorkers=1
ORCA_BACKGROUND_LAUNCH=1 pnpm test src/main/native-chat/agent-session-wire/structured-agent-session-claude-stop-note-end.test.ts --maxWorkers=1

Linked Issue

Maintainer-requested test-performance follow-up. Targets main after #25998 merged; this PR adds seven test-file changes. Each measured cohort retains its frozen-source results above. Incorporates the file fixtures previously proposed in #26002 to avoid duplicate full CI runs. The Bun localization check remains a separate PR, #25999.

Visual Proof

N/A — test fixtures and assertions only; no rendered UI or interaction change.

Testing

  • I manually tested these changes locally
  • Automated test fixtures updated

Final qualification on head 5d0e5e3575c0: all 32 checks are terminal and passing or intentionally skipped, including all five full unit shards and final aggregate gates. CodeRabbit found no actionable issues or unresolved threads. A local combined full run on 6ccaf42122448 failed four cases while another workspace ran a complete suite concurrently; one failure was the unchanged 60s async cleanup hook in the large-file fixture, with no reported inventory assertion failure. Three subsequent quiet standard Bun/Vitest runs preserved the two-file, three-case cohort, exact names/outcomes and original deadlines, and completed cleanup successfully (7.1494s / 6.2189s / 5.6401s). Those reruns establish correctness rather than a new performance comparison; contention is a plausible cause of the timeout, not a proven diagnosis.

macOS arm64: all measured runs preserve case identities and outcomes; all 66 cases pass under the Node fallback. Node typecheck, changed-code quality, formatting and lint pass. Terminal setup finishes before clock replacement, asynchronous rejection is observed during advancement, and teardown restores real timers. The five Claude cases retain all note, turn and event assertions, and also check the grace-minus-one boundary before completing. Existing integration cases retain their complete workloads. An independent byte-assertion probe verified rejection of changed bytes, missing frames and reordered frames.

Review

Independently reviewed real setup and timer-installation barriers, deadline boundaries, file counts/content, cleanup and byte-assertion equivalence. No workloads shrunk, assertions removed, skips added, deadlines reduced or production code changed. Native byte checks retain complete frame order and content, with original mismatch diagnostics.

Agent skill upstream boundary

  • Not applicable; no upstream skill source copied.

Notes

Uses cross-platform timer, file/path and Buffer APIs. SQLite/runtime fixtures retain Node. No SSH protocol, platform behavior, native binary or window activation changes.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • Visual proof is N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform and SSH/remote impact considered
  • Relevant local checks pass; CI covers the remaining repository checks

@nwparker nwparker changed the title Speed up Codex timeout fixtures (79% less time) Speed up expensive test fixtures (23–79% less time) Oct 6, 2026
@nwparker
nwparker force-pushed the nwparker/test-clock-fixture-waits branch from df9bb23 to 45c5968 Compare October 6, 2026 23:49
@nwparker
nwparker force-pushed the nwparker/bun-test-review-followup branch from 8c085dc to f3a7d06 Compare October 6, 2026 23:52
@nwparker
nwparker force-pushed the nwparker/test-clock-fixture-waits branch from 45c5968 to 334f83d Compare October 6, 2026 23:52
@nwparker nwparker changed the title Speed up expensive test fixtures (23–79% less time) Speed up expensive test fixtures (23–82% less time) Oct 7, 2026
@nwparker
nwparker changed the base branch from nwparker/bun-test-review-followup to main October 7, 2026 00:36
@nwparker
nwparker force-pushed the nwparker/test-clock-fixture-waits branch from a3afa5c to 5d0e5e3 Compare October 7, 2026 00:36
@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9321d1fe-18a5-4f44-b34c-bb469db1d4a5
📥 Commits

Reviewing files that changed from the base of the PR and between 9c6702b and 5d0e5e3.

📒 Files selected for processing (7)
  • src/main/ipc/filesystem-quick-open-options.integration.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-claude-stop-note-end.test.ts
  • src/main/runtime/launched-agent-composer-readiness-codex.test.ts
  • src/main/runtime/rpc/static-web-client-handler-stream.test.ts
  • src/main/runtime/structured-agent-session-codex-turn-end-settlement.test.ts
  • src/relay/fs-handler-list-files-candidates.integration.test.ts
  • src/relay/relay-watcher-shared-byte-index.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

The changes update test helpers for agent readiness and Stop timing, switch two filesystem fixtures to synchronous writes, and compare HTTP response bodies and relay frames by bytes. Existing readiness outcomes, Stop results, and test scenarios remain unchanged.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 5d0e5

This PR only changes test fixtures to run faster, and it does not change production behavior. No concrete merge-blocking risk was found.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 30.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 7 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: reducing the time required by expensive test fixtures.
Description check ✅ Passed The description covers the required sections, explains the changes and rationale, reports testing and performance measurements, and marks visual proof as not applicable. Its maintainer follow-up conte…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nwparker
nwparker merged commit 2d08b3a into main Oct 7, 2026
32 checks passed
@nwparker nwparker changed the title Speed up expensive test fixtures (23–82% less time) [CI] Speed up expensive test fixtures (23–82% less time) Oct 9, 2026
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.

1 participant