Skip to content

[CI] Advance mocked test clocks instead of waiting in real time - #26135

Merged
nwparker merged 1 commit into
mainfrom
nwparker/test-virtual-observation-clocks
Oct 7, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/test-virtual-observation-clocks

Conversation

@nwparker

@nwparker nwparker commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​83 $\color{#cf222e}{\Huge{\mathbf{−}}}$​94 $\color{#cf222e}{\Huge{\mathbf{−}}}$​11
Prod 0 0 0 0

ELI5

Two test suites now advance their waiting periods with a simulated clock. They check the same behavior sooner.

What Changed

The coordinator fixture advances its existing polling intervals while waiting for the original run promise. The two Codex hook cases with mocked version answers advance the existing PATH and timeout windows. Every original case, assertion and timeout value remains.

The coordinator still uses real SQLite under actual Node. Its clock changes only timeout functions; Date remains real. Codex hook checks retain their real file I/O, and the existing real elapsed-time assertion remains unchanged. Cleanup restores real timers.

Why

These fixtures test ordering and timer-driven decisions with mocked collaborators. Advancing the original intervals exercises that behavior without waiting for each interval in real time. Production code and actual process/PTY/event-loop measurements are unchanged.

Measured on macOS arm64, Bun 1.4.2 / Vitest 5.0.3, with four workers, isolation retained and the filesystem module cache explicitly off. Times cover the complete pnpm test command, including startup, setup, reporting and exit.

Matched pair Before After Less time
1 6.240677 s 4.272464 s 31.54%
2 6.073094 s 4.232965 s 30.30%
3 6.026175 s 3.943378 s 34.56%
Mean 6.113315 s 4.149602 s 32.12%

All six runs preserve the exact 54 case identities, outcomes, runtime routes and setup files; no lifecycle errors or other test coordinators were observed. Order was before/after, after/before, before/after. Both arms used frozen commit 6d90d51802ddacbbcddaf4af6eeee85972b23789, with only these two fixture changes in the candidate. The final rebased head retains those two files byte-for-byte. This measures these two suites; the separate 2× full-suite goal remains unproven.

Linked Issue

Maintainer-requested test performance follow-up.

Visual Proof

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

Testing

  • I manually tested these changes locally
  • Automated tests updated

Both the default Bun coordinator and stock Node fallback pass all 56 cases across the two changed suites plus coordinator terminal-census recovery. Exact case/status parity also passes on final head d97af3f5038051639ba219af19ed96d7f8abebd3. Saved runtime details confirm actual Node for SQLite under Bun, and stock Node forks for fallback. Local tc:node, changed-code quality and formatting pass; All required CI gates pass on final head. Actual checkout 013c485f8051c920a47ab2e67a13cddcca5949c1 equals the PR tree and executes all 11,408 files exactly once: 11,273 passed and 135 existing skipped files. Five-shard logs report 110,663 passing cases, one expected failure, 1,035 skips, zero failures and zero unhandled errors. Both changed files exactly match the measured candidate, and the runtime configuration and six setups remain unchanged.

ORCA_BACKGROUND_LAUNCH=1 pnpm test src/main/runtime/orchestration/coordinator.test.ts src/main/codex/codex-hook-reconcile.test.ts src/main/runtime/orchestration/coordinator-terminal-census-unavailable.test.ts --maxWorkers=4 --fsModuleCache=false

Review

Compared every original registration and matcher after formatting. The timer driver observes the original promise's fulfillment or rejection; it does not replace the result or shorten the coordinator's configured budgets. Real runtime contracts and the Codex elapsed-time assertion remain intact. Independent source review and current-head CI are clear, with no unresolved review threads. No bot review was recorded on this head; bot inactivity is not claimed as review coverage.

Agent skill upstream boundary

  • Not applicable; no upstream skill source copied.

Notes

Local qualification is on macOS. Linux is qualified by the full PR test pipeline. Windows was not locally measured; original platform gates and runtime routing are unchanged. There is no change to SSH ownership, remote wire behavior, agent status or production state.

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 remaining repository checks

@coderabbitai

coderabbitai Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 8 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: dabcef11-33de-4271-bffe-6ffad42739e6
📥 Commits

Reviewing files that changed from the base of the PR and between 385fe8a and d97af3f.

📒 Files selected for processing (2)
  • src/main/codex/codex-hook-reconcile.test.ts
  • src/main/runtime/orchestration/coordinator.test.ts
  • 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 d58ea0c into main Oct 7, 2026
30 checks passed
@nwparker nwparker changed the title Advance mocked test clocks instead of waiting in real time [CI] Advance mocked test clocks instead of waiting in real 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