Repository navigation
test(daemon): share the compaction submission fixture clock - #2169
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Shared clock and spy restoration packages/daemon/test/compaction-command-submission.test.ts, docs/as-built/test-layers.md |
The fixture uses its clock for Date.now and advances it during transport sleeps. Tests and a helper restore their send spies directly. The documentation describes the mixed-clock gotcha and notes that transport tests cover real deadline behavior. |
Priority:
Estimated code review effort: 2 (Simple) | ~8 minutes
Change: Other
Possibly related PRs
- mvschwarz/openrig#2149: Uses a controllable fixture clock for
Date.nowto prevent simulated waits from consuming a real deadline. - mvschwarz/openrig#1585: Uses one controllable clock for injected sleeps and transport and enforcer timing in a related compaction fixture.
- mvschwarz/openrig#1884: Changes the same command-submission test and its transport result.
Suggested reviewers: mvschwarz, openrig-review
Merge Risk: 
Minimal · up to f3d6b
-
The test-only clock alignment and mock cleanup introduce no concrete merge-blocking risk.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passedFull details: Docstring Coverage
-
Explanation
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 1 files. (1 skipped: 1 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- 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.
Comment @coderabbitai help to get the list of available commands.
|
Thanks again, @Aschenbath. As its description says, this makes the compaction submission tests share one clock between the fixture and the transport's sleeps and deadlines, so a scheduler pause can't use up the 20 ms idle budget and turn an expected |
openrig-review
left a comment
There was a problem hiding this comment.
Approved at f3d6b3a. The compaction submission fixture now runs the enforcer, the injected clock, Date.now and the transport's sleeps on one clock, so a scheduler pause can no longer spend the idle budget while the modeled seat stays idle; the cancellation and receipt assertions are unchanged, mocks are still restored after each test, and real-timer deadline cases remain in the transport suite. Reviewed by the merge desk's Claude reader. Required CI passes at this head.
|
Merged into |
What a user gets
Compaction receipt tests now exercise their modeled transitions without a scheduler pause consuming the fixture's 20 ms idle budget. Previously, the enforcer used a stepped clock while the real
SessionTransportused wall-clock deadlines and timers. An idle first submission could therefore becomenot_sentbefore a cancellation assertion expectedsubmitted_unconfirmed.The fixture now shares its clock with
Date.nowand transport sleeps. Receipt helpers restore only their send spy, keeping that clock active through the rest of each test;afterEachrestores all mocks. The test guide documents the clock boundary. Production code, the 20 ms budget and behavioral assertions are unchanged.Found while investigating the first CI attempt on #2153. That PR's unchanged compaction test passed in isolation and on an upstream rerun. This change addresses the reproducible fixture sensitivity; it does not claim to establish what delayed the original CI observation.
How you verified it
Source:
f3d6b3addc21356c72b26645210e69d62783d10d, based ona5e42d3d6b5d954e3c06304de6fd6d7278fc5f03.performance.now()stall into the readiness stub, without advancing the modeled clock. Both existing cancellation cases failed on the original fixture at the submitted-receipt assertion, receivingnot_sent. The same injection passes both cases on the final fixture. The injection was removed after each run and source restoration was verified; no busy-wait is included in the PR.session-transport.test.ts's modeled and real deadline cases.npm ci,npm run build,npm run lintandnpm run test:repopassed; repository tests were 327 passed / 1 skipped, with first-run references, docs, skill mirrors and generated context packs also checked. After narrowing the three send-spy restorations, the seven-file suite and lint were repeated successfully. Build and repository-check sources were unchanged by that final cleanup.git diff --checkpassed. All 10 CI jobs passed on this head, including every package suite, repository checks, installed scenario and portability. The PR has been approved and merged.Anything you were unsure about
The fault injection is a synthetic event-loop stall, not evidence of a particular GC or scheduler event in CI. The fixture uses the real enforcer and transport over a recording tmux adapter; no tmux server or native Claude process is needed. The transport suite retains separate real-timer coverage for late or unresolved observations.
CHANGELOG.mdeditSummary by CodeRabbit