From ef98e90fd1dd7d5707a4e27903494707608716c2 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Wed, 21 Oct 2026 15:12:45 -0700 Subject: [PATCH 1/3] chore: claim Playwright Nix tooling quest Co-Authored-By: GPT-6 From 1c553abcc346802bed55aaa0f5df5d5e05bdc6db Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Wed, 21 Oct 2026 15:38:18 -0700 Subject: [PATCH 2/3] fix(test): use Nix Chromium for Playwright checks Co-Authored-By: GPT-6 --- .github/workflows/interop.yml | 8 +-- .github/workflows/nightly.yml | 19 ++------ .github/workflows/video.yml | 7 --- .github/workflows/wasm.yml | 7 --- bench/browser/package.json | 2 +- bench/browser/run.sh | 3 +- bun.lock | 16 +++--- flake.nix | 6 +++ js/justfile | 2 +- quest/m1/README.md | 2 - quest/m1/playwright-nix.md | 57 ---------------------- rs/justfile | 2 +- sh/dispatch-query.test.py | 5 ++ sh/dispatch.sh | 3 +- sh/js/README.md | 6 +++ sh/js/playwright.py | 46 +++++++++++++++++ sh/js/playwright.test.py | 56 +++++++++++++++++++++ sh/js/workspace.py | 2 + test/audio-quality/clients/js/package.json | 2 +- test/audio-quality/record.sh | 1 - test/audio-quality/run.sh | 1 - test/interop/README.md | 11 ++--- test/interop/clients/js/package.json | 2 +- test/interop/interop.sh | 6 +-- test/justfile | 10 ++-- test/p2p/package.json | 2 +- test/portrait/run.sh | 2 +- test/video/package.json | 2 +- test/video/renderer.browser.ts | 2 +- test/wasm/README.md | 3 +- test/wasm/package.json | 2 +- test/wasm/run.sh | 4 +- 32 files changed, 159 insertions(+), 140 deletions(-) delete mode 100644 quest/m1/playwright-nix.md create mode 100644 sh/js/playwright.py create mode 100644 sh/js/playwright.test.py diff --git a/.github/workflows/interop.yml b/.github/workflows/interop.yml index 2127319a0ae..53da609fddf 100644 --- a/.github/workflows/interop.yml +++ b/.github/workflows/interop.yml @@ -47,13 +47,9 @@ jobs: access-key-id: ${{ secrets.MBX_R2_ACCESS_KEY_ID }} secret-access-key: ${{ secrets.MBX_R2_SECRET_ACCESS_KEY }} - # Playwright's Chromium isn't in the nix devShell. Install it plus its apt - # runtime libs (`--with-deps` needs the host package manager) so the - # browser client can launch headless Chromium. interop.sh's own - # `playwright install` then no-ops. - - name: Playwright Chromium + - name: Workspace dependencies id: setup - run: nix develop --command bash -c "bun install --frozen-lockfile && bunx playwright install --with-deps chromium" + run: nix develop --command bun install --frozen-lockfile shell: bash -leo pipefail {0} # Each suite reports independently after setup, while a failed step still fails the job. diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 24f4253d08d..51950c1c55b 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -90,7 +90,7 @@ jobs: fail-fast: false matrix: # Unset keys default to the ARM runner, the plain dev shell, the Rust - # cache, no perf sampling, no Chromium, and nextest's default profile. + # cache, no perf sampling, and nextest's default profile. include: - name: Binding benchmark recipe: bench-ffi @@ -145,13 +145,11 @@ jobs: uncached: true - name: Browser backend baseline recipe: test wasm-baseline --uniffi - chromium: true artifact: wasm-backend-baseline artifact-path: target/test # Bounded: fails on crashes, missing output, or invalid samples, never on timing. - name: Browser benchmark smoke recipe: bench-browser --smoke - chromium: true artifact: bench-browser artifact-path: target/bench/browser - name: Audit @@ -202,12 +200,6 @@ jobs: if: matrix.perf run: sudo sysctl -w kernel.perf_event_paranoid=-1 - # Playwright's Chromium isn't in the nix devShell; `--with-deps` installs - # its apt runtime libs, and the recipe's own install then no-ops. - - name: Playwright Chromium - if: matrix.chromium - run: nix develop --command bash -c "bun install --frozen-lockfile && bunx playwright install --with-deps chromium" - - name: Run workload id: workload run: nix develop ${{ matrix.shell }} --command just ${{ matrix.recipe }} @@ -371,9 +363,9 @@ jobs: access-key-id: ${{ secrets.MBX_R2_ACCESS_KEY_ID }} secret-access-key: ${{ secrets.MBX_R2_SECRET_ACCESS_KEY }} - name: Install publisher and player engines - run: nix develop --command bash -c "bun install --frozen-lockfile && bunx playwright install --with-deps chromium firefox" + run: nix develop --command env PLAYWRIGHT_BROWSERS_PATH="${{ runner.temp }}/playwright" bash -c "bun install --frozen-lockfile && bunx playwright install --with-deps chromium firefox" - name: Media and negative controls - run: nix develop --command just test media --media-engines firefox + run: nix develop --command env PLAYWRIGHT_BROWSERS_PATH="${{ runner.temp }}/playwright" just test media --media-engines firefox env: MOQ_TEST_RUNS: ${{ runner.temp }}/moq-test-runs # Playwright checks a browser's libraries with the `ldd` on PATH, which in the @@ -416,11 +408,6 @@ jobs: with: access-key-id: ${{ secrets.MBX_R2_ACCESS_KEY_ID }} secret-access-key: ${{ secrets.MBX_R2_SECRET_ACCESS_KEY }} - # Playwright's Chromium isn't in the nix devShell; `--with-deps` installs - # its apt runtime libs, and run.sh's own install then no-ops. - - name: Playwright Chromium - run: nix develop --command bash -c "bun install --frozen-lockfile && bunx playwright install --with-deps chromium" - - name: WebSocket fallback startup benchmark run: nix develop --command just js qmux-bench diff --git a/.github/workflows/video.yml b/.github/workflows/video.yml index 431ba055041..7830b2b5a50 100644 --- a/.github/workflows/video.yml +++ b/.github/workflows/video.yml @@ -36,13 +36,6 @@ jobs: - uses: ./.github/actions/nix - # Playwright's Chromium isn't in the nix devShell. Install it plus its apt - # runtime libs (`--with-deps` needs the host package manager); the recipe's - # own `playwright install` then no-ops. - - name: Playwright Chromium - run: nix develop --command bash -c "bun install --frozen-lockfile && bunx playwright install --with-deps chromium" - shell: bash -leo pipefail {0} - - name: Video run: nix develop --command just test video shell: bash -leo pipefail {0} diff --git a/.github/workflows/wasm.yml b/.github/workflows/wasm.yml index 2e168ecbe0d..9e868cdb720 100644 --- a/.github/workflows/wasm.yml +++ b/.github/workflows/wasm.yml @@ -64,13 +64,6 @@ jobs: access-key-id: ${{ secrets.MBX_R2_ACCESS_KEY_ID }} secret-access-key: ${{ secrets.MBX_R2_SECRET_ACCESS_KEY }} - # Playwright's Chromium isn't in the nix devShell. Install it plus its apt - # runtime libs (`--with-deps` needs the host package manager); run.sh's own - # `playwright install` then no-ops. - - name: Playwright Chromium - run: nix develop --command bash -c "bun install --frozen-lockfile && bunx playwright install --with-deps chromium" - shell: bash -leo pipefail {0} - - name: Browser clock run: nix develop --command just rs wasm-test shell: bash -leo pipefail {0} diff --git a/bench/browser/package.json b/bench/browser/package.json index c6aa9bc2479..76c4b7e6d40 100644 --- a/bench/browser/package.json +++ b/bench/browser/package.json @@ -15,6 +15,6 @@ "@moq/watch": "workspace:*" }, "devDependencies": { - "playwright": "^1.64.0" + "playwright": "1.63.0" } } diff --git a/bench/browser/run.sh b/bench/browser/run.sh index 64d28ca559e..95e4b894f4e 100755 --- a/bench/browser/run.sh +++ b/bench/browser/run.sh @@ -84,8 +84,7 @@ fi cd "$WORKSPACE" bun install --frozen-lockfile -# BROWSER_BIN runs an identified local browser instead of Playwright's Chromium. -[[ -n "${BROWSER_BIN:-}" ]] || bunx playwright install chromium +# BROWSER_BIN overrides the Chromium provided by the root devShell. cd "$HERE" bun test ./fixture.test.ts ./summary.test.ts diff --git a/bun.lock b/bun.lock index adca12f16a4..7be94cae015 100644 --- a/bun.lock +++ b/bun.lock @@ -32,7 +32,7 @@ "@moq/watch": "workspace:*", }, "devDependencies": { - "playwright": "^1.64.0", + "playwright": "1.63.0", }, }, "demo/boy": { @@ -433,7 +433,7 @@ }, "devDependencies": { "@types/audioworklet": "^0.0.100", - "playwright": "^1.64.0", + "playwright": "1.63.0", "rolldown": "^1.2.13", "vite": "^8.3.4", }, @@ -456,7 +456,7 @@ "@moq/watch": "workspace:*", }, "devDependencies": { - "playwright": "^1.64.0", + "playwright": "1.63.0", "rolldown": "^1.2.13", "vite": "^8.3.4", }, @@ -485,7 +485,7 @@ "devDependencies": { "@types/bun": "^1.4.3", "@typescript/lib-dom": "npm:@types/web@^0.0.350", - "playwright": "^1.64.0", + "playwright": "1.63.0", "typescript": "7.0.2", "vite": "^8.3.4", }, @@ -515,7 +515,7 @@ "devDependencies": { "@types/bun": "^1.4.3", "@typescript/lib-dom": "npm:@types/web@^0.0.350", - "playwright": "^1.64.0", + "playwright": "1.63.0", "typescript": "7.0.2", "vite": "^8.3.4", }, @@ -530,7 +530,7 @@ "devDependencies": { "@ubjs/core": "0.31.0-6", "@ubjs/wasm": "0.31.0-6", - "playwright": "^1.64.0", + "playwright": "1.63.0", }, }, }, @@ -1587,9 +1587,9 @@ "picomatch": ["picomatch@4.0.7", "", {}, "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA=="], - "playwright": ["playwright@1.64.0", "", { "dependencies": { "playwright-core": "1.64.0" }, "bin": { "playwright": "cli.js" } }, "sha512-kVzTnYFYEyQ9RGzBjNCd2+yEqWmVbxl3AHPynv3qQ6JTjv4a+kwRcnqQwIpuP3NnrnIrE/Q6wWAIAvMfIE2/Yg=="], + "playwright": ["playwright@1.63.0", "", { "dependencies": { "playwright-core": "1.63.0" }, "bin": { "playwright": "cli.js" } }, "sha512-+7ziBLidS4NaNCdt57SUDT+wYmmd5fmiQejUic/kb+YsYSCPyOOE9sebzMjNmQrsnNpDJqd4WHvV/8lfKfUDUg=="], - "playwright-core": ["playwright-core@1.64.0", "", { "bin": { "playwright-core": "cli.js" } }, "sha512-T9r+MZkTECl2+oUcZ26YgZzTrYidTsIhYYkJix+6iDOymOb1FB2RLLSOxRGnZGv5DStt+aduIVbt+E8WygXYpg=="], + "playwright-core": ["playwright-core@1.63.0", "", { "bin": { "playwright-core": "cli.js" } }, "sha512-rYCsBF/M5HjUch52bbtVONEFjv6Xu8sm8h72dNlR5bzIE1fvC/bxgspzkjSfU+MweEMmPM8KJebG6nnyxo5mCg=="], "pluralize": ["pluralize@8.0.0", "", {}, "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA=="], diff --git a/flake.nix b/flake.nix index 7c2406df250..fc8dde30ee4 100644 --- a/flake.nix +++ b/flake.nix @@ -215,6 +215,8 @@ # JSR publishing. We call `deno publish` directly instead of `bunx jsr` # so the release doesn't race on a runtime binary download. deno + # One browser build for local and CI Playwright checks. + playwright-driver.browsers ]; # Python dependencies @@ -625,6 +627,10 @@ # fix`. IN_NIX_SHELL would also pass inside another project's shell. MOQ_DEV_SHELL = "1"; + PLAYWRIGHT_BROWSERS_PATH = "${pkgs.playwright-driver.browsers}"; + PLAYWRIGHT_VERSION = pkgs.playwright-driver.version; + PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS = "true"; + # Where `just obs compile` and `just obs test` look for libobs. Set # on every platform so the plugin type-checks against the pinned OBS # release everywhere, rather than whatever the host happens to have. diff --git a/js/justfile b/js/justfile index af809fc3df9..8c6915b0d87 100644 --- a/js/justfile +++ b/js/justfile @@ -60,7 +60,7 @@ bench name: bun install --frozen-lockfile bun net/bench/{{ name }}.ts -# Sweep browser publisher fairness over backlog x viewers; requires installed Chromium. +# Sweep browser publisher fairness over backlog x viewers using the devShell's Chromium. serve-bench: bun install --frozen-lockfile bunx tsc --noEmit --project net/bench/tsconfig.json diff --git a/quest/m1/README.md b/quest/m1/README.md index 2c7ec96538c..cf6e35aa576 100644 --- a/quest/m1/README.md +++ b/quest/m1/README.md @@ -116,8 +116,6 @@ lands before the cut. - [CI housekeeping](/quest/m1/ci-housekeeping.md) - queue nextest at 24 threads, stale Pages artifacts cleared, the actionlint ignore dropped - [Smoke flake bumps](/quest/m1/smoke-dependabot.md) - `test/smoke/flake.lock` bumps with its Playwright pin, automated or documented -- [Playwright browsers from Nix](/quest/m1/playwright-nix.md) - every Playwright check runs on Nix's Chromium locally and in CI, with npm pinned to match - - [moq-net compiles once](/quest/m1/net-erase-transport.md) - the session drivers stop monomorphizing per transport and per crate, saving several MiB of the relay, FFI library, `libmoq` and CLI - [moq-net internals](/quest/m1/net-internals.md) - no per-group session clones, no transport type parameter in lite and IETF internals, and the `Local` check measured diff --git a/quest/m1/playwright-nix.md b/quest/m1/playwright-nix.md deleted file mode 100644 index 2e37fd2feab..00000000000 --- a/quest/m1/playwright-nix.md +++ /dev/null @@ -1,57 +0,0 @@ -# [M] Playwright browsers from Nix - -## Goal - -Every Playwright check runs in the root devShell, locally on NixOS and in CI, -against the Chromium build that Nix provides. No check needs a hand-set -`LD_LIBRARY_PATH` or a `playwright install`, and no contributor doc tells -anyone to run one. - -Inventory on `main` (2026-10-21). Recheck with `git grep -n -i chromium` -outside `quest/` and `test/smoke/`, keeping the hits that install, download, or -say where Chromium comes from (comments included), and with every -`package.json` that depends on `playwright`: - -- Packages: `test/interop/clients/js`, `test/video`, `test/p2p`, `test/wasm`, - `test/audio-quality/clients/js`, `bench/browser`. -- Scripts: `test/interop/interop.sh`, `test/portrait/run.sh` (run in CI as - `just test portrait`), `test/wasm/run.sh`, - `test/audio-quality/{run,record}.sh`, `bench/browser/run.sh`, and the - `test/justfile` recipes. -- Workflows: `interop.yml`, `video.yml`, `wasm.yml`, `nightly.yml`, including - their comments that the devShell lacks Chromium. -- Docs and comments: `test/interop/README.md` (says the devShell lacks - Chromium), `test/wasm/README.md` (says to run - `bunx playwright install chromium`), `rs/justfile`'s browser clock recipe - (says `wasm.yml` installs it), `js/justfile`'s fairness sweep ("requires - installed Chromium"), and `test/video/renderer.browser.ts` (says - `just test video` installs it). - -Out of scope: the Firefox player row, whose `media-firefox` job in -`nightly.yml` keeps installing its engines with `--with-deps`, and -`test/smoke`, which keeps its own flake on purpose. - -## Plan - -Decided 2026-10-20 with the maintainer: - -- **Nix browsers, with npm pinned to match.** Today each package pins npm - `playwright ^1.64`, and the Chromium it downloads cannot load - `libglib-2.0.so.0` on NixOS (found while landing the browser rename check). - The root devShell exports `PLAYWRIGHT_BROWSERS_PATH` from - `playwright-driver.browsers`, `PLAYWRIGHT_VERSION` from - `playwright-driver.version`, and `PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS`, - as `test/smoke/flake.nix` already does; without the last, Playwright's host - check rejects the Nix browser on NixOS. Every - package pins npm `playwright` to exactly that version, even when this - downgrades it (1.64 to nixpkgs' 1.63 today). The alternatives were rejected: - supplying host libraries to a downloaded Chromium (nix-ld or an FHS env) - depends on the host's library compatibility, and building playwright 1.64 - in the repo's overlay is maintenance for a gap nixpkgs closes on its own. -- **CI switches too.** Every workflow, script, and recipe in the inventory - drops its Chromium install, so CI and local runs share one Chromium. -- **The pin is enforced.** A check in `just check` fails when any package's - npm `playwright` differs from `PLAYWRIGHT_VERSION`, like - `test/smoke/freshness.sh`, so a nixpkgs bump cannot silently drift. -- The docs and comments in the inventory say the devShell provides Chromium. - No new user-facing docs: this changes only contributor tooling. diff --git a/rs/justfile b/rs/justfile index d487a863ebc..06f33c71775 100644 --- a/rs/justfile +++ b/rs/justfile @@ -197,7 +197,7 @@ android *args: wasm *args: cargo clippy --locked -p moq-wasm -p moq-mux -p moq-ffi -p moq-clock --target wasm32-unknown-unknown --lib "$@" -- -D warnings -# Run the browser clock backend on the Playwright Chromium installed by wasm.yml, +# Run the browser clock backend on the root devShell's Playwright Chromium, # with the runtime and with reads alone. wasm-test: CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER="bun {{ justfile_directory() }}/test/wasm/rust.ts" cargo test --locked -p moq-clock --lib --target wasm32-unknown-unknown diff --git a/sh/dispatch-query.test.py b/sh/dispatch-query.test.py index 0b998d85d4a..561f7c0d877 100644 --- a/sh/dispatch-query.test.py +++ b/sh/dispatch-query.test.py @@ -79,6 +79,11 @@ def test_rust_cache_follows_modules_that_compile_rust(self): (self.repo / path).unlink() self.expect(True, base="--all", rust=True) + def test_nixpkgs_updates_check_browser_pins(self): + # JS selection also builds wasm, which is reflected in the Rust cache query. + self.change("flake.lock") + self.expect(True, rust=True) + def test_empty_diff_keeps_repository_lints(self): self.expect(True) diff --git a/sh/dispatch.sh b/sh/dispatch.sh index 87dbd3a37a8..92cc85a9b4f 100755 --- a/sh/dispatch.sh +++ b/sh/dispatch.sh @@ -56,7 +56,8 @@ declare -A scope=( # The JS tests also read Rust's shared JSON vectors; sh/js/workspace.py # fails a check that reads a cross-tree input this pattern misses. # demo/pub is a Worker outside the Bun workspace, listed so Biome lints it. - [js]='^(js/|bench/browser/|doc/|drafts/|demo/(boy|pub|web|carla/web)/|test/|rs/moq-wasm/|rs/.*\.json$|sh/js/|sh/rs/stats-docs\.py$|package\.json$|bun\.lock(b)?$|biome\.jsonc$)' + # Root Nix inputs own the browser version every npm Playwright pin matches. + [js]='^(js/|bench/browser/|doc/|drafts/|demo/(boy|pub|web|carla/web)/|test/|rs/moq-wasm/|rs/.*\.json$|sh/js/|sh/rs/stats-docs\.py$|package\.json$|bun\.lock(b)?$|biome\.jsonc$|flake\.(nix|lock)$)' # Workers with lockfiles outside the Bun workspace. [workers]='^(infra/apt/|infra/rpm/|infra/moq-sh/|demo/pub/|sh/js/workers\.sh$)' [moq_sh]='^infra/moq-sh/' diff --git a/sh/js/README.md b/sh/js/README.md index 9a90eeadc58..12d7ff9b184 100644 --- a/sh/js/README.md +++ b/sh/js/README.md @@ -31,6 +31,12 @@ fallback keeps the whole harness check. Shared dependency validation, environmen common helper tests continue to run. The CI setup query still uses the common module map, without requiring a JS toolchain before setup. +The root devShell supplies Chromium and exports its Playwright version. Checks +require every npm `playwright` dependency outside `test/smoke` to pin that exact +version. A root `flake.nix` or `flake.lock` change selects JS checks too: when +nixpkgs moves Playwright, update the reported manifests and regenerate `bun.lock` +with `bun install` in the new shell. Smoke has its own flake and freshness check. + Run `python3 sh/js/workspace.test.py` for graph and execution regressions. The same suite runs in `just gh test` nightly. To inspect work without executing it, pass a file containing relevant paths, one per line, to diff --git a/sh/js/playwright.py b/sh/js/playwright.py new file mode 100644 index 00000000000..80dec97d238 --- /dev/null +++ b/sh/js/playwright.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python3 +"""Keep every in-tree npm Playwright client on the root Nix browser's version.""" + +import json +import os +from pathlib import Path +import re +import subprocess + + +ROOT = Path(__file__).resolve().parents[2] +DEPENDENCIES = ("dependencies", "devDependencies", "peerDependencies", "optionalDependencies") + + +def check(root, version): + files = subprocess.check_output( + ["git", "ls-files", "--cached", "--others", "--exclude-standard", "--", "package.json", "**/package.json"], + cwd=root, text=True + ).splitlines() + problems = [] + for name in files: + if name.startswith("test/smoke/"): + continue # Smoke deliberately owns a separate flake and freshness check. + path = root / name + if not path.exists(): + continue # A staged or working-tree manifest deletion removes its pin. + package = json.loads(path.read_text()) + for field in DEPENDENCIES: + pin = package.get(field, {}).get("playwright") + if pin is not None and pin != version: + problems.append(f"{name}: {field}.playwright is {pin!r}, expected exact {version!r}") + return problems + + +def main(): + version = os.environ.get("PLAYWRIGHT_VERSION", "") + if not re.fullmatch(r"[0-9]+\.[0-9]+\.[0-9]+", version): + raise SystemExit("PLAYWRIGHT_VERSION is missing or malformed; run inside the root nix develop shell") + problems = check(ROOT, version) + if problems: + raise SystemExit("Playwright must match the root Nix browser:\n" + "\n".join(problems)) + print(f"Playwright pins match the root Nix browser: {version}") + + +if __name__ == "__main__": + main() diff --git a/sh/js/playwright.test.py b/sh/js/playwright.test.py new file mode 100644 index 00000000000..bbf05ad33fe --- /dev/null +++ b/sh/js/playwright.test.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python3 +"""Check all manifests without inspecting installed or smoke-owned dependencies.""" + +import json +from pathlib import Path +import subprocess +import tempfile +import unittest + +from playwright import check + + +class PlaywrightTests(unittest.TestCase): + def setUp(self): + self.temp = tempfile.TemporaryDirectory() + self.addCleanup(self.temp.cleanup) + self.root = Path(self.temp.name) + subprocess.run(["git", "init", "--quiet", str(self.root)], check=True) + (self.root / ".gitignore").write_text("node_modules/\n") + + def package(self, name, **fields): + path = self.root / name / "package.json" + path.parent.mkdir(parents=True, exist_ok=True) + path.write_text(json.dumps(fields)) + + def test_exact_pin_matches(self): + self.package("test/video", devDependencies={"playwright": "1.63.0"}) + self.assertEqual(check(self.root, "1.63.0"), []) + + def test_all_dependency_fields_and_new_packages_are_checked(self): + for field in ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"]: + with self.subTest(field=field): + self.package("new/package", **{field: {"playwright": "^1.63.0"}}) + problems = check(self.root, "1.63.0") + self.assertEqual(len(problems), 1) + self.assertIn(f"{field}.playwright", problems[0]) + + def test_nix_bump_refuses_an_old_exact_pin(self): + self.package("test/video", devDependencies={"playwright": "1.63.0"}) + self.assertEqual(len(check(self.root, "1.64.0")), 1) + + def test_deleted_manifest_does_not_leave_a_pin(self): + self.package("test/removed", devDependencies={"playwright": "1.1.0"}) + subprocess.run(["git", "add", "test/removed/package.json"], cwd=self.root, check=True) + (self.root / "test/removed/package.json").unlink() + self.assertEqual(check(self.root, "1.63.0"), []) + + def test_smoke_and_installed_dependencies_are_independent(self): + self.package("test/smoke/clients/js", devDependencies={"playwright": "1.1.0"}) + self.package("node_modules/fixture", dependencies={"playwright": "1.1.0"}) + self.package("test/video", devDependencies={"playwright": "1.63.0"}) + self.assertEqual(check(self.root, "1.63.0"), []) + + +if __name__ == "__main__": + unittest.main() diff --git a/sh/js/workspace.py b/sh/js/workspace.py index 133d33d34b4..cbfbd5a2153 100644 --- a/sh/js/workspace.py +++ b/sh/js/workspace.py @@ -138,6 +138,7 @@ def scripts(verb): command("bun", "install", "--frozen-lockfile") if action == "test": + command("python3", "sh/js/playwright.test.py") command("bun", "test", "js/common/declarations.test.ts", "js/common/deps.test.ts", "js/common/docs.test.ts", "js/common/worklet.test.ts") scripts("test") @@ -159,6 +160,7 @@ def scripts(verb): r"import\.meta\.env", "js"]) if result.returncode != 1: raise RuntimeError("import.meta.env scan found a reference or failed") + command("python3", "sh/js/playwright.py") command("bun", "js/common/deps.ts") if plan["wasm"]: command("just", "js", "wasm", "dev") diff --git a/test/audio-quality/clients/js/package.json b/test/audio-quality/clients/js/package.json index b6bdc032f28..8ad82b45f12 100644 --- a/test/audio-quality/clients/js/package.json +++ b/test/audio-quality/clients/js/package.json @@ -16,7 +16,7 @@ }, "devDependencies": { "@types/audioworklet": "^0.0.100", - "playwright": "^1.64.0", + "playwright": "1.63.0", "rolldown": "^1.2.13", "vite": "^8.3.4" } diff --git a/test/audio-quality/record.sh b/test/audio-quality/record.sh index 22114369693..687856046f1 100755 --- a/test/audio-quality/record.sh +++ b/test/audio-quality/record.sh @@ -53,7 +53,6 @@ echo "building the pages..." ( cd "$CLIENT" bun install --frozen-lockfile - bunx playwright install chromium bunx vite build --outDir "$HARNESS_RUN/page" --emptyOutDir ) diff --git a/test/audio-quality/run.sh b/test/audio-quality/run.sh index e72442f5f45..6b7ab359878 100755 --- a/test/audio-quality/run.sh +++ b/test/audio-quality/run.sh @@ -273,7 +273,6 @@ if [[ ${#ROWS[@]} -gt 0 ]]; then echo "building the page..." ( cd "$CLIENT" - bunx playwright install chromium bunx vite build --outDir "$HARNESS_RUN/page" --emptyOutDir ) fi diff --git a/test/interop/README.md b/test/interop/README.md index 336b5ceb8f8..0b738d5e2a1 100644 --- a/test/interop/README.md +++ b/test/interop/README.md @@ -130,9 +130,8 @@ delivers them as minted: a publisher is granted its exact broadcast, a subscribe ## Running locally You need the workspace toolchain on `PATH` (cargo, ffmpeg, bun, uv, go, -uniffi-bindgen-go, cmake, uniffi-bindgen-cpp, a C/C++ compiler). `nix develop` provides all of it except -Playwright's Chromium, which -`interop.sh` fetches on first run (`bunx playwright install chromium`). +uniffi-bindgen-go, cmake, uniffi-bindgen-cpp, a C/C++ compiler). `nix develop` provides +all of it, including the Chromium build matching the workspace's exact npm Playwright pins. ```bash # Default: rust publishes, rust subscribes (a fast sanity check). @@ -233,9 +232,9 @@ The matrix asks "did bytes arrive and did a pixel light up". That passes on a frozen picture, on silence, and on audio a second out of step, so `just test media` measures the media itself, browser to browser. Use `just test media --media-engines chromium,firefox,webkit` to run each pinned -Playwright player against a Chromium publisher. The harness installs the requested -engines and runs the same lifecycle cases, content tolerances, and five negative -controls per engine. A missing runtime or required API fails that engine by name. +Playwright player against a Chromium publisher. Chromium comes from the root devShell; +the dedicated Firefox CI job provides its other engines. The harness runs the same +lifecycle cases, content tolerances, and five negative controls per engine. A missing runtime or required API fails that engine by name. Firefox and WebKit players explicitly use WebSocket; Chromium keeps normal transport selection. This does not measure Firefox's QUIC path. diff --git a/test/interop/clients/js/package.json b/test/interop/clients/js/package.json index 93796a5e75c..b7b60a50973 100644 --- a/test/interop/clients/js/package.json +++ b/test/interop/clients/js/package.json @@ -15,7 +15,7 @@ "@moq/watch": "workspace:*" }, "devDependencies": { - "playwright": "^1.64.0", + "playwright": "1.63.0", "rolldown": "^1.2.13", "vite": "^8.3.4" } diff --git a/test/interop/interop.sh b/test/interop/interop.sh index 6fe3825abd2..d0e88c97f30 100755 --- a/test/interop/interop.sh +++ b/test/interop/interop.sh @@ -326,11 +326,7 @@ prepare_js() { return fi if needs js; then - # Nix provides Chromium via PLAYWRIGHT_BROWSERS_PATH; otherwise fetch it. - if [[ -z "${PLAYWRIGHT_BROWSERS_PATH:-}" ]] && ! (cd "$CLIENTS/js" && bunx playwright install chromium "${MEDIA_ENGINE_LIST[@]}") >"$HARNESS_RUN/js-chromium.log" 2>&1; then - mark_broken js "requested Playwright engine install failed" - sed 's/^/ /' "$HARNESS_RUN/js-chromium.log" >&2 || true - elif ! (cd "$CLIENTS/js" && bun run check) >"$HARNESS_RUN/js-check.log" 2>&1; then + if ! (cd "$CLIENTS/js" && bun run check) >"$HARNESS_RUN/js-check.log" 2>&1; then mark_broken js "type check failed" sed 's/^/ /' "$HARNESS_RUN/js-check.log" >&2 || true # Into the run directory, where harness.ts serves it from: vite empties its output diff --git a/test/justfile b/test/justfile index fcd47b7be6e..edbd8d0acd2 100644 --- a/test/justfile +++ b/test/justfile @@ -21,14 +21,13 @@ default: @just --justfile {{ quote(justfile()) }} --list test # Port isolation across private temp roots, plus Chromium checks of the watch and publish controls. -# The browser check is not `*.test.ts`: plain `bun test` runs lack Playwright Chromium, -# which this recipe installs, as the interop and wasm harnesses do. +# The root devShell provides Chromium for the browser checks, which stay separate +# from plain `bun test` so unit tests do not launch a browser. harness: ./lib/harness.test.sh ./interop/relay-log.test.sh cd .. && bun test test/interop/compat/resolve.test.ts test/interop/compat/claims.test.ts cd .. && bun install --frozen-lockfile - cd interop/clients/js && bunx playwright install chromium cd interop/clients/js && bun test ./harness.browser.ts ./signals-dom.browser.ts ./publish-ui.browser.ts ./capture-channel-count.browser.ts ./open-gop.browser.ts ./src/contract.test.ts ./src/resume.test.ts # Cross-language media interop test, built from this checkout. Stands up a @@ -200,8 +199,8 @@ wasm *args: # The @moq/video renderer in headless Chromium: WebGPU, a lost device, and the Canvas2D fallback. video: cd .. && bun install --frozen-lockfile - cd video && bunx playwright install chromium - cd video && bun test ./renderer.browser.ts + # A desktop display makes software Vulkan request unsupported window surfaces. + cd video && env -u DISPLAY -u WAYLAND_DISPLAY bun test ./renderer.browser.ts # Optional publisher retention across Rust/JS sessions through a Rust relay. max-age: @@ -228,7 +227,6 @@ qmux: # Complete MoQ SETUP and transfer a frame over a real browser data-channel pair. p2p: cd .. && bun install --frozen-lockfile - cd p2p && bunx playwright install chromium cd p2p && bun test ./transport.browser.ts # Retain complete backend assets, parity, and raw alternating browser samples. diff --git a/test/p2p/package.json b/test/p2p/package.json index f6030486895..13de3346c24 100644 --- a/test/p2p/package.json +++ b/test/p2p/package.json @@ -12,7 +12,7 @@ "devDependencies": { "@types/bun": "^1.4.3", "@typescript/lib-dom": "npm:@types/web@^0.0.350", - "playwright": "^1.64.0", + "playwright": "1.63.0", "typescript": "7.0.2", "vite": "^8.3.4" } diff --git a/test/portrait/run.sh b/test/portrait/run.sh index 46751493771..d47b719f4e4 100755 --- a/test/portrait/run.sh +++ b/test/portrait/run.sh @@ -9,7 +9,7 @@ harness_begin portrait 'just test portrait' cd "$WORKSPACE" cargo build --locked -p moq-relay -p moq-cli --features moq-cli/transcode,moq-cli/openh264 bun install --frozen-lockfile -(cd test/interop/clients/js && bunx vite build --outDir "$HARNESS_RUN/js-dist" && bunx playwright install chromium) +(cd test/interop/clients/js && bunx vite build --outDir "$HARNESS_RUN/js-dist") harness_port relay URL="http://127.0.0.1:$HARNESS_PORT" sed "s/4443/$HARNESS_PORT/g" "$DIR/relay.toml" >"$HARNESS_RUN/relay.toml" diff --git a/test/video/package.json b/test/video/package.json index 40bf8955827..b3cb6e45365 100644 --- a/test/video/package.json +++ b/test/video/package.json @@ -17,7 +17,7 @@ "devDependencies": { "@types/bun": "^1.4.3", "@typescript/lib-dom": "npm:@types/web@^0.0.350", - "playwright": "^1.64.0", + "playwright": "1.63.0", "typescript": "7.0.2", "vite": "^8.3.4" } diff --git a/test/video/renderer.browser.ts b/test/video/renderer.browser.ts index f49d72b7f6e..728f1fa58e7 100644 --- a/test/video/renderer.browser.ts +++ b/test/video/renderer.browser.ts @@ -4,7 +4,7 @@ * paints through Canvas2D. Once against the renderer directly and once through ``, * which swaps its own canvas. * - * Not `*.test.ts`: plain `bun test` runs lack Playwright Chromium, which `just test video` installs. + * Not `*.test.ts`: `just test video` launches the Chromium provided by the root devShell. * * @module */ diff --git a/test/wasm/README.md b/test/wasm/README.md index 28214e3d1fb..7e5baf47606 100644 --- a/test/wasm/README.md +++ b/test/wasm/README.md @@ -34,11 +34,10 @@ failing page, and CI uploads it; a passing run deletes its own. See ## Rust clock `moq-clock`'s browser backend also runs here, using `wasm-bindgen-test` and the -same Playwright Chromium installation: +same Chromium supplied by the root devShell: ```bash bun install --frozen-lockfile -bunx playwright install chromium just rs wasm-test ``` diff --git a/test/wasm/package.json b/test/wasm/package.json index b879effa415..0d058447a28 100644 --- a/test/wasm/package.json +++ b/test/wasm/package.json @@ -10,6 +10,6 @@ "devDependencies": { "@ubjs/core": "0.31.0-6", "@ubjs/wasm": "0.31.0-6", - "playwright": "^1.64.0" + "playwright": "1.63.0" } } diff --git a/test/wasm/run.sh b/test/wasm/run.sh index 4d2037392a5..18f4582d0ea 100755 --- a/test/wasm/run.sh +++ b/test/wasm/run.sh @@ -120,9 +120,7 @@ TARGET_BASE="${CARGO_TARGET_DIR:-$WORKSPACE/target}" cd "$WASM_DIR" bun install --frozen-lockfile -# Playwright ships its own Chromium; PLAYWRIGHT_BROWSERS_PATH means CI installed -# it already, in which case this is a no-op anyway. -bunx playwright install chromium +# The root devShell provides the matching Playwright Chromium. # Type-check against wasm-bindgen's generated .d.ts, as the shared harness check does. # wasm-bindgen resolves a type in a signature by its Rust identifier alone, so a From 7d2b6da79ecefb10c106eb0975aea09463f5a13b Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Wed, 21 Oct 2026 23:20:33 -0700 Subject: [PATCH 3/3] chore(deps): keep Dependabot off the Nix-pinned Playwright The six root-workspace Playwright pins must equal the root flake's browser, so an npm-only bump would fail the pin check and block the whole bun group. Co-Authored-By: Claude Opus 5.5 --- .github/dependabot.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 0b1ac2afd61..f136eb87152 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -80,6 +80,10 @@ updates: bun: patterns: - "*" + ignore: + # Pinned to the root flake's Chromium (sh/js/playwright.py), so it moves + # with a nixpkgs bump rather than ahead of it. + - dependency-name: "playwright" - package-ecosystem: "uv" directory: "/"