Repository navigation
test(watch): replay audio only as long as the settled state needs - #9781
Conversation
Quest-Claim: c17ec6b792a60a45
The minute-long audio replays spent most of their CPU after the estimator and the playhead had settled (by 8 s), so a loaded host stretched them past bun's 5 s timeout. Run them 15 to 20 s instead, grading the same steady state, and replay the run-dry trace once instead of twice. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…group scan Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. WalkthroughReplay timing tests now use shorter simulated traces and observation windows, shared timing constants, and updated assertions. The changes cover auto-delay, flush, missing-packet duration, packet-duration changes, buffered stall recovery, and publisher-clock behavior. The prior replay-under-load investigation note was removed. The performance audit now records a profiled cost in Severity of issue fixed: Low Merge Risk:
|
Finishes quest/m0/test-flakes-5/watch-replay-under-load.md.
Problem
js/watch/src/audio/replay.test.ts's minute-long replays failed at bun's 5 s timeout in a loadedjust check(seen on moq-dev/moq#9712). A replay is CPU bound at about 5 ms per simulated second (linear in length, measured from 7.5 s to 240 s), so a 60 s replay costs about 0.3 s alone and 0.5 to 0.6 s for tests that run two. A loaded host that slows the process about tenfold pushes them past 5 s.Most of that time was spent after the state they grade had settled. Per-second traces of each scenario show the estimator's prior spent within 6 s (ten 500 ms folds) and the playhead on the clock by 8 s, then identical through 60 s; the tests graded from 30 s.
Approach
Each replay now runs only as long as its graded steady state needs, grading the same regime:
settledtarget sizing, and the sparse codec term: 15 s, graded from 10 s (STEADY,SETTLED). The zero-stretch trim bound is now relative: over a third of the audio (5664 ms of 15 s here; 22764 of 60 s before).No assertion is looser: every bound is unchanged except the zero-stretch trim, which scales with the shorter trace.
Failure rate
.tmp-only harness:replay.test.tsrun 10 times in parallel, each undersystemd-run --user --scope -p CPUQuota=<q>on a 32-core host already at load ~30.main(eca170c3a6)Slowest test alone: 0.58 s before, 0.26 s after. File total: 4.2 s before, 2.8 s after.
Validation
bun test src/injs/watch: 662 pass.just checkandjust cipass.Impact
Alternatives
Caused by
Follow-ups
js/hang's containerConsumervisits every buffered group on each decoded frame (#look,#updateBuffered,#checkMaxDelay), O(buffered groups) per frame, about a third of the CPU of the stalled-utterance replay at a 60 s lookahead. No open decisions.Models
Size: S
Implementer: Claude Code, claude-opus-5-5, unknown (arm A)
(Written by Claude Opus 5.5)
Review
Rewritten by
quest reviewafter each round.Nothing a consumer or peer relies on changes: the diff touches only the test file js/watch/src/audio/replay.test.ts (shorter replays and renamed constants), a deleted quest plan, and a quest note in quest/m3/audit-perf.md. The worst outcome is a weakened or flaky test that a contributor meets first in CI, and a plain revert fully undoes it.dca3c952-2121-4d4b-94f6-7f8dd10f3004