Skip to content

test(daemon): remove clock jitter from startup-budget check - #27850

Merged
nwparker merged 1 commit into
mainfrom
nwparker/fix-daemon-handoff-budget-test
Oct 12, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/fix-daemon-handoff-budget-test

Conversation

@nwparker

@nwparker nwparker commented Oct 12, 2026 •

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

ELI5

The daemon startup-budget test can fail when the clock ticks by 1 ms between the test's start timestamp and the launcher's start timestamp. It then reports a 60,001 ms budget against a 60,000 ms limit even though the configured budgets fit exactly.

What Changed

Pin Date.now() for this one budget assertion. The suite already restores spies after each test. Production daemon startup and both budget assertions remain unchanged.

Why

This test checks configured time allowances, not elapsed execution time. A fixed clock removes scheduler noise while preserving the strict limit; adding tolerance or increasing the startup timeout would weaken the check.

Linked Issue

CI failure on PR #27824. The same test and assertion are present on current main.

Visual Proof

N/A — test-only change with no user-visible behavior change.

Testing

  • Reproduced the exact 60001 <= 60000 failure on current main by advancing a temporary test clock by 1 ms per read; the temporary advancing clock is not included in this change.
  • 38 tests passed across daemon-init-macos-stable-launch-fallback.test.ts, macos-daemon-launchd.test.ts, and daemon-init-wedged-daemon-grace.test.ts using the normal Bun-backed test runner on macOS with ORCA_BACKGROUND_LAUNCH=1.
  • pnpm run check:code-quality:changed passed.

Review

Self-reviewed the test's clock scope and restoration. No launcher, endpoint, daemon bundle, platform, or wire behavior changes.

Agent skill upstream boundary

  • Not applicable: no upstream skill source or artifacts are copied.

Notes

Fixes an existing main-branch CI flake independently of the hook error-card change.

Checklist

  • Small and focused.
  • Explained the failure, mechanism, and why this approach.
  • Visual proof is N/A for the test-only change.
  • Self-reviewed correctness and test cleanup.
  • Cross-platform, SSH, and compatibility impact considered.
  • Full lint, typecheck, test suite, and build: CI to cover beyond the targeted checks above.

@coderabbitai

coderabbitai Bot commented Oct 12, 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: be965152-04f3-43ec-88f8-bd316b2404ba

📥 Commits

Reviewing files that changed from the base of the PR and between 627716f and d16a3f6.


📒 Files selected for processing (1)
  • src/main/daemon/daemon-init-macos-stable-launch-fallback.test.ts

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



📝 Walkthrough

Walkthrough

The handoff-budget test now stubs Date.now() to return 1,000,000 before setting the launch failure mode and invoking the launcher. This makes the test use a fixed clock value.


Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to d16a3

The test clock is stabilized without introducing test-state leakage; no actionable merge-blocking risk remains.

Pre-merge checks | Passed 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check Passed The title clearly and concisely identifies the main change: removing clock jitter from the daemon startup-budget test.
Description check Passed The description is complete and focused. It explains the failure, change, rationale, testing, scope, visual-proof exception, and remaining CI coverage.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
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.

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR

  • Autofix · 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 c95da2a into main Oct 12, 2026
30 checks passed
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