Skip to content

fix(moq-audio): give the publish-then-read tests an age budget - #3441

Merged
kixelated merged 1 commit into
devfrom
claude/fix-audio-decode-dev
Sep 5, 2026
Merged

fix(moq-audio): give the publish-then-read tests an age budget#3441
kixelated merged 1 commit into
devfrom
claude/fix-audio-decode-dev

Conversation

@kixelated

Copy link
Copy Markdown
Collaborator

Summary

dev has been red since the last main merge (ac69338ad): four moq-audio tests fail, two by assertion and two by hanging until the nextest timeout. This blocks every dev-based PR, which is how I found it (while landing #3418).

Root cause

The tests arrived with #3386, written against main, where the decode budget was latency_max: Option<Duration> and defaulted to None, meaning never shed. dev had already replaced that with max_age: Duration, whose Default is Duration::ZERO and, per its own doc comment, "skips aggressively". The merge reconciled the two APIs and adapted three of #3386's tests by adding max_age: Duration::from_secs(1), but four more sites kept the default.

Every one of those four publishes an entire track before it reads anything back, so by the time the consumer looks, all but the newest packet is older than a zero budget permits and gets shed:

  • a_missing_packet_leaves_a_hole saw only the second of its two packets: 2 frames stamped from stamps[1] instead of the expected 4.
  • resampling_does_not_shift_the_first_pts read a first PTS of 1_960_000 instead of 1_000_000, i.e. 0.96 s into the one second of audio it had just written.
  • a_lost_opus_packet_shorter_than_its_neighbour_is_a_gap and opus_pre_skip_does_not_leave_a_timestamp_hole write each packet as its own group, so their read() waits forever on groups that were skipped. That is the CI timeout.

Nothing is wrong with the shedding default or with the decode logic these tests cover. The tests simply aren't playing back, so they should not be subject to a playback budget.

Fix

Give the four sites the same one-second budget the three already-adapted tests carry:

  • the pcm_gaps helper in decode/consumer.rs, covering a_missing_packet_leaves_a_hole and millisecond_stamps_are_not_a_gap
  • a_lost_opus_packet_shorter_than_its_neighbour_is_a_gap and opus_pre_skip_does_not_leave_a_timestamp_hole
  • the subscription in resampling_does_not_shift_the_first_pts

Test-only; no production code changes.

Test plan

  • cargo test -p moq-audio: 173 passed, 0 failed, 1 ignored (plus the doc/integration targets), against 172 passed / 1 failed / 2 hung before.
  • cargo test -p moq-audio --lib decode::consumer: 11 passed, previously 2 failed and 2 hung past 60 s.
  • Confirmed the failures reproduce on plain origin/dev with no changes applied, so this is the base and not any one PR.
  • just fix clean.

Cross-Package Sync

No row applies: this touches only moq-audio's own tests. No wire, catalog, FFI, config, or CLI surface moves, so no drafts/ or doc/ update is due.

🤖 Generated with Claude Code

(Written by claude-opus-5[1m])

Four tests have been failing on dev since the last main merge: two
assert against shed packets, and two block forever on groups that were
skipped before they could be read.

The tests came from #3386, written on main where the decode budget was
`latency_max: Option<Duration>` and defaulted to `None`, meaning never
shed. dev had already replaced that with `max_age: Duration`, whose
default is `ZERO` and skips aggressively. The merge reconciled the two
APIs and adapted three of the new tests, but missed four more.

Each of them publishes a whole track up front and reads it back
afterwards, so every packet but the last is already older than a zero
budget allows and gets dropped. `a_missing_packet_leaves_a_hole` saw
only the second of its two packets, `resampling_does_not_shift_the_first_pts`
read a PTS 0.96s into the second of audio it had just written, and the
two Opus tests waited on frames that no longer existed.

Give those sites the same one-second budget the adapted tests already
carry. The default is right for playback; these tests just aren't
playing back.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 5, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-05T06:40:39.023724Z 8fa6148 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@kixelated
kixelated enabled auto-merge (squash) September 5, 2026 06:39
@kixelated
kixelated disabled auto-merge September 5, 2026 06:44
@kixelated
kixelated merged commit 7b22812 into dev Sep 5, 2026
2 checks passed
@kixelated
kixelated deleted the claude/fix-audio-decode-dev branch September 5, 2026 06:44
kixelated added a commit that referenced this pull request Sep 5, 2026
dev fixed the moq-audio publish-then-read tests itself (#3441), so its
version replaces the copy carried here.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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