Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: "/"
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/interop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,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.
Expand Down
19 changes: 3 additions & 16 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 }}
Expand Down Expand Up @@ -383,9 +375,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
Expand Down Expand Up @@ -428,11 +420,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

Expand Down
7 changes: 0 additions & 7 deletions .github/workflows/video.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
7 changes: 0 additions & 7 deletions .github/workflows/wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion bench/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
"@moq/watch": "workspace:*"
},
"devDependencies": {
"playwright": "^1.64.1"
"playwright": "1.64.1"
}
}
3 changes: 1 addition & 2 deletions bench/browser/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,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
Expand Down Expand Up @@ -631,6 +633,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.
Expand Down
2 changes: 1 addition & 1 deletion js/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion quest/m1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ lite-07 stream type here.
- [Interop audio delivery](/quest/m1/interop-audio.md) - every interop subscriber decodes and checks the publishers' 440 Hz tone, and the Rust publisher sends Opus
- [AAC in the native JS fallback](/quest/m1/libav-aac.md) - Node and Bun players decode AAC, and the Rust interop publisher adds an AAC track
- [Native audio decode conformance](/quest/m1/audio-decode-conformance.md) - Opus and AAC decode through every moq-audio backend, moq-c, and moq-ffi is checked against known tones and clips, like moq-video's suite
- [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
- [Allocation-free single-range subscriber window](/quest/m1/window-alloc.md) - a one-range subscribe resolves its window without a heap allocation, recovering the join cost per-subscriber ranges added
- [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
- [Main is no slower than release](/quest/m1/release-perf/README.md) - every benchmark where main is slower than release is fixed or accepted with a reason, checked by a final paired run before the cut
Expand Down
57 changes: 0 additions & 57 deletions quest/m1/playwright-nix.md

This file was deleted.

2 changes: 1 addition & 1 deletion rs/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions sh/dispatch-query.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
3 changes: 2 additions & 1 deletion sh/dispatch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/|demo/pub/|sh/js/workers\.sh$)'
[moq_sh]='^infra/moq-sh/'
Expand Down
6 changes: 6 additions & 0 deletions sh/js/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
46 changes: 46 additions & 0 deletions sh/js/playwright.py
Original file line number Diff line number Diff line change
@@ -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()
Loading
Loading