Skip to content

[CI] test: advance retry clocks instead of waiting in real time - #26220

Merged
nwparker merged 1 commit into
mainfrom
nwparker/test-retry-policy-clocks
Oct 7, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/test-retry-policy-clocks

Conversation

@nwparker

@nwparker nwparker commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

These two test suites spend less time waiting for retry timers while checking the same behavior. Their complete test command takes 47.44% less time in the measured comparison.

What Changed

Use Vitest’s virtual timeout clock for composer draft retries and the existing mocked WSL relay recovery policy. Advance the original retry and observation windows explicitly. Date and performance clocks remain real, and existing assertions, deadlines, held asynchronous operations and cleanup remain intact.

Why

The tests need to observe timer-driven policy, so advancing those timers gives the same checks without waiting in real time. This keeps the cases and their asynchronous boundaries instead of shortening windows or changing production behavior.

Linked Issue

N/A — maintainer performance work requested by the user.

Visual Proof

N/A — test fixtures only; no product UI or behavior changes.

Testing

  • Automated tests updated.
  • All 47 original cases passed with identical names and statuses in eight qualification runs: original and instrumented candidate, both Bun and stock Node, shuffled with seeds 104729 and 130363. Runtime routes, configuration and source guards matched.
  • Separate qualification assertions proved the rejected composer load actually retried before the next edit, and every observed timer was cleared. Removing only those observers/assertions recovers the shipping files byte for byte.
  • All six timed shipping runs passed the same 47 cases, with no rejected or discarded timing samples. First runs are included.
  • Local macOS validation: tc:node, tc:web, changed code quality and formatting passed. Full Linux ARM CI passed: all 11,678 physical files ran exactly once (11,538 passed / 140 existing skips), with 112,609 passing cases, one existing expected failure, and 1,052 existing skips; zero errors or omissions. Stock artifacts establish totals and routing, while the local qualifications establish exact named-case parity. No Windows result is claimed.
  • No manual UI check applies to this test-only change.

Measurements cover the whole pnpm test command for these two files on frozen source 0d8289997296413ed1629f7256885c27c277b436, with four workers and filesystem module caching disabled. Three alternating pairs used the same cases, routing, setup and flags:

Pair Before After Less time
1 5.5195 s 2.8874 s 47.69%
2 5.3591 s 2.7792 s 48.14%
3 5.1470 s 2.7567 s 46.44%
Mean 5.3419 s 2.8077 s 47.44%

Every pair improved; the scoped speedup is 1.9025×. This measures two suites, not the complete suite or the requested overall 2× goal.

Review

CodeRabbit reviewed the exact head with zero actionable comments. Its generic docstring advisory was considered: the touched anonymous test callbacks are already explicit, and the repository requires brief comments for non-obvious behavior; no redundant docstrings were added. Independent source review checked fake-clock boundaries, retained asynchronous operations, exact audit removal and the report validator. Production modules, actual Node runtime contracts and routing are unchanged.

Agent skill upstream boundary

  • Not applicable; no upstream skill code or documentation is copied.

Notes

WSL recovery still exercises its existing injected policy dependencies; no local or remote process is launched by this change. Native process, PTY, SQLite and real latency contracts keep their existing clocks and runtime routes. Two qualification preflight checks rejected external activity before launching any child; those records are retained and are not timing samples.

Checklist

  • This PR is small and focused.
  • The change, mechanism and reason are explained.
  • Visual proof is N/A with a reason.
  • Self-reviewed for correctness and performance; independent review completed.
  • Cross-platform and SSH boundaries considered; production behavior is unchanged.
  • Relevant local typechecks, tests and changed quality checks pass; full Linux ARM PR CI passed. Build is N/A for test-only changes.

@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: 64785add-94e5-4402-989a-aa85b6d32434
📥 Commits

Reviewing files that changed from the base of the PR and between 0d82899 and cbe1a3e.

📒 Files selected for processing (2)
  • src/main/agent-hooks/wsl-hook-relay-recovery.test.ts
  • src/renderer/src/components/native-chat/native-chat-composer-draft-store.test.ts

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


📝 Walkthrough

Walkthrough

The WSL hook relay recovery tests and native chat composer draft store tests replace real-time waits with Vitest fake timers. The tests advance timers to exercise their existing recovery and retry checks.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to cbe1a

The reviewed changes only adjust timer control in tests; no code-level merge blocker is evident. Proceed with the usual pending CI checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 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 describes the main change: replacing real-time waits with explicit timer advancement in tests.
Description check ✅ Passed The description covers the relevant template sections with specific change details, rationale, testing results, and checklist items. It correctly marks visual proof as not applicable for a test-only c…
  • 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 e381443 into main Oct 7, 2026
30 checks passed
@nwparker nwparker changed the title test: advance retry clocks instead of waiting in real time [CI] test: advance retry 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