test/browser: headless-browser smoke client (phase 2)#1542
Conversation
Add a js-browser publisher/subscriber so the smoke test covers the independent JS/WebCodecs implementation, interoperating with the native Rust/Python clients over WebTransport. Full rust/python/js-browser matrix passes in every direction. - flake.nix: provide headless Chromium via nixpkgs playwright-driver.browsers and set PLAYWRIGHT_BROWSERS_PATH (pin npm playwright to the driver's 1.58.2). - test/browser: a standalone Vite page using <moq-publish>/<moq-watch>, driven by a Playwright runner. Launches full Chromium (channel "chromium" / new headless for WebTransport + WebCodecs) with a fake camera; publish streams H.264, subscribe exits once the watch element's stats signal reports a decoded frame. Served as a prebuilt static bundle to avoid concurrent Vite dep-optimizer deadlocks. - test/smoke.sh: js-browser dispatch + a publisher warmup so the browser watch doesn't race the catalog (RESET_STREAM). The driver also reloads once mid-timeout to recover from an early catalog race. - smoke.py: wait for a catalog update that carries a video track (the browser publisher encodes lazily, so video appears in a later catalog, not the first). - smoke.yml: nightly runs the full matrix incl. js-browser (--timeout 30); the default `just test smoke` stays rust,python for speed. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThis PR adds browser-based smoke testing to the MOQ interop test suite. It introduces a new test/browser workspace with a TypeScript test client and Playwright-driven CLI harness, integrates the browser harness into test/smoke.sh (including a WARMUP delay), updates Nix to provide Playwright browser binaries, makes the Python smoke client wait for a catalog with video, and updates CI to include js-browser in the smoke test matrix. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches✨ Simplify code
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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
py/moq-rs/examples/smoke.py (1)
46-53: ⚡ Quick winAdd type hints for consistency with the file's existing style.
All other functions in this file include type hints (
publish,subscribe,main), but_catalog_with_videodoes not. Adding type hints would improve consistency and provide better IDE/tooling support.♻️ Suggested type hints
-async def _catalog_with_video(consumer): +async def _catalog_with_video(consumer: moq.BroadcastConsumer) -> moq.Catalog: # The catalog is a live track. A lazy publisher (e.g. the browser, which onlyNote: Use the appropriate type names from the
moqlibrary's interface. If the exact types are not exported, consider usingtyping.Anyor Protocol types as appropriate.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@py/moq-rs/examples/smoke.py` around lines 46 - 53, Add missing type hints to the _catalog_with_video function: annotate the consumer parameter with the appropriate type (e.g., moq.Consumer or typing.Any if moq.Consumer/Catalog types are not exported) and add a return type annotation (e.g., -> moq.Catalog or -> typing.Any). Update the signature of _catalog_with_video to include these annotations so it matches the other functions (publish, subscribe, main) in the file and improves IDE/tooling support.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@py/moq-rs/examples/smoke.py`:
- Around line 46-53: Add missing type hints to the _catalog_with_video function:
annotate the consumer parameter with the appropriate type (e.g., moq.Consumer or
typing.Any if moq.Consumer/Catalog types are not exported) and add a return type
annotation (e.g., -> moq.Catalog or -> typing.Any). Update the signature of
_catalog_with_video to include these annotations so it matches the other
functions (publish, subscribe, main) in the file and improves IDE/tooling
support.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: b9444f51-8dcb-476c-b2dc-747b65c5993f
⛔ Files ignored due to path filters (1)
bun.lockis excluded by!**/*.lock
📒 Files selected for processing (10)
.github/workflows/smoke.ymlflake.nixpackage.jsonpy/moq-rs/examples/smoke.pytest/browser/driver.tstest/browser/index.htmltest/browser/package.jsontest/browser/src/main.tstest/browser/vite.config.tstest/smoke.sh
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Summary
Phase 2 of the cross-language smoke test (#1529 was phase 1). Adds a headless-browser client so the smoke test covers the independent JS/WebCodecs implementation interoperating with the native Rust/Python clients over WebTransport.
The full
rust×python×js-browsermatrix passes in every direction:How the browser client works
flake.nixpullsplaywright-driver.browsersand setsPLAYWRIGHT_BROWSERS_PATH(npmplaywrightpinned to the driver's 1.58.2) — no Playwright browser download, reproducible.test/browser/: a standalone Vite page using the real<moq-publish>/<moq-watch>elements, driven by a Playwright runner (driver.ts):channel: "chromium"(the new headless mode — the defaultchrome-headless-shelllacks WebTransport/WebCodecs/mediaDevices).--use-fake-device-for-media-stream) → WebCodecs H.264 encode → streams until killed.<moq-watch>'sstatssignal reports a decoded frame.Things that needed solving (documented in code)
<moq-watch>only subscribes to/decodes video when it has a render target, and@moq/publishencodes lazily on demand — so the subscriber page adds a<canvas>.smoke.pynow waits for a catalog update that carries a video track (the browser publisher announces video in a later catalog, not the first snapshot).RESET_STREAM), sotest/smoke.shadds a publisher warmup and the driver reloads once mid-timeout to recover from the race.Defaults & CI
just test smokestays rust,python (fast; browser cells spin Chromium).js-browseris opt-in via--publishers/--subscribers; the nightlysmoke.ymlruns the full matrix (--timeout 30).Notes for reviewers
Test plan
just test smoke --publishers rust,python,js-browser --subscribers rust,python,js-browser --timeout 30→ all 9 cells PASSjust test smoke(rust,python) still greensmoke.ymlon Linux CI🤖 Generated with Claude Code
(Written by Claude)