Skip to content

quest(m1): finish the test coverage audit - #6175

Merged
kixelated merged 9 commits into
mainfrom
quest/m1/audit-test-coverage
Oct 21, 2026
Merged

kixelated merged 9 commits into
mainfrom
quest/m1/audit-test-coverage

Conversation

@kixelated

Copy link
Copy Markdown
Collaborator

Finishes the m1 run of the recurring test coverage audit (quest/m1/audit-test-coverage.md) and schedules the m2 run.

Fixes

  • just rs audio-devices failed all five playback tests on the hosted ARM runner. Two causes, both reproduced on x86_64 under CPU pinning:
    • cpal's PulseAudio host maps BufferSize::Default to the server's default buffer attributes: a 2 s tlength, 3.96 s end to end. Playback now asks the PulseAudio host (only) for 20 ms periods, clamped to the device's reported range (playback::device::buffer_size). Other hosts keep BufferSize::Default.
    • The tests assumed a device starts within 100 ms, while PulseAudio's idle null sink renders up to 2 s ahead. The tests now wait (10 s deadline) until the device's clock advances, and aec::taps_a_real_output_device waits for energy by deadline instead of a fixed iteration count.
    • New regression test the_device_buffers_periods_not_seconds asserts the reported latency is under 500 ms; it fails without the fix.
  • just rs gpu could not load a Vulkan loader inside the Nix shell on a non-NixOS host. AMD and Intel now run through the flake's Mesa ICDs and vulkan-loader, as just rs render-sw already does. NVIDIA keeps the host driver.
  • MoqMediaTrackStreamProducer::finish doc (Rust and Swift) claimed it drops the trailing access unit. It publishes it; the doc now says so and a test proves it.

New tests

  • moq_mux::import::Track decodes every video format (Avc1, Hev1, Av01, VP9; Avc3/Hvc1/VP8 were already covered) and MP3, including MP3 groups spanning frames until a cut.
  • moq_mux::import::TrackStream (the FFI raw-stream producer) splits chunked Avc3, Hev1, and Av01 byte streams.
  • MoqVideoEncoder (moq.video.Encoder in every wrapper) encodes, flushes, honors set_bitrate and cut, and closes after finish.
  • @moq/net's Zod frame reader (zod.ts, the only JS file with runtime code that no test loaded).

Quests

  • Deletes quest/m1/audit-test-coverage.md and adds its successor at the end of m2's Required, with m1 baselines, findings, and what to check first.
  • New quest/m2/vaapi-render-tests.md: the VA-API renderer import tests have no caller (GPU CI covers only NVIDIA).
  • New quest/m2/pulseaudio-capture-period.md: capture likely shares the 2 s buffer default.

Public API and wire impact

No API or wire changes. Behavior change: playback through cpal's PulseAudio host (moq-audio's opt-in pulseaudio feature) now opens with 20 ms periods instead of the server's 2 s default. Doc-only fix on MoqMediaTrackStreamProducer::finish (Rust and Swift).

Decisions (recommendations taken, easy to revisit)

  • 20 ms PulseAudio period, scoped to the PulseAudio host. Matches the WebRTC/Opus frame size; ALSA, CoreAudio, and WASAPI defaults already run in tens of milliseconds, so they keep Default.
  • Device tests wait up to 10 s for the device clock to move, rather than a fixed start budget, since PulseAudio's idle null sink can lag about 2 s.
  • The two new quests go in m2 next to their related quests (GPU CI, Audio join budget).

Overlaps with open PRs

Checks

  • just check (branch scope): green. Rust 3600 + 516 + 223 tests, the Dart and JS suites for the touched packages, and the Dart bindings freshness check (this PR regenerates one UniFFI checksum for the doc change).
  • just rs audio-devices locally on x86_64 under taskset: 1, 2, and 4 CPUs, serial and parallel, three runs each where parallel; all green. the_device_buffers_periods_not_seconds fails without the fix.
  • just rs gpu locally on an Intel iGPU plus AMD dGPU host: green.
  • Not run: the hosted ARM runner (the nightly rs audio-devices leg will confirm).

Not fixed here (owned elsewhere)

  • Nightly rs features stops at a moq-auth example SystemTime::now lint (moq-dev/moq#6155, moq-dev/moq#6135).
  • benchmark_feed_fetch_wakes hits the kio poll limit (moq-dev/moq#6112).
  • cargo clippy -p moq-mux --all-targets fails on a pre-existing unused Poll in benches/jitter.rs.

(Written by Claude Opus 5.5)

🤖 Generated with Claude Code

kixelated and others added 9 commits October 20, 2026 23:44
… tests wait for startup

cpal's PulseAudio host maps BufferSize::Default to the server's default
buffer: a 2 s tlength, 3.96 s end to end, filled in bursts. A new sink's
writes were dropped until the next burst read them. Ask PulseAudio for
20 ms periods instead; other hosts keep their defaults.

The device tests also assumed playback starts within 100 ms of opening.
PulseAudio's idle null sink renders up to two seconds ahead, so on the
nightly ARM runner every test failed before the device first pulled. They
now wait until the device's clock moves on its own before writing.

the_device_buffers_periods_not_seconds fails without the buffer fix
(1.99 s ahead of the speaker).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`@moq/net/zod` is exported but no test loaded it. Pin that falsy JSON
frames are values rather than the end of the group, and that a frame the
schema refuses throws.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t rs gpu`

`vulkan_gpu_device` could not load a Vulkan loader inside the Nix shell on
a non-NixOS host, so `just rs gpu` failed before testing anything. The AMD
and Intel branches now use nixpkgs Mesa's RADV or ANV driver and the
vulkan-loader, as `just rs render-sw` does with lavapipe. Each run loads
only its vendor's ICD, so the vendor assertion still means something.
NVIDIA keeps the host driver, which GPU CI owns.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`import::Track` is what moq-ffi, moq-c, and moq-gst publish through, and
`TrackStream` is the FFI's raw byte-stream producer. Coverage showed the
Track dispatch for avc1, hev1, av01, and vp9 and every TrackStream decode
and finish never ran. Land a keyframe through each, and split each raw
stream in 3-byte chunks so `finish` must flush the last picture (fails if
it does not).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ucer

`MoqVideoEncoder` backs `moq.video.Encoder` in every wrapper, and
`MoqMediaTrackStreamProducer::write` is how they publish raw Annex-B; no
test in any language reached either. Encode pictures and check keyframes
land at the start and at a cut, and write a chunked H.264 stream through
the stream producer.

The stream producer's `finish` doc (and the Swift wrapper's copy) said a
trailing access unit is dropped. It is published: `finish` flushes the
splitter, which the new test shows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The MP3 importer never ran. Publish frames through `Track::audio` and
check the catalog comes from the header and a group spans frames until
the caller cuts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Delete the m1 run and add its successor at the end of m2, after the
release cut, with this run's baselines, findings, and what to check
first. Plan the two follow-ups it found: VA-API renderer tests with no
caller, and PulseAudio capture likely sharing playback's 2 s buffer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 3 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 53e762b0-51e5-4405-8505-eb0f09e949f0
📥 Commits

Reviewing files that changed from the base of the PR and between 7d2a91f and 40649d9.

📒 Files selected for processing: 18
  • dart/moq_ffi/lib/src/moq.dart
  • js/net/src/zod.test.ts
  • quest/m1/README.md
  • quest/m1/audit-test-coverage.md
  • quest/m2/README.md
  • quest/m2/audit-test-coverage.md
  • quest/m2/pulseaudio-capture-period.md
  • quest/m2/vaapi-render-tests.md
  • rs/moq-audio/src/aec.rs
  • rs/moq-audio/src/playback/device.rs
  • rs/moq-audio/src/playback/driver.rs
  • rs/moq-audio/tests/integration/playback.rs
  • rs/moq-ffi/src/media.rs
  • rs/moq-ffi/src/test.rs
  • rs/moq-ffi/src/video.rs
  • rs/moq-mux/src/import/track.rs
  • sh/rs/gpu.sh
  • swift/Sources/Moq/Media.swift
  • 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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 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-10-21T07:56:29.303501Z 40649d9 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 added this pull request to the merge queue Oct 21, 2026
Merged via the queue into main with commit 4f81903 Oct 21, 2026
10 checks passed
@kixelated
kixelated deleted the quest/m1/audit-test-coverage branch October 21, 2026 14:55
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