Repository navigation
fix(publish): the gesture capture test runs on a manual clock - #9466
Conversation
The test read the host clocks, so a preemption between the capture handler's monotonic and wall reads stamped the frame early by the pause and tripped the assertion under CI load. On a manual clock the stamp is exact, so the assertion drops its millisecond of slack. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
✅ No new issues found.
Approach: sound. The flaky test moves to a Manual clock, as its neighbours already do, so no host pause can shift the stamp.
Reviewed changes
- Manual clock:
captures once a gesture resumes a context built before oneinstalls aManualclock and restores it infinally, matching the other tests incapture.test.ts(lines 704, 714, 822). - Exact assertion: the 1 ms slack is gone. The test compares the frame timestamp to
rendered - quantumwithtoBeCloseTo, and a 5 sclock.jumpbefore the gesture still shows the stamp is the render time.
claude-sonnet-5-5 | 𝕏
|
No actionable comments were generated in the recent review. WalkthroughThe gesture-resume regression test now uses a manual clock, advances it by five seconds before simulating the gesture, and checks the first audio timestamp against media time immediately before rendering. Clock cleanup runs in a Merge Risk:
|

Problem
captures once a gesture resumes a context built before one(js/publish/src/audio/capture.test.ts) read the host clocks. When the OS preempted the test between the capture handler's media-clock read and itsDate.now()read, the frame was stamped early by the length of the pause and failed the>= before - quantum - 1msbound. It failedtest jsin the merge queue for moq-dev/moq#9349 (run), a PR that doesn't touch the publish package. The flake is onmain.Approach
Run the test on a
Manualclock, as its neighbours in the file already do. Pausing the clock for 5 s before the click now shows the audio is stamped when it was rendered, not when the source appeared. The stamp is exact, so the assertion drops its millisecond of slack and compares against the render time minus one quantum.Impact
Test only. No public API or wire change.
Validation
main:bun test src/audio/capture.test.ts -t "gesture resumes" --rerun-each 3000withstress-ng --cpu 3×nprocfailed 4 of 3000 runs (Expected: >= …, Received: …at line 399, the same failure as the queue). With no load, 300 of 300 passed.capture.tsfails the new assertion (Expected: 4997333.33, Received: 4996333.33). The old bound allowed that error.Caused by
Alternatives
capture.tswould only flip the sign of a preemption's error, since two clocks can't be read atomically. The production stamp's error is one preemption pause on the first quantum's anchor, which drift steering absorbs, so this PR leaves it alone.Models
Size: XS
Implementer: Claude Code, claude-opus-5-5, unknown effort
Review
Rewritten by
quest reviewafter each round.Head: 520aba1
Base: origin/main at a843d23
Risk: low,
The only change is to one test file, js/publish/src/audio/capture.test.ts, which switches a test to a manual clock; nothing a consumer or peer relies on reads it, and a revert fully undoes it.Classified: low by Claude Code, claude-haiku-5-5, low effort, session
c25e9fd7-7f2b-4f5b-9820-4ac8283c3a73Reviewer: Codex, gpt-6.1-sol, medium effort
Session:
01a20822-1938-7ab1-8204-27cce1b4bb4b, round 1Score: 10/10,
Ready to land based on source review: the test uses deterministic time and precisely verifies the capture timestamp; tests were not run as instructed.Rounds: 1; first round 0; findings 0: fixed 0, refuted 0, open 0
Findings: none
🤖 Generated with Claude Code
(Written by Claude Opus 5.5)