diff --git a/.github/workflows/audio-quality.yml b/.github/workflows/audio-quality.yml index ac771295727..3221cb41749 100644 --- a/.github/workflows/audio-quality.yml +++ b/.github/workflows/audio-quality.yml @@ -34,7 +34,7 @@ jobs: shell: bash -leo pipefail {0} env: # Somewhere upload-artifact can reach; the harness default is under $TMPDIR. - MOQ_TEST_RUNS: ${{ runner.temp }}/moq-test-runs + HARNESS_RUNS: ${{ runner.temp }}/moq-test-runs # The harness keeps a failing run's directory: every row's samples and summary. - name: Keep the failing run diff --git a/.github/workflows/features.yml b/.github/workflows/features.yml index 29f459d7130..703b038a50e 100644 --- a/.github/workflows/features.yml +++ b/.github/workflows/features.yml @@ -36,4 +36,4 @@ jobs: run: nix develop --command just ${{ matrix.recipe }} env: NEXTEST_PROFILE: ci - MOQ_STRICT: 1 + CI_STRICT: 1 diff --git a/.github/workflows/ietf-conformance.yml b/.github/workflows/ietf-conformance.yml index afe1f63e61b..e82a60cac7e 100644 --- a/.github/workflows/ietf-conformance.yml +++ b/.github/workflows/ietf-conformance.yml @@ -23,8 +23,8 @@ jobs: - name: Pinned Moxygen through the relay under the conformance profile run: nix develop --command just test ietf-conformance env: - MOQ_TEST_RUNS: ${{ runner.temp }}/ietf-conformance - MOQ_TEST_KEEP: 1 + HARNESS_RUNS: ${{ runner.temp }}/ietf-conformance + HARNESS_KEEP: 1 - name: Keep conformance reports and endpoint logs if: ${{ !cancelled() }} uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7 diff --git a/.github/workflows/interop.yml b/.github/workflows/interop.yml index a036636c49b..ce55160b206 100644 --- a/.github/workflows/interop.yml +++ b/.github/workflows/interop.yml @@ -72,7 +72,7 @@ jobs: shell: bash -leo pipefail {0} env: # Fail rather than skip the io_uring arm if the runner's kernel lacks it. - MOQ_STRICT: 1 + CI_STRICT: 1 - name: Harness regressions id: harness @@ -101,8 +101,8 @@ jobs: # The run writes its directory here, so a failed one is uploaded below # and a passing one is deleted as usual. Each case's record lands beside # it, for the report below. - MOQ_TEST_RUNS: ${{ runner.temp }}/moq-test-runs - MOQ_TEST_RESULTS: ${{ runner.temp }}/moq-test-runs/results.jsonl + HARNESS_RUNS: ${{ runner.temp }}/moq-test-runs + HARNESS_RESULTS: ${{ runner.temp }}/moq-test-runs/results.jsonl # The same matrix with every client pinned to one moq-transport draft per pass. A release # PR runs the oldest and newest even draft between Rust and native JS; nightly and manual @@ -116,8 +116,8 @@ jobs: shell: bash -leo pipefail {0} env: INTEROP_ARGS: ${{ github.event_name == 'pull_request' && '--publishers rust --subscribers rust,js-native-node,js-native-bun --versions moq-transport-14,moq-transport-22' || '--all --versions ietf' }} - MOQ_TEST_RUNS: ${{ runner.temp }}/moq-test-runs - MOQ_TEST_RESULTS: ${{ runner.temp }}/moq-test-runs/results.jsonl + HARNESS_RUNS: ${{ runner.temp }}/moq-test-runs + HARNESS_RESULTS: ${{ runner.temp }}/moq-test-runs/results.jsonl # Registry installs and the release matrix run only on main, nightly or # on demand: a break only needs catching before the next release. @@ -128,8 +128,8 @@ jobs: shell: bash -leo pipefail {0} env: GH_TOKEN: ${{ github.token }} - MOQ_TEST_RUNS: ${{ runner.temp }}/moq-test-runs - MOQ_TEST_RESULTS: ${{ runner.temp }}/moq-test-runs/results.jsonl + HARNESS_RUNS: ${{ runner.temp }}/moq-test-runs + HARNESS_RESULTS: ${{ runner.temp }}/moq-test-runs/results.jsonl - name: Portrait transcode id: portrait @@ -137,8 +137,8 @@ jobs: run: nix develop --command just test portrait shell: bash -leo pipefail {0} env: - MOQ_TEST_RUNS: ${{ runner.temp }}/moq-test-runs - MOQ_TEST_RESULTS: ${{ runner.temp }}/moq-test-runs/results.jsonl + HARNESS_RUNS: ${{ runner.temp }}/moq-test-runs + HARNESS_RESULTS: ${{ runner.temp }}/moq-test-runs/results.jsonl - name: Interop negative control id: negative @@ -146,8 +146,8 @@ jobs: run: nix develop --command just test interop-negative shell: bash -leo pipefail {0} env: - MOQ_TEST_RUNS: ${{ runner.temp }}/moq-test-runs - MOQ_TEST_RESULTS: ${{ runner.temp }}/moq-test-runs/results.jsonl + HARNESS_RUNS: ${{ runner.temp }}/moq-test-runs + HARNESS_RESULTS: ${{ runner.temp }}/moq-test-runs/results.jsonl # Browser-to-browser media QA: presented frame progress, audible tone, audio/video skew, and # the publication lifecycle, plus the negative controls that prove each assertion can fail. @@ -157,8 +157,8 @@ jobs: run: nix develop --command just test media shell: bash -leo pipefail {0} env: - MOQ_TEST_RUNS: ${{ runner.temp }}/moq-test-runs - MOQ_TEST_RESULTS: ${{ runner.temp }}/moq-test-runs/results.jsonl + HARNESS_RUNS: ${{ runner.temp }}/moq-test-runs + HARNESS_RESULTS: ${{ runner.temp }}/moq-test-runs/results.jsonl # Run independently so an unrelated cold-start failure cannot hide the # codec replacement and same-track coded-size growth measurements. @@ -168,8 +168,8 @@ jobs: run: nix develop --command just test media --media-cases rename shell: bash -leo pipefail {0} env: - MOQ_TEST_RUNS: ${{ runner.temp }}/moq-test-runs - MOQ_TEST_RESULTS: ${{ runner.temp }}/moq-test-runs/results.jsonl + HARNESS_RUNS: ${{ runner.temp }}/moq-test-runs + HARNESS_RESULTS: ${{ runner.temp }}/moq-test-runs/results.jsonl # A failing harness run keeps its directory, holding the process logs, the # relay config, and a Playwright trace of the failing page. Upload it for a diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index c0f366ce776..b3834e09ca4 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -235,7 +235,7 @@ jobs: run: nix develop ${{ matrix.shell }} --command just ${{ matrix.recipe }} env: NEXTEST_PROFILE: default - MOQ_BENCH_BASE: ${{ matrix.paired && (inputs.bench-base || 'previous-nightly') || '' }} + BENCH_BASE: ${{ matrix.paired && (inputs.bench-base || 'previous-nightly') || '' }} GH_TOKEN: ${{ matrix.paired && github.token || '' }} - name: Record benchmark outcome @@ -351,7 +351,7 @@ jobs: fail-fast: false matrix: # `rs uring` is a separate feature compile (off the default set), and - # MOQ_STRICT fails it below the 6.12 kernel floor. The embedding tests for + # CI_STRICT fails it below the 6.12 kernel floor. The embedding tests for # io_uring live there; uring.yml also runs it on affected release PRs. # `test drain` stands up two relays and drains one under a live JS # viewer: diff-independent, since a break can arrive through the relay, @@ -393,7 +393,7 @@ jobs: run: nix develop --command just ${{ matrix.recipe }} env: NEXTEST_PROFILE: ci - MOQ_STRICT: 1 + CI_STRICT: 1 # Media QA with a Firefox player against a Chromium fixture. The Chromium # player already runs in interop.yml, nightly and on release PRs. WebKit has @@ -423,7 +423,7 @@ jobs: - name: Media and negative controls 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 + HARNESS_RUNS: ${{ runner.temp }}/moq-test-runs # Playwright checks a browser's libraries with the `ldd` on PATH, which in the # dev shell is Nix glibc's and can't see the ones `--with-deps` installed, so # it refuses a Firefox that launches fine. @@ -478,16 +478,16 @@ jobs: run: nix develop --command just test native-play shell: bash -leo pipefail {0} env: - MOQ_TEST_RUNS: ${{ runner.temp }}/moq-test-runs + HARNESS_RUNS: ${{ runner.temp }}/moq-test-runs - name: Audio quality if: ${{ !cancelled() }} run: nix develop --command just test audio-quality --runtimes chromium --enforce --capture shell: bash -leo pipefail {0} env: # Somewhere upload-artifact can reach; the harness default is under $TMPDIR. - MOQ_TEST_RUNS: ${{ runner.temp }}/moq-test-runs + HARNESS_RUNS: ${{ runner.temp }}/moq-test-runs # A passing run is kept too: budgets.json is measured from these nights. - MOQ_TEST_KEEP: 1 + HARNESS_KEEP: 1 # The native player's rows, graded but not enforced: an intermittent device # stall voids about one AAC row in seven, which would fail most nights until # it is fixed. Kept beside the browser run so its ceilings can be re-measured. @@ -496,8 +496,8 @@ jobs: run: nix develop --command just test audio-quality --runtimes native shell: bash -leo pipefail {0} env: - MOQ_TEST_RUNS: ${{ runner.temp }}/moq-test-runs - MOQ_TEST_KEEP: 1 + HARNESS_RUNS: ${{ runner.temp }}/moq-test-runs + HARNESS_KEEP: 1 # The run directory is the diagnosis: each process's log, the shaper's # counters, the raw samples, and every row's summary. - name: Keep the run diff --git a/.github/workflows/smoke.yml b/.github/workflows/smoke.yml index df4d98ec673..50148eeb6a4 100644 --- a/.github/workflows/smoke.yml +++ b/.github/workflows/smoke.yml @@ -209,7 +209,7 @@ jobs: cli=$(nix build --refresh --no-link --print-out-paths 'github:moq-dev/moq#moq') { echo "RELAY_BIN=$relay/bin/moq-relay" - echo "MOQ_BIN=$cli/bin/moq" + echo "CLI_BIN=$cli/bin/moq" } >> "$GITHUB_ENV" # cachix.yml only pushes release tags, so each new HEAD @@ -228,19 +228,19 @@ jobs: echo "no CACHIX_AUTH_TOKEN secret; not pushing" exit 0 fi - nix run nixpkgs#cachix -- push kixelated "${RELAY_BIN%/bin/*}" "${MOQ_BIN%/bin/*}" + nix run nixpkgs#cachix -- push kixelated "${RELAY_BIN%/bin/*}" "${CLI_BIN%/bin/*}" - name: Pull moqdev images (docker channel) if: matrix.channel == 'docker' # Pull :latest fresh, then point smoke.sh at the wrapper scripts (which - # `docker run --network host` the images) via RELAY_BIN/MOQ_BIN. Docker is + # `docker run --network host` the images) via RELAY_BIN/CLI_BIN. Docker is # preinstalled on the Linux runners. run: | docker pull moqdev/moq-relay docker pull moqdev/moq { echo "RELAY_BIN=$PWD/clients/docker/moq-relay" - echo "MOQ_BIN=$PWD/clients/docker/moq" + echo "CLI_BIN=$PWD/clients/docker/moq" } >> "$GITHUB_ENV" # ── browser deps (Chromium runtime libs on Linux) ────────────────── @@ -290,7 +290,7 @@ jobs: # ── token interop ────────────────────────────────────────────────── # Independent of the media matrix: prove the published token tooling # cross-verifies. `moq auth` rides the same channel as moq-relay/moq - # (cargo/apt/brew/nix, on PATH or MOQ_BIN); @moq/auth comes from npm and + # (cargo/apt/brew/nix, on PATH or CLI_BIN); @moq/auth comes from npm and # runs under both node and bun; rust-docker runs `auth` in the # moqdev/moq image. The negative pass inside token.sh confirms each verifier rejects # tampered tokens and the wrong key. diff --git a/.github/workflows/ts.yml b/.github/workflows/ts.yml index 5eeb015d1ce..03e93c9a7f9 100644 --- a/.github/workflows/ts.yml +++ b/.github/workflows/ts.yml @@ -41,7 +41,7 @@ jobs: if: ${{ !cancelled() }} run: nix develop --command just test ts-controls env: - MOQ_TEST_RUNS: ${{ runner.temp }}/moq-test-runs + HARNESS_RUNS: ${{ runner.temp }}/moq-test-runs - name: TS pair controls if: ${{ !cancelled() }} @@ -53,14 +53,14 @@ jobs: if: ${{ !cancelled() }} run: nix develop --command just test ts env: - MOQ_TEST_RUNS: ${{ runner.temp }}/moq-test-runs + HARNESS_RUNS: ${{ runner.temp }}/moq-test-runs shell: bash -leo pipefail {0} - name: TS fragmented PES headers if: ${{ !cancelled() }} run: nix develop --command just test ts --fragment-pes env: - MOQ_TEST_RUNS: ${{ runner.temp }}/moq-test-runs + HARNESS_RUNS: ${{ runner.temp }}/moq-test-runs shell: bash -leo pipefail {0} # KLV and DVB AC-3 the importer carries as whole PES: each PES comes back byte-equal @@ -69,7 +69,7 @@ jobs: if: ${{ !cancelled() }} run: nix develop --command just test ts --klv --strict env: - MOQ_TEST_RUNS: ${{ runner.temp }}/moq-test-runs + HARNESS_RUNS: ${{ runner.temp }}/moq-test-runs shell: bash -leo pipefail {0} # A KLV stream joins the program mid-stream and leaves it: the export announces each @@ -78,28 +78,28 @@ jobs: if: ${{ !cancelled() }} run: nix develop --command just test ts --revision --strict env: - MOQ_TEST_RUNS: ${{ runner.temp }}/moq-test-runs + HARNESS_RUNS: ${{ runner.temp }}/moq-test-runs shell: bash -leo pipefail {0} - name: TS audio-only SCTE-35 if: ${{ !cancelled() }} run: nix develop --command just test ts --clockless audio-scte35 env: - MOQ_TEST_RUNS: ${{ runner.temp }}/moq-test-runs + HARNESS_RUNS: ${{ runner.temp }}/moq-test-runs shell: bash -leo pipefail {0} - name: TS sections-only clock if: ${{ !cancelled() }} run: nix develop --command just test ts --clockless sections env: - MOQ_TEST_RUNS: ${{ runner.temp }}/moq-test-runs + HARNESS_RUNS: ${{ runner.temp }}/moq-test-runs shell: bash -leo pipefail {0} - name: TS whole-PES-only clock if: ${{ !cancelled() }} run: nix develop --command just test ts --clockless pes env: - MOQ_TEST_RUNS: ${{ runner.temp }}/moq-test-runs + HARNESS_RUNS: ${{ runner.temp }}/moq-test-runs shell: bash -leo pipefail {0} # `import/export ts --passthrough`: from its first packet the capture is the source's @@ -109,7 +109,7 @@ jobs: if: ${{ !cancelled() }} run: nix develop --command just test ts --passthrough env: - MOQ_TEST_RUNS: ${{ runner.temp }}/moq-test-runs + HARNESS_RUNS: ${{ runner.temp }}/moq-test-runs shell: bash -leo pipefail {0} # The same over a hardware encoder's capture the T-STD model passes, with a dirty start @@ -118,7 +118,7 @@ jobs: if: ${{ !cancelled() }} run: nix develop --command just test ts-passthrough-capture env: - MOQ_TEST_RUNS: ${{ runner.temp }}/moq-test-runs + HARNESS_RUNS: ${{ runner.temp }}/moq-test-runs shell: bash -leo pipefail {0} # The same over a whole MPTS: two programs on their own PCR PIDs, whose recovery points @@ -127,7 +127,7 @@ jobs: if: ${{ !cancelled() }} run: nix develop --command just test ts --passthrough --mpts env: - MOQ_TEST_RUNS: ${{ runner.temp }}/moq-test-runs + HARNESS_RUNS: ${{ runner.temp }}/moq-test-runs shell: bash -leo pipefail {0} # The same round-trip at 2 Mb/s, where every keyframe outgrows a 25 ms PCR slot, @@ -137,7 +137,7 @@ jobs: if: ${{ !cancelled() }} run: nix develop --command just test ts --bitrate 2000000 env: - MOQ_TEST_RUNS: ${{ runner.temp }}/moq-test-runs + HARNESS_RUNS: ${{ runner.temp }}/moq-test-runs shell: bash -leo pipefail {0} # 1080p video filling a broadcast-sized 9 Mbit CPB, at the default delay: the @@ -147,7 +147,7 @@ jobs: if: ${{ !cancelled() }} run: nix develop --command just test ts --hrd env: - MOQ_TEST_RUNS: ${{ runner.temp }}/moq-test-runs + HARNESS_RUNS: ${{ runner.temp }}/moq-test-runs shell: bash -leo pipefail {0} # 1080p video with no HRD at its level's 24 Mb/s leak, so the export has to admit @@ -156,7 +156,7 @@ jobs: if: ${{ !cancelled() }} run: nix develop --command just test ts --leak env: - MOQ_TEST_RUNS: ${{ runner.temp }}/moq-test-runs + HARNESS_RUNS: ${{ runner.temp }}/moq-test-runs shell: bash -leo pipefail {0} # The same video beside two audio PIDs in a multiplex the source fills with no nulls, @@ -166,7 +166,7 @@ jobs: if: ${{ !cancelled() }} run: nix develop --command just test ts --full env: - MOQ_TEST_RUNS: ${{ runner.temp }}/moq-test-runs + HARNESS_RUNS: ${{ runner.temp }}/moq-test-runs shell: bash -leo pipefail {0} # The same video beside four audio PIDs in a multiplex faster than its Rx: each slot @@ -175,7 +175,7 @@ jobs: if: ${{ !cancelled() }} run: nix develop --command just test ts --headroom env: - MOQ_TEST_RUNS: ${{ runner.temp }}/moq-test-runs + HARNESS_RUNS: ${{ runner.temp }}/moq-test-runs shell: bash -leo pipefail {0} # The same round-trip over an open-GOP clip: recovery-group orphans are trimmed, @@ -184,7 +184,7 @@ jobs: if: ${{ !cancelled() }} run: nix develop --command just test ts --open-gop --strict env: - MOQ_TEST_RUNS: ${{ runner.temp }}/moq-test-runs + HARNESS_RUNS: ${{ runner.temp }}/moq-test-runs shell: bash -leo pipefail {0} # Builds the sparse-EPG and pending-version fixtures and round-trips @@ -193,7 +193,7 @@ jobs: if: ${{ !cancelled() }} run: nix develop --command just test ts-eit env: - MOQ_TEST_RUNS: ${{ runner.temp }}/moq-test-runs + HARNESS_RUNS: ${{ runner.temp }}/moq-test-runs shell: bash -leo pipefail {0} # The T-STD model must pass a broadcast capture and fail the same capture @@ -202,7 +202,7 @@ jobs: if: ${{ !cancelled() }} run: nix develop --command just test ts-tstd env: - MOQ_TEST_RUNS: ${{ runner.temp }}/moq-test-runs + HARNESS_RUNS: ${{ runner.temp }}/moq-test-runs shell: bash -leo pipefail {0} # The pair needs enough overlap to grade the slower table cadences. @@ -210,14 +210,14 @@ jobs: if: ${{ !cancelled() && github.event_name != 'pull_request' }} run: nix develop --command just test ts --pair env: - MOQ_TEST_RUNS: ${{ runner.temp }}/moq-test-runs + HARNESS_RUNS: ${{ runner.temp }}/moq-test-runs # Live timing needs the real-time window to distinguish drift from startup. - name: TS live release timing if: ${{ !cancelled() && github.event_name != 'pull_request' }} run: nix develop --command just test ts --live --duration 120 env: - MOQ_TEST_RUNS: ${{ runner.temp }}/moq-test-runs + HARNESS_RUNS: ${{ runner.temp }}/moq-test-runs # The subscriber's leg congested the way real paths are, through moq-shaper: 7 Mb/s under # the 9 Mb/s video and four audio PIDs, behind a 2 s queue, 25 ms each way. The export must @@ -226,7 +226,7 @@ jobs: if: ${{ !cancelled() && github.event_name != 'pull_request' }} run: nix develop --command just test ts --headroom --rate 7000000 --duration 120 env: - MOQ_TEST_RUNS: ${{ runner.temp }}/moq-test-runs + HARNESS_RUNS: ${{ runner.temp }}/moq-test-runs # The same path behind a 250 ms queue, with the relay's loss-based CUBIC: BBRv3 never fills a # queue this deep, CUBIC overflows it every sawtooth. QUIC must recover what the queue drops @@ -235,7 +235,7 @@ jobs: if: ${{ !cancelled() && github.event_name != 'pull_request' }} run: nix develop --command just test ts --headroom --rate 7000000 --queue 250ms --duration 120 env: - MOQ_TEST_RUNS: ${{ runner.temp }}/moq-test-runs + HARNESS_RUNS: ${{ runner.temp }}/moq-test-runs MOQ_QUIC_CONGESTION_CONTROL: loss # Passthrough over the overflowing path, under its 10 Mb/s multiplex: what arrives must be @@ -244,7 +244,7 @@ jobs: if: ${{ !cancelled() && github.event_name != 'pull_request' }} run: nix develop --command just test ts --passthrough --rate 7000000 --queue 250ms --duration 120 env: - MOQ_TEST_RUNS: ${{ runner.temp }}/moq-test-runs + HARNESS_RUNS: ${{ runner.temp }}/moq-test-runs MOQ_QUIC_CONGESTION_CONTROL: loss # Two minutes of MoQ content faults and a congested bottleneck, on a paused clock: each @@ -253,7 +253,7 @@ jobs: if: ${{ !cancelled() && github.event_name != 'pull_request' }} run: nix develop --command just rs ts-recovery env: - MOQ_TEST_RUNS: ${{ runner.temp }}/moq-test-runs + HARNESS_RUNS: ${{ runner.temp }}/moq-test-runs - name: Upload failure artifacts if: ${{ failure() }} diff --git a/.github/workflows/uring.yml b/.github/workflows/uring.yml index efc133a0a12..fdd353f8d87 100644 --- a/.github/workflows/uring.yml +++ b/.github/workflows/uring.yml @@ -15,11 +15,11 @@ concurrency: jobs: uring: name: io_uring - # This image provides a 6.12+ kernel; MOQ_STRICT fails the tests if that changes. + # This image provides a 6.12+ kernel; CI_STRICT fails the tests if that changes. runs-on: ubuntu-24.04-arm timeout-minutes: 60 env: - MOQ_STRICT: 1 + CI_STRICT: 1 steps: - name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 diff --git a/.github/workflows/wasm.yml b/.github/workflows/wasm.yml index 9e868cdb720..a2d96cbf5c5 100644 --- a/.github/workflows/wasm.yml +++ b/.github/workflows/wasm.yml @@ -74,7 +74,7 @@ jobs: env: # The run writes its directory here, so a failed one is uploaded below # and a passing one is deleted as usual. - MOQ_TEST_RUNS: ${{ runner.temp }}/moq-test-runs + HARNESS_RUNS: ${{ runner.temp }}/moq-test-runs # A failing harness run keeps its directory, holding the relay logs, their # configs, and a Playwright trace of the failing page. Upload it for a diff --git a/README.md b/README.md index d8f13dad37f..8d81f96ab8b 100644 --- a/README.md +++ b/README.md @@ -141,7 +141,7 @@ nested checks reuse that admission. Hosted GitHub Actions keeps its runner scheduling. Rust builds still use the dev shell's mbx Cargo shim. `just check` and `just ci` run three module lanes at once, each admitted per -command; set `MOQ_CHECK_JOBS` to change that, or to 1 to run them in order. +command; set `CHECK_JOBS` to change that, or to 1 to run them in order. Local nextest runs default to at most four test workers; set `NEXTEST_TEST_THREADS` to override it. Bun workspace scripts run sequentially locally, preserving dependency order, while CI keeps its workspace parallelism. @@ -149,7 +149,7 @@ Selection and an empty JS selection do not wait for admission. For a build outside these entrypoints, use `quest gate COMMAND [ARGS...]`; gate thresholds come from the host and have no configuration. -PRs into `main` get no cloud CI until the merge queue, so run `just ci` before pushing. It runs what the queue runs, the same ground as `just check`, plus two settings: `MOQ_STRICT=1`, which turns a missing tool into an error instead of a skipped check, and `NEXTEST_PROFILE=ci`, which allows a longer hang timeout. +PRs into `main` get no cloud CI until the merge queue, so run `just ci` before pushing. It runs what the queue runs, the same ground as `just check`, plus two settings: `CI_STRICT=1`, which turns a missing tool into an error instead of a skipped check, and `NEXTEST_PROFILE=ci`, which allows a longer hang timeout. See the [development guide](https://doc.moq.dev/setup/dev) and the [justfile](justfile) for more. diff --git a/bench/README.md b/bench/README.md index 61a13828c53..4035abcdfa9 100644 --- a/bench/README.md +++ b/bench/README.md @@ -207,9 +207,9 @@ to the performance cores wherever the kernel lists them already allowed, so an outer `taskset` or cpuset still narrows it. The run prints the pinned cores beside its result and records them as `affinity` in the metadata. A CPU with one core type runs unpinned. -BASE comparisons run paired rounds (default three, `MOQ_BENCH_RUNTIME_ROUNDS`), +BASE comparisons run paired rounds (default three, `BENCH_RUNTIME_ROUNDS`), alternating base/current order. Startup remains outside the final five-second -throughput window. `MOQ_BENCH_ARTIFACTS` chooses the evidence parent (default +throughput window. `BENCH_ARTIFACTS` chooses the evidence parent (default the current worktree's `.scratch/bench`), which must be outside the repository, or git-ignored and outside `bench/`; each invocation retains a new run directory even on failure. It contains raw load/host JSONL, process diagnostics, Criterion statistics, @@ -443,7 +443,7 @@ The latter two write `target/bench/nightly/{rust-bench,js}/report.json`. For a f measured Rust run using the same evidence lifecycle: ```bash -nix develop --command env MOQ_BENCH_LABEL=pattern MOQ_BENCH_RUNS=/tmp/criterion-runs.txt just gh criterion -p moq-pattern --bench matching +nix develop --command env BENCH_LABEL=pattern BENCH_RUNS=/tmp/criterion-runs.txt just gh criterion -p moq-pattern --bench matching nix develop --command just gh benchmark-report rust /tmp /tmp/rust-report.json ``` @@ -484,7 +484,7 @@ Reproduce a paired group locally against any revision; `previous-nightly` resolves the last scheduled Nightly's commit through `gh`: ```bash -nix develop --command env MOQ_BENCH_BASE=previous-nightly just gh nightly rust-bench +nix develop --command env BENCH_BASE=previous-nightly just gh nightly rust-bench nix develop --command just gh benchmark-report gate target/bench/nightly/rust-bench ``` diff --git a/bench/browser/run.sh b/bench/browser/run.sh index 4276908e1f7..6d4239c613e 100755 --- a/bench/browser/run.sh +++ b/bench/browser/run.sh @@ -53,8 +53,8 @@ while [[ $# -gt 0 ]]; do done # Evidence outlives the run, under the benchmark artifact root rather than $TMPDIR. -export MOQ_TEST_RUNS="${MOQ_TEST_RUNS:-$WORKSPACE/target/bench/browser}" -export MOQ_TEST_KEEP=1 +export HARNESS_RUNS="${HARNESS_RUNS:-$WORKSPACE/target/bench/browser}" +export HARNESS_KEEP=1 PROFILE="${BENCH_PROFILE:-release}" RELAY="${RELAY_BIN:-}" diff --git a/bench/local.py b/bench/local.py index 2ad7f59dfce..57d34da34b6 100644 --- a/bench/local.py +++ b/bench/local.py @@ -24,7 +24,7 @@ def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("--checkout", action="append", type=Path, required=True) parser.add_argument("--workers", nargs="+", type=int, required=True) - parser.add_argument("--jobs", nargs="+", type=int, help="MOQ_CHECK_JOBS lane counts to sweep") + parser.add_argument("--jobs", nargs="+", type=int, help="CHECK_JOBS lane counts to sweep") parser.add_argument("--samples", type=int, default=3) parser.add_argument("--cache", required=True, help="Describe the prepared cache state") parser.add_argument("command", nargs=argparse.REMAINDER) @@ -58,11 +58,11 @@ def cancel(number, _frame): with stem.with_suffix(".log").open("w") as log: env = dict(os.environ, NEXTEST_TEST_THREADS=str(workers)) # Without --jobs, the record's null means sh/dispatch.sh's default. - env.pop("MOQ_CHECK_JOBS", None) + env.pop("CHECK_JOBS", None) if jobs: - env["MOQ_CHECK_JOBS"] = str(jobs) + env["CHECK_JOBS"] = str(jobs) env.pop("QUEST_GATE_ADMITTED", None) - env.pop("MOQ_LOCAL_SUPERVISED", None) + env.pop("LOCAL_SUPERVISED", None) env.pop("GITHUB_ACTIONS", None) began = time.monotonic() process = subprocess.Popen(["bash", str(ROOT / "sh/local.sh"), sys.executable, diff --git a/bench/metadata.py b/bench/metadata.py index 5500abe8c2f..d0e4bf3dedf 100644 --- a/bench/metadata.py +++ b/bench/metadata.py @@ -27,7 +27,7 @@ def command(*args): "rustc": command("rustc", "-vV"), "cargo": command("cargo", "-V"), "os": platform.platform(), "machine": platform.machine(), "processor": platform.processor(), "affinity": sorted(os.sched_getaffinity(0)) if hasattr(os, "sched_getaffinity") else None, - "environment": {key: value for key, value in os.environ.items() if key.startswith(("MOQ_BENCH_", "CARGO_PROFILE_")) or key in ("RUSTFLAGS", "CARGO_BUILD_TARGET", "CARGO_BUILD_RUSTFLAGS", "TOKIO_WORKER_THREADS", "LD_PRELOAD", "MALLOC_CONF", "GLIBC_TUNABLES", "RUSTC_WRAPPER", "RUSTC_WORKSPACE_WRAPPER", "SESSION_CPU")}, + "environment": {key: value for key, value in os.environ.items() if key.startswith(("BENCH_", "MOQ_BENCH_", "CARGO_PROFILE_")) or key in ("RUSTFLAGS", "CARGO_BUILD_TARGET", "CARGO_BUILD_RUSTFLAGS", "TOKIO_WORKER_THREADS", "LD_PRELOAD", "MALLOC_CONF", "GLIBC_TUNABLES", "RUSTC_WRAPPER", "RUSTC_WORKSPACE_WRAPPER", "SESSION_CPU")}, "profile": "profiling" if mode == "--profile" else "release", "features": {"--runtime": "default + moq-relay/io-uring,moq-bench/uring", "--profile": "default; heap adds moq-relay/jemalloc", "--criterion": "see criterion-command.json"}.get(mode, "default"), diff --git a/bench/run.sh b/bench/run.sh index 89aedccb864..55032de6530 100755 --- a/bench/run.sh +++ b/bench/run.sh @@ -12,9 +12,9 @@ set -euo pipefail # `--shard` sweeps the QUIC shard count against the connection count. MODE=${1:-} -ROUNDS=${MOQ_BENCH_RUNTIME_ROUNDS:-3} +ROUNDS=${BENCH_RUNTIME_ROUNDS:-3} if [[ ! $ROUNDS =~ ^[0-9]+$ ]] || ((10#$ROUNDS < 1)); then - printf 'MOQ_BENCH_RUNTIME_ROUNDS must be a positive integer, got %q\n' "$ROUNDS" >&2 + printf 'BENCH_RUNTIME_ROUNDS must be a positive integer, got %q\n' "$ROUNDS" >&2 exit 1 fi ROUNDS=$((10#$ROUNDS)) @@ -48,10 +48,10 @@ usable_cpus() { } case $MODE in --criterion) - # MOQ_BENCH_BASE pairs each selected target with the same target built at that revision. + # BENCH_BASE pairs each selected target with the same target built at that revision. BASE= - if [[ -n ${MOQ_BENCH_BASE:-} ]]; then - BASE=$(git rev-parse --verify "$MOQ_BENCH_BASE^{commit}") + if [[ -n ${BENCH_BASE:-} ]]; then + BASE=$(git rev-parse --verify "$BENCH_BASE^{commit}") fi CRITERION_CARGO_ARGS=() CRITERION_FILTER_ARGS=() @@ -71,11 +71,11 @@ case $MODE in ;; --profile) BASE= - PROFILE_MODES=${MOQ_BENCH_PROFILE:-} - PROFILE_WORKLOAD=${MOQ_BENCH_PROFILE_WORKLOAD:-fanout} - PROFILE_WORKERS=${MOQ_BENCH_PROFILE_WORKERS:-1 4 16} + PROFILE_MODES=${BENCH_PROFILE_MODES:-} + PROFILE_WORKLOAD=${BENCH_PROFILE_WORKLOAD:-fanout} + PROFILE_WORKERS=${BENCH_PROFILE_WORKERS:-1 4 16} if [[ -z $PROFILE_MODES ]]; then - printf 'MOQ_BENCH_PROFILE must name one or more of: lock cpu heap\n' >&2 + printf 'BENCH_PROFILE_MODES must name one or more of: lock cpu heap\n' >&2 exit 1 fi for value in $PROFILE_MODES; do @@ -90,8 +90,8 @@ case $MODE in ;; --shard) BASE= - SHARD_COUNTS=${MOQ_BENCH_SHARD_COUNTS:-0 1 4 16} - SHARD_CONNECTIONS=${MOQ_BENCH_SHARD_CONNECTIONS:-16 64 256} + SHARD_COUNTS=${BENCH_SHARD_COUNTS:-0 1 4 16} + SHARD_CONNECTIONS=${BENCH_SHARD_CONNECTIONS:-16 64 256} for value in $SHARD_COUNTS $SHARD_CONNECTIONS; do if [[ ! $value =~ ^[0-9]+$ ]]; then printf 'shard benchmark counts must be integers, got %q\n' "$value" >&2 @@ -101,7 +101,7 @@ case $MODE in ;; --runtime) BASE= - RUNTIME_WORKERS=${MOQ_BENCH_RUNTIME_WORKERS:-} + RUNTIME_WORKERS=${BENCH_RUNTIME_WORKERS:-} if [[ -z $RUNTIME_WORKERS ]]; then RUNTIME_WORKERS=$(usable_cpus) if ((RUNTIME_WORKERS > 256)); then @@ -126,13 +126,13 @@ fi BASE_TARGET=$TARGET/base CURRENT_TARGET=$TARGET/current -ARTIFACTS=${MOQ_BENCH_ARTIFACTS:-$ROOT/.scratch/bench} +ARTIFACTS=${BENCH_ARTIFACTS:-$ROOT/.scratch/bench} mkdir -p "$ARTIFACTS" ARTIFACTS=$(cd "$ARTIFACTS" && pwd -P) # Each run copies bench/ and untracked sources, so it must land in neither. if [[ $ARTIFACTS/ == "$ROOT"/bench/* ]] || { [[ $ARTIFACTS/ == "$ROOT"/* ]] && ! git -C "$ROOT" check-ignore -q "$ARTIFACTS"; }; then - printf 'MOQ_BENCH_ARTIFACTS must be outside the repository, or git-ignored and outside bench/: %s\n' \ + printf 'BENCH_ARTIFACTS must be outside the repository, or git-ignored and outside bench/: %s\n' \ "$ARTIFACTS" >&2 exit 1 fi @@ -887,8 +887,8 @@ if [[ $MODE == --criterion ]]; then # Each invocation owns fresh results; previous runs cannot become new points. python3 -c 'import json,sys; from pathlib import Path; Path(sys.argv[1]).write_text(json.dumps(sys.argv[2:]))' \ "$RUN/criterion-command.json" "${@:2}" - if [[ -n ${MOQ_BENCH_RUNS:-} ]]; then - printf '%s\n' "$RUN" >>"$MOQ_BENCH_RUNS" + if [[ -n ${BENCH_RUNS:-} ]]; then + printf '%s\n' "$RUN" >>"$BENCH_RUNS" fi measure_criterion exit diff --git a/demo/web/justfile b/demo/web/justfile index 7eac80ea2ac..29d6637263c 100644 --- a/demo/web/justfile +++ b/demo/web/justfile @@ -7,7 +7,7 @@ default: # Run the web server targeting the specified relay. # The vite config opens the watch, publish, and stats demos in separate tabs; -# set MOQ_NO_OPEN=1 to skip opening a browser. +# set DEMO_NO_OPEN=1 to skip opening a browser. serve url='http://localhost:4443': install VITE_RELAY_URL="{{ url }}" bun --bun vite diff --git a/demo/web/open-tabs.ts b/demo/web/open-tabs.ts index 49639112be6..7f275a046bd 100644 --- a/demo/web/open-tabs.ts +++ b/demo/web/open-tabs.ts @@ -7,14 +7,14 @@ import type { Plugin } from "vite"; * `just web` brings up the watch, publish, and stats demos side by side. * * Pass `--open` to vite to also let it open the default page (don't; this - * replaces it). Set MOQ_NO_OPEN=1 to skip opening entirely. + * replaces it). Set DEMO_NO_OPEN=1 to skip opening entirely. */ export function openTabs(paths: string[]): Plugin { return { name: "moq-open-tabs", apply: "serve", configureServer(server) { - if (process.env.MOQ_NO_OPEN) return; + if (process.env.DEMO_NO_OPEN) return; server.httpServer?.once("listening", () => { const address = server.httpServer?.address(); diff --git a/doc/bin/cli.md b/doc/bin/cli.md index a97f32e12ea..668b2d7ca95 100644 --- a/doc/bin/cli.md +++ b/doc/bin/cli.md @@ -60,7 +60,9 @@ the handshake, so `--listen-timeout` bounds it too; `0s` leaves admission withou a deadline. `moq import --help` lists the sources and `moq import rtmp --help` a specific -one; every flag is documented there. Flags renamed between releases are listed in +one; every flag is documented there. A `MOQ_*` environment variable `moq` does +not read, such as a misspelling or one meant for `moq-relay`, stops it at startup +with the variable named. Flags renamed between releases are listed in [MIGRATE.md](https://github.com/moq-dev/moq/blob/main/rs/moq-cli/MIGRATE.md). ```bash diff --git a/doc/bin/relay/index.md b/doc/bin/relay/index.md index 4fd631190fe..79af9ecd559 100644 --- a/doc/bin/relay/index.md +++ b/doc/bin/relay/index.md @@ -45,7 +45,8 @@ public = "**" # anonymous access to everything; development only ``` Every option is also a `--flag` or `MOQ_*` environment variable, and -`RUST_LOG` controls logging. The +`RUST_LOG` controls logging. A `MOQ_*` variable the relay does not read, such as +a misspelling, stops it at startup with the variable named. The [configuration reference](/bin/relay/config) covers every section, and [`demo/relay/`](https://github.com/moq-dev/moq/tree/main/demo/relay) has working configs for development, production, and a cluster. Options renamed @@ -60,7 +61,8 @@ what you need, and call `run`, which keeps the listeners, QUIC workers, and shutdown inside the relay. An embedded CLI calls `config.relay.merge(&cli_layer)?` after its own `parse_from_with_settings` to load the relay file and environment, retain provenance, and refuse obsolete -spellings. CLI-only fields on the embedding root stay intact. +spellings, then `moq_tokio::cli::check_env` with its own spec to refuse `MOQ_*` +variables it does not read. CLI-only fields on the embedding root stay intact. ```rust use axum::routing::get; diff --git a/doc/setup/dev.md b/doc/setup/dev.md index 9d5bbd3157b..7767ff79884 100644 --- a/doc/setup/dev.md +++ b/doc/setup/dev.md @@ -8,7 +8,7 @@ description: Build, test, and debug the MoQ repository The repository uses [Just](https://github.com/casey/just) as its command runner. Run commands inside the Nix dev shell (`nix develop`) so your tools match CI. `just check` and `just fix` refuse to run outside it; set -`MOQ_ALLOW_HOST=1` to use the host toolchain anyway. +`ALLOW_HOST_TOOLCHAIN=1` to use the host toolchain anyway. | Command | Purpose | | --- | --- | diff --git a/doc/setup/upgrade.md b/doc/setup/upgrade.md index 86ad4cce3d1..f04d064eb2d 100644 --- a/doc/setup/upgrade.md +++ b/doc/setup/upgrade.md @@ -19,8 +19,9 @@ wire changes that decide the order to upgrade a deployment. A released flag, environment variable, or config key that was renamed is refused at startup with its replacement named, rather than ignored. Fix what the -error lists and rerun. The one exception is moq-cli's removed `MOQ_HOP`, which is -ignored; its guide says what replaces it. +error lists and rerun. Any other `MOQ_*` variable a binary does not read, such as +moq-cli's removed `MOQ_HOP`, is refused at startup too; its guide says what +replaces it. ## Migration guides diff --git a/flake.nix b/flake.nix index 2882faf1700..11a3c9b126a 100644 --- a/flake.nix +++ b/flake.nix @@ -285,7 +285,7 @@ ]; # Linters / formatters used by `just check` and `just fix`, which - # skip a module whose tools aren't on $PATH. CI sets MOQ_STRICT=1, + # skip a module whose tools aren't on $PATH. CI sets CI_STRICT=1, # which turns that skip into an error (see the tools map in # sh/dispatch.sh), so this list and that one have to stay in step. lintDeps = with pkgs; [ @@ -390,7 +390,7 @@ # uniffi-bindgen-cpp renders rs/moq-ffi for cpp/moq's CMake build. Not in # nixpkgs, so build it from source; without it `just check` skips the - # cpp module, which MOQ_STRICT turns into a failure in CI. + # cpp module, which CI_STRICT turns into a failure in CI. # # Like uniffi-bindgen-go, the tag pairs the generator's version with the # uniffi release it reads, so it moves with the `uniffi` dependency in @@ -643,7 +643,7 @@ env = { # What sh/dispatch.sh checks before a scoped `just check` or `just # fix`. IN_NIX_SHELL would also pass inside another project's shell. - MOQ_DEV_SHELL = "1"; + IN_MOQ_DEV_SHELL = "1"; PLAYWRIGHT_BROWSERS_PATH = "${pkgs.playwright-driver.browsers}"; PLAYWRIGHT_VERSION = pkgs.playwright-driver.version; diff --git a/justfile b/justfile index e7c51037ea6..2ba999639c6 100644 --- a/justfile +++ b/justfile @@ -69,17 +69,17 @@ bench-audio: # io_uring workers; WORKERS defaults to every logical CPU. # Example: `just bench-runtime 5 16`. bench-runtime $ROUNDS="3" $WORKERS="": - MOQ_BENCH_RUNTIME_ROUNDS="$ROUNDS" MOQ_BENCH_RUNTIME_WORKERS="$WORKERS" bench/run.sh --runtime + BENCH_RUNTIME_ROUNDS="$ROUNDS" BENCH_RUNTIME_WORKERS="$WORKERS" bench/run.sh --runtime # Sweep the relay's QUIC shard count against room and fanout connection counts; # 0 shards is the shared runtime. Example: `just bench-shard "0 1 8" "64 512"`. bench-shard $SHARDS="0 1 4 16" $CONNECTIONS="16 64 256": - MOQ_BENCH_SHARD_COUNTS="$SHARDS" MOQ_BENCH_SHARD_CONNECTIONS="$CONNECTIONS" bench/run.sh --shard + BENCH_SHARD_COUNTS="$SHARDS" BENCH_SHARD_CONNECTIONS="$CONNECTIONS" bench/run.sh --shard # Profile the relay at each worker count: std mutex waits by stack (lock), CPU # stacks (cpu), or jemalloc heap and churn (heap). Example: `just bench-profile "cpu heap" fanout-heavy 4`. bench-profile $MODES $WORKLOAD="fanout" $WORKERS="1 4 16": - MOQ_BENCH_PROFILE="$MODES" MOQ_BENCH_PROFILE_WORKLOAD="$WORKLOAD" MOQ_BENCH_PROFILE_WORKERS="$WORKERS" bench/run.sh --profile + BENCH_PROFILE_MODES="$MODES" BENCH_PROFILE_WORKLOAD="$WORKLOAD" BENCH_PROFILE_WORKERS="$WORKERS" bench/run.sh --profile # Real-browser transport, CMAF, and publish/watch costs, optionally against a base: # `just bench-browser origin/main`. `--smoke` is the bounded correctness lane. @@ -104,11 +104,11 @@ check $BASE="": # The merge queue runs this gate in one job. The test build also enforces # default-feature clippy; distinct feature permutations and optimized binding -# builds run nightly and on release PRs. Missing tools fail under MOQ_STRICT. +# builds run nightly and on release PRs. Missing tools fail under CI_STRICT. # Run the merge queue's Linux gate over the branch diff against BASE. ci $BASE="": - MOQ_STRICT=1 NEXTEST_PROFILE=ci sh/dispatch.sh ci "$BASE" + CI_STRICT=1 NEXTEST_PROFILE=ci sh/dispatch.sh ci "$BASE" # Run the queue's Linux gate over every package. gate: diff --git a/quest/m0/ci/ffi-lane.md b/quest/m0/ci/ffi-lane.md index 7b82ee8d6f7..037b9a36d35 100644 --- a/quest/m0/ci/ffi-lane.md +++ b/quest/m0/ci/ffi-lane.md @@ -27,7 +27,7 @@ than measure first or drop py's test features. cdylib, which then finds it fresh, so concurrent lanes never rebuild the shared output while another reads it. Give carla its own venv. Keep cpp and obs_compile in one lane. Every other binding becomes its own lane under - `MOQ_CHECK_JOBS`. + `CHECK_JOBS`. - dart keeps running alone: its build hook checks the filtered build stays fresh, which any concurrent Cargo build of moq-ffi would break. - Measure the full-run wall time and peak disk before and after on matched diff --git a/quest/m1/README.md b/quest/m1/README.md index 9af793212e9..779b4a94334 100644 --- a/quest/m1/README.md +++ b/quest/m1/README.md @@ -168,7 +168,6 @@ Catalog HLS field. - [Image hardening](/quest/m1/image-hardening.md) - the relay image runs unprivileged and its builder stage is pinned - [Binding peer version](/quest/m1/binding-peer-version.md) - every binding names itself ahead of the Rust core in the SETUP Implementation parameter - [Calibrate the paired nightly benchmarks](/quest/m1/bench-ci.md) - A/A and deliberately slowed Nightly runs set the paired comparison's threshold, so its regression alerts can be trusted -- [Refuse unknown MOQ_* environment variables](/quest/m1/env-unknown.md) - every binary exits at startup naming a `MOQ_*` variable it does not read - [HLS export tests over a session](/quest/m1/hls-session-tests.md) - an integration suite records and serves through a real moq-net session, so a publisher disconnect, finish, or takeover ends the cursor and playlists as specified - [HLS recorder in the CLI](/quest/m1/hls-record-cli.md) - `export hls --output ` records playlists and segments to a directory - [HLS and DASH segment conformance](/quest/m1/hls-conformance.md) - nightly ffprobe checks that advertised timing, sync flags, and bytes match the media served diff --git a/quest/m1/bench-ci.md b/quest/m1/bench-ci.md index c40eaa0d119..bd76c349318 100644 --- a/quest/m1/bench-ci.md +++ b/quest/m1/bench-ci.md @@ -21,7 +21,7 @@ lands; agents never dispatch Nightly. one cheap bench (so tonight's `main` reads as slower), and check the job fails with that case alone. - Tune `THRESHOLD_PCT`, `CONFIRMATIONS` (`bench/compare.py`) and the round count - (`MOQ_BENCH_RUNTIME_ROUNDS`, default three) from what the runs show, and + (`BENCH_RUNTIME_ROUNDS`, default three) from what the runs show, and update the README's numbers. Bimodal series (about 50% up and back across nights) are the expected false positives; three alternating rounds pass one only when all three land on the slow mode. diff --git a/quest/m1/env-unknown.md b/quest/m1/env-unknown.md deleted file mode 100644 index a414cee666e..00000000000 --- a/quest/m1/env-unknown.md +++ /dev/null @@ -1,31 +0,0 @@ -# [S] Refuse unknown MOQ_* environment variables - -## Goal - -Every binary that reads `MOQ_*` variables (`moq-relay`, `moq`, `moq-bench`, -`moq-boy`) exits at startup, naming the variable, when the environment holds -a `MOQ_*` variable the binary does not read. A deployment (Docker, systemd, -NixOS) that sets a stale or misspelled name fails loudly instead of silently -running on defaults. - -## Plan - -Decided 2026-10-23 (maintainer interview): - -- Every binary, as an error. A shell holding one tool's `MOQ_*` variables - while running another trips it; that is accepted. -- One helper in `moq_tokio::cli` compares the environment's `MOQ_*` names - with those the binary's usage spec declares, plus any it reads directly, - and each binary calls it after parsing. It scans `std::env::vars_os()`, - since `vars()` panics on any non-UTF-8 entry, even an unrelated one. - usage-rs has no unknown-env check yet; - [the upstream option](/quest/m2/usage-unknown-env.md) replaces this helper - once released. -- Turns the nix module's unit-test guard from - [moq-dev/moq#6474](https://github.com/moq-dev/moq/pull/6474) into a check - every deployment hits. Note the new startup error in `doc/bin/relay/` and - `doc/bin/cli.md`. - -## Related - -- [Upstream unknown-env option](/quest/m2/usage-unknown-env.md) - replaces the helper diff --git a/quest/m1/release-perf/README.md b/quest/m1/release-perf/README.md index 1205f1818a5..c9619d210fc 100644 --- a/quest/m1/release-perf/README.md +++ b/quest/m1/release-perf/README.md @@ -159,7 +159,7 @@ A/A of 3 to 8% on the same host. Decided 2026-10-23 (maintainer): browser parity accepted on this evidence; the final re-run above checks it again. The raw report lived in a scratch directory that has since been removed. -`just bench ` now pairs full Criterion IDs; point `MOQ_BENCH_ARTIFACTS` +`just bench ` now pairs full Criterion IDs; point `BENCH_ARTIFACTS` outside the worktree to keep the next one. ## Related diff --git a/quest/m2/audit-interop.md b/quest/m2/audit-interop.md index 2f6a4150635..1f37bc8c5c8 100644 --- a/quest/m2/audit-interop.md +++ b/quest/m2/audit-interop.md @@ -42,7 +42,7 @@ Decided with the maintainer on 2026-10-21: Both reports run published packages, so a fix turns green only after it ships. Verify from `main` instead. For our clients through a third-party -relay, `MOQ_BIN=target/debug/moq just relays --only --publishers rust +relay, `CLI_BIN=target/debug/moq just relays --only --publishers rust --subscribers rust` from `test/smoke`. For a third-party client through our relay, run its published runner image (`RELAY_URL`, `TLS_DISABLE_VERIFY=1`, `TESTCASE`) on the host network against a `moq-relay` built from `main`. diff --git a/quest/m2/bench-base-paired.md b/quest/m2/bench-base-paired.md index eeb36707b3f..d918a773a6e 100644 --- a/quest/m2/bench-base-paired.md +++ b/quest/m2/bench-base-paired.md @@ -8,7 +8,7 @@ the nightly uses, and the old per-case comparison is deleted. ## Plan [moq-dev/moq#6511](https://github.com/moq-dev/moq/pull/6511) added the paired -path (`--criterion` with `MOQ_BENCH_BASE`, writing `paired.json`). The BASE +path (`--criterion` with `BENCH_BASE`, writing `paired.json`). The BASE mode in `bench/run.sh` still goes through `compare_criterion`. Route it through the paired path, and delete `criterion_cases`, `compare_criterion`, `report_set_changes`, and `--criterion-baseline`. That also deletes the diff --git a/quest/m2/usage-unknown-env.md b/quest/m2/usage-unknown-env.md index c716a0142fc..79d73af0648 100644 --- a/quest/m2/usage-unknown-env.md +++ b/quest/m2/usage-unknown-env.md @@ -5,8 +5,8 @@ usage-rs ([jdx/usage](https://github.com/jdx/usage)) can refuse unknown environment variables under a prefix, the way `unknown_flags = "error"` refuses unknown flags. Once a release ships it, bump usage-rs and replace -the `moq_tokio::cli` helper from [the env check](/quest/m1/env-unknown.md) -with the option. +`moq_tokio::cli::check_env` with the option. The option needs a way to +accept names read outside the spec, such as `moq_video::ENV`. ## Plan @@ -14,7 +14,3 @@ Decided 2026-10-23 (maintainer interview): the maintainer approved posting an issue or PR on jdx/usage for this. Waiting on jdx/usage is the condition: check the upstream issue or PR and its releases; delete this quest if upstream declines, keeping the helper. - -## Required - -- [Refuse unknown MOQ_* environment variables](/quest/m1/env-unknown.md) - ships the helper this replaces diff --git a/quest/m2/v4l2-virtual-camera.md b/quest/m2/v4l2-virtual-camera.md index efc2fa90244..8050438d3b3 100644 --- a/quest/m2/v4l2-virtual-camera.md +++ b/quest/m2/v4l2-virtual-camera.md @@ -21,7 +21,7 @@ developer's camera. name rather than a fixed `/dev/videoN`: enumerate formats and frame sizes, stream a few frames in a raw format and in MJPEG, assert their size and count, then close and reopen. Select them with a `just rs v4l2` recipe. -- A missing device fails under `MOQ_STRICT`, the convention the io_uring and +- A missing device fails under `CI_STRICT`, the convention the io_uring and mDNS tests use, and skips otherwise. - Nightly only: loading a kernel module is a runner mutation no pull request job should make. diff --git a/rs/justfile b/rs/justfile index c502967f2aa..066427854e7 100644 --- a/rs/justfile +++ b/rs/justfile @@ -114,7 +114,7 @@ uring-changed base="": bash sh/rs/select.sh uring "$changed" # Compile and test the io_uring relay path, which is off the default feature set. -# Linux-only; MOQ_STRICT requires a supported kernel instead of skipping tests. +# Linux-only; CI_STRICT requires a supported kernel instead of skipping tests. [positional-arguments] uring *args: just rs uring-check "$@" @@ -360,7 +360,7 @@ multicast: just rs test -p moq-tokio --features mdns --lib --run-ignored only -E 'test(=mdns::tests::apps_partition_discovery) | test(/^mdns::tests::daemon_/)' just rs test -p moq-relay --features cluster-lan --run-ignored only -E 'test(/^lan_mesh::/)' -# Run the long TS recovery arms; a failing arm keeps its export and ledgers under $MOQ_TEST_RUNS. +# Run the long TS recovery arms; a failing arm keeps its export and ledgers under $HARNESS_RUNS. ts-recovery: just rs test -p moq-mux --lib --run-ignored only -E 'test(/^container::ts::recovery_test::long_/)' diff --git a/rs/moq-bench/src/config.rs b/rs/moq-bench/src/config.rs index c4f3ecc75fd..8558c2a890f 100644 --- a/rs/moq-bench/src/config.rs +++ b/rs/moq-bench/src/config.rs @@ -137,7 +137,8 @@ impl Default for Config { } impl Config { - /// Parse from CLI args, optionally merging a TOML file, then init the logger. + /// Parse from CLI args, optionally merging a TOML file, refuse any `MOQ_*` + /// variable moq-bench does not read, then init the logger. pub fn load() -> anyhow::Result { let args: Vec = std::env::args_os().collect(); // `#[usage(completion)]` installs the `__complete_word__` interception in the @@ -149,6 +150,7 @@ impl Config { std::process::exit(0); } let config = Self::parse_and_merge(args)?; + moq_tokio::cli::check_env(&[Self::spec()], &[])?; config.log.init()?; tracing::trace!(?config, "final config"); Ok(config) diff --git a/rs/moq-boy/MIGRATE.md b/rs/moq-boy/MIGRATE.md index b2f353dab50..4767d3c405c 100644 --- a/rs/moq-boy/MIGRATE.md +++ b/rs/moq-boy/MIGRATE.md @@ -4,6 +4,11 @@ How to update your invocation and config for each breaking change, newest first. ## Unreleased +### Unknown `MOQ_*` environment variables stop startup ([#6633](https://github.com/moq-dev/moq/pull/6633)) + +A `MOQ_*` variable moq-boy does not read, such as a misspelling, a removed name, or one meant for another binary, now stops startup with the variable named instead of being ignored. +Remove or rename what the error lists. + ### Key logging is opt-in (#5907) `SSLKEYLOGFILE` alone no longer writes TLS session secrets. diff --git a/rs/moq-boy/src/main.rs b/rs/moq-boy/src/main.rs index 08184dfd4a6..4bfe16699f2 100644 --- a/rs/moq-boy/src/main.rs +++ b/rs/moq-boy/src/main.rs @@ -482,6 +482,7 @@ async fn main() -> Result<()> { let config = Config::parse(); config.log.init()?; config.check_deprecated()?; + moq_tokio::cli::check_env(&[Config::spec()], &[])?; #[cfg(feature = "jemalloc")] let jemalloc = moq_tokio::jemalloc::run(); diff --git a/rs/moq-cli/MIGRATE.md b/rs/moq-cli/MIGRATE.md index 84620196579..1cc6e744273 100644 --- a/rs/moq-cli/MIGRATE.md +++ b/rs/moq-cli/MIGRATE.md @@ -4,6 +4,11 @@ How to update your invocation and config for each breaking change, newest first. ## Unreleased +### Unknown `MOQ_*` environment variables stop startup ([#6633](https://github.com/moq-dev/moq/pull/6633)) + +A `MOQ_*` variable `moq` does not read, such as a misspelling, a removed name, or one meant for another binary, now stops startup with the variable named instead of being ignored. +Remove or rename what the error lists. + ### `import --linger` sets how long a finished broadcast stays up A cleanly ended import used to stay up for its `--max-age`; it now stays up for `--linger` (default 30 s), counted from the end, and `--max-age` only sets retention. diff --git a/rs/moq-cli/src/args.rs b/rs/moq-cli/src/args.rs index 177f1450757..bd141019e16 100644 --- a/rs/moq-cli/src/args.rs +++ b/rs/moq-cli/src/args.rs @@ -154,6 +154,12 @@ impl std::fmt::Display for ParseError { impl std::error::Error for ParseError {} +/// The `MOQ_*` variables read outside the command-line spec. +#[cfg(any(feature = "capture", feature = "transcode", feature = "play"))] +const DIRECT_ENV: &[&str] = moq_video::ENV; +#[cfg(not(any(feature = "capture", feature = "transcode", feature = "play")))] +const DIRECT_ENV: &[&str] = &[]; + /// Whether `flag` is one of the flags `T` declares. fn owns(flag: &usage_rs::Flag<'_>) -> bool { T::COMMAND.flags.iter().any(|own| own.key == flag.key) @@ -174,7 +180,13 @@ impl Invocation { print!("{reply}"); std::process::exit(0); } - match Self::try_parse_from(args) { + match Self::try_parse_from(args).and_then(|parsed| { + // Here rather than in `try_parse_from`, which tests drive under whatever + // environment the test runner has. + moq_tokio::cli::check_env(&[Cli::spec(), Stage::spec()], DIRECT_ENV) + .map_err(|err| ParseError::new(ParseErrorKind::ValueValidation, format!("error: {err}\n")))?; + Ok(parsed) + }) { Ok(parsed) => parsed, Err(err) => err.exit(), } diff --git a/rs/moq-mux/src/container/ts/recovery_test.rs b/rs/moq-mux/src/container/ts/recovery_test.rs index 706ce7c4dca..ac590f70129 100644 --- a/rs/moq-mux/src/container/ts/recovery_test.rs +++ b/rs/moq-mux/src/container/ts/recovery_test.rs @@ -1250,13 +1250,13 @@ fn segments<'a>(ts: &[u8], video: &'a Ledger, pids: (u16, u16)) -> Result); impl Evidence { fn save(run: &Run) -> Self { - let Some(root) = std::env::var_os("MOQ_TEST_RUNS") else { + let Some(root) = std::env::var_os("HARNESS_RUNS") else { return Self(None); }; // libtest names each test's thread after it; a test run on the main thread has its process. @@ -1277,7 +1277,7 @@ impl Drop for Evidence { fn drop(&mut self) { if let Some(dir) = &self.0 && !std::thread::panicking() - && std::env::var_os("MOQ_TEST_KEEP").is_none() + && std::env::var_os("HARNESS_KEEP").is_none() { let _ = std::fs::remove_dir_all(dir); } diff --git a/rs/moq-relay/MIGRATE.md b/rs/moq-relay/MIGRATE.md index bbff7c893fc..eb70d4d2f78 100644 --- a/rs/moq-relay/MIGRATE.md +++ b/rs/moq-relay/MIGRATE.md @@ -5,6 +5,11 @@ Rolling a cluster across a release also follows the [upgrade guide](https://moq. ## Unreleased +### Unknown `MOQ_*` environment variables stop startup ([#6633](https://github.com/moq-dev/moq/pull/6633)) + +A `MOQ_*` variable moq-relay does not read, such as a misspelling, a removed name, or one meant for another binary, now stops startup with the variable named instead of being ignored. +Remove or rename what the error lists. + ### Auth `server_name` is the SNI only (#6509) The auth request's `server_name` no longer falls back to the HTTP `Host` header, `:authority`, or the WebTransport CONNECT host: it is absent over plain `http://` and `ws://` and for an IP-literal dial, while HTTPS and `wss://` report the SNI. diff --git a/rs/moq-relay/src/config.rs b/rs/moq-relay/src/config.rs index e39bec088fb..f2f0315e62b 100644 --- a/rs/moq-relay/src/config.rs +++ b/rs/moq-relay/src/config.rs @@ -187,8 +187,8 @@ impl Config { } /// Parses configuration from CLI arguments, optionally merging with a - /// TOML file specified via the positional `file` argument. Also initializes - /// the logger. + /// TOML file specified via the positional `file` argument, and refuses any + /// `MOQ_*` variable the relay does not read. Also initializes the logger. pub fn load() -> anyhow::Result { let args: Vec = std::env::args_os().collect(); // `#[usage(completion)]` installs the `__complete_word__` interception in the @@ -200,6 +200,7 @@ impl Config { std::process::exit(0); } let config = Self::parse_and_merge(args)?; + moq_tokio::cli::check_env(&[Cli::spec()], &[])?; config.log.init()?; tracing::trace!(?config, "final config"); Ok(config) @@ -1137,8 +1138,8 @@ ws = false assert!(drift.is_empty(), "{drift:#?}"); } - /// The relay ignores a `MOQ_*` variable it doesn't know, so a stale name in the - /// NixOS module would silently drop that setting. + /// The relay refuses to start on a `MOQ_*` variable it doesn't read, so a stale + /// name in the NixOS module would stop every NixOS relay; catch it here first. #[test] fn the_nixos_module_sets_only_known_variables() { let path = concat!(env!("CARGO_MANIFEST_DIR"), "/../../nix/modules/moq-relay.nix"); diff --git a/rs/moq-relay/src/uring.rs b/rs/moq-relay/src/uring.rs index 0b13b00f9d0..ef7098c01c6 100644 --- a/rs/moq-relay/src/uring.rs +++ b/rs/moq-relay/src/uring.rs @@ -1017,7 +1017,7 @@ mod tests { async fn a_group_stopped_before_serving_joins() { let _ = rustls::crypto::aws_lc_rs::default_provider().install_default(); if let Err(moq_uring::Error::Unsupported(reason)) = moq_uring::Worker::new(Default::default()) - && std::env::var_os("MOQ_STRICT").is_none() + && std::env::var_os("CI_STRICT").is_none() { eprintln!("skipping io_uring relay test: {reason}"); return; @@ -1044,7 +1044,7 @@ mod tests { async fn pending_admission_is_abandoned_at_the_deadline() { let _ = rustls::crypto::aws_lc_rs::default_provider().install_default(); if let Err(moq_uring::Error::Unsupported(reason)) = moq_uring::Worker::new(Default::default()) - && std::env::var_os("MOQ_STRICT").is_none() + && std::env::var_os("CI_STRICT").is_none() { eprintln!("skipping io_uring relay test: {reason}"); return; @@ -1101,7 +1101,7 @@ mod tests { async fn pending_admission_is_abandoned_at_the_handshake_deadline() { let _ = rustls::crypto::aws_lc_rs::default_provider().install_default(); if let Err(moq_uring::Error::Unsupported(reason)) = moq_uring::Worker::new(Default::default()) - && std::env::var_os("MOQ_STRICT").is_none() + && std::env::var_os("CI_STRICT").is_none() { eprintln!("skipping io_uring relay test: {reason}"); return; diff --git a/rs/moq-relay/tests/integration/embed.rs b/rs/moq-relay/tests/integration/embed.rs index e4394add545..c40d96800dc 100644 --- a/rs/moq-relay/tests/integration/embed.rs +++ b/rs/moq-relay/tests/integration/embed.rs @@ -402,13 +402,13 @@ async fn worker_tokio_custom_route_and_quic() { } /// io_uring workers. Off the default feature set; `just rs uring` and nightly -/// `--all-features` compile it. Skips below the 6.12 floor unless MOQ_STRICT. +/// `--all-features` compile it. Skips below the 6.12 floor unless CI_STRICT. #[cfg(all(target_os = "linux", feature = "_uring"))] #[tokio::test] async fn uring_custom_route_and_quic() { match moq_uring::Worker::new(Default::default()) { Ok(_) => {} - Err(moq_uring::Error::Unsupported(reason)) if std::env::var_os("MOQ_STRICT").is_none() => { + Err(moq_uring::Error::Unsupported(reason)) if std::env::var_os("CI_STRICT").is_none() => { eprintln!("skipping io_uring embed test: {reason}"); return; } diff --git a/rs/moq-relay/tests/integration/lan_mesh.rs b/rs/moq-relay/tests/integration/lan_mesh.rs index 245eb8d7f5c..65aedb41bae 100644 --- a/rs/moq-relay/tests/integration/lan_mesh.rs +++ b/rs/moq-relay/tests/integration/lan_mesh.rs @@ -22,7 +22,7 @@ use moq_relay::cluster; /// Two clusters that can advertise (fingerprint + node) start without a secret. /// Binding mDNS is the recipe's gate; skip when the host cannot announce, -/// unless MOQ_STRICT makes that a failure. +/// unless CI_STRICT makes that a failure. #[tokio::test] #[ignore = "needs multicast on the host network; run by just rs multicast"] async fn moq_import_cluster_lan_beside_a_relay() { @@ -57,7 +57,7 @@ async fn moq_import_cluster_lan_beside_a_relay() { match tokio::time::timeout(Duration::from_secs(10), cluster.start()).await { Ok(Ok(_)) => {} Ok(Err(err)) - if format!("{err:#}").contains("no network interface") && std::env::var_os("MOQ_STRICT").is_none() => + if format!("{err:#}").contains("no network interface") && std::env::var_os("CI_STRICT").is_none() => { eprintln!("skipping: {err:#}"); } diff --git a/rs/moq-relay/tests/integration/peer_limits.rs b/rs/moq-relay/tests/integration/peer_limits.rs index b77ff9ab159..6c20afb2f3d 100644 --- a/rs/moq-relay/tests/integration/peer_limits.rs +++ b/rs/moq-relay/tests/integration/peer_limits.rs @@ -335,7 +335,7 @@ async fn uring_peer_session_widens_quic_limits() { let _ = rustls::crypto::aws_lc_rs::default_provider().install_default(); match moq_uring::Worker::new(Default::default()) { Ok(_) => {} - Err(moq_uring::Error::Unsupported(reason)) if std::env::var_os("MOQ_STRICT").is_none() => { + Err(moq_uring::Error::Unsupported(reason)) if std::env::var_os("CI_STRICT").is_none() => { eprintln!("skipping io_uring relay test: {reason}"); return; } diff --git a/rs/moq-relay/tests/integration/runtime_uring.rs b/rs/moq-relay/tests/integration/runtime_uring.rs index f586b950e30..499e1fc18dd 100644 --- a/rs/moq-relay/tests/integration/runtime_uring.rs +++ b/rs/moq-relay/tests/integration/runtime_uring.rs @@ -4,7 +4,7 @@ //! runtime and the frame crossing worker threads through the shared origin. //! //! Linux-only like the mode itself. Unsupported local kernels skip loudly; -//! MOQ_STRICT makes CI refuse them. +//! CI_STRICT makes CI refuse them. #![cfg(all(target_os = "linux", feature = "_uring"))] use std::net::SocketAddr; @@ -27,7 +27,7 @@ fn timed() -> moq_net::track::Info { fn supported() -> bool { match moq_uring::Worker::new(Default::default()) { Ok(_) => true, - Err(moq_uring::Error::Unsupported(reason)) if std::env::var_os("MOQ_STRICT").is_none() => { + Err(moq_uring::Error::Unsupported(reason)) if std::env::var_os("CI_STRICT").is_none() => { eprintln!("skipping io_uring relay test: {reason}"); false } diff --git a/rs/moq-relay/tests/integration/wire_stats.rs b/rs/moq-relay/tests/integration/wire_stats.rs index b29e9984e42..a112db366f2 100644 --- a/rs/moq-relay/tests/integration/wire_stats.rs +++ b/rs/moq-relay/tests/integration/wire_stats.rs @@ -134,7 +134,7 @@ async fn native_sessions_supply_direct_wire_counters() { async fn uring_sessions_supply_direct_wire_counters() { match moq_uring::Worker::new(Default::default()) { Ok(_) => (), - Err(moq_uring::Error::Unsupported(reason)) if std::env::var_os("MOQ_STRICT").is_none() => { + Err(moq_uring::Error::Unsupported(reason)) if std::env::var_os("CI_STRICT").is_none() => { eprintln!("skipping io_uring wire stats test: {reason}"); return; } diff --git a/rs/moq-tokio/src/cli.rs b/rs/moq-tokio/src/cli.rs index f5cd2ef8354..bf0c8286236 100644 --- a/rs/moq-tokio/src/cli.rs +++ b/rs/moq-tokio/src/cli.rs @@ -6,11 +6,13 @@ //! never reaches that code, so it has to answer them itself. Both shapes exist here: //! a TOML merge that layers CLI, env, and file with recorded provenance, and //! moq-cli's repeated `--` stage grammar. [`Duration`] parses the human-readable -//! values used by those flags and TOML keys. +//! values used by those flags and TOML keys, and [`check_env`] refuses `MOQ_*` +//! variables a binary does not read. #[path = "deprecated.rs"] mod deprecated; pub(crate) mod duration; +mod env; use std::collections::HashSet; use std::ffi::OsStr; @@ -25,6 +27,7 @@ use usage_rs::config::{ pub use deprecated::Deprecated; pub use duration::Duration; +pub use env::{UnknownEnv, check_env}; /// Re-exported because [`Merge`] and [`answer`] use Usage types in their APIs. pub use usage_rs; diff --git a/rs/moq-tokio/src/cli/env.rs b/rs/moq-tokio/src/cli/env.rs new file mode 100644 index 00000000000..5dacfd043d1 --- /dev/null +++ b/rs/moq-tokio/src/cli/env.rs @@ -0,0 +1,170 @@ +//! Refusing `MOQ_*` environment variables a binary does not read. + +use std::collections::HashSet; +use std::ffi::OsString; + +use usage_rs::argv::spec::{ArgMeta, CommandMeta, FlagMeta, Spec}; + +/// The prefix every MoQ binary's environment variables share. +const PREFIX: &str = "MOQ_"; + +/// `MOQ_*` environment variables that nothing in the binary reads. +/// +/// Returned by [`check_env`]. The [`std::fmt::Display`] names each one. +#[derive(Clone, Debug)] +pub struct UnknownEnv(Vec); + +impl std::fmt::Display for UnknownEnv { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!( + f, + "unknown environment variables, which this binary does not read; remove or rename them: {}", + self.0.join(", ") + ) + } +} + +impl std::error::Error for UnknownEnv {} + +/// Refuse every `MOQ_*` variable in the process environment that none of `specs` +/// declares and `direct` does not name. +/// +/// `specs` are the command-line specs the binary parses with, and `direct` the +/// variables it reads outside them. Without this, a deployment that sets a stale or +/// misspelled name runs on defaults without a word. +pub fn check_env<'a>(specs: &[&'a Spec<'a>], direct: &[&'a str]) -> Result<(), UnknownEnv> { + let mut known = HashSet::new(); + for spec in specs { + declared(spec.root, &mut known); + } + known.extend(direct.iter().copied()); + + // `vars_os`, because `vars` panics on any entry that is not UTF-8, even an unrelated one. + let unknown = unknown(std::env::vars_os().map(|(name, _)| name), &known); + if unknown.is_empty() { + Ok(()) + } else { + Err(UnknownEnv(unknown)) + } +} + +/// Every environment variable `meta` and its subcommands declare, including deprecated ones. +fn declared<'a>(meta: &'a CommandMeta<'a>, known: &mut HashSet<&'a str>) { + let flag = |flag: &FlagMeta<'a>| { + flag.env() + .into_iter() + .chain(flag.env_fallback().iter().copied()) + .chain(flag.deprecated_env().iter().copied()) + }; + let arg = |arg: &ArgMeta<'a>| { + arg.env() + .into_iter() + .chain(arg.env_fallback().iter().copied()) + .chain(arg.deprecated_env().iter().copied()) + }; + + known.extend(meta.flags().iter().flat_map(flag)); + known.extend(meta.args().iter().flat_map(arg)); + if let Some(clause) = meta.clause() { + known.extend(clause.flags.iter().flat_map(flag)); + known.extend(clause.args.iter().flat_map(arg)); + } + for sub in meta.subcommands() { + declared(sub, known); + } +} + +/// The `MOQ_*` names in `names` that `known` lacks, sorted and deduplicated. +fn unknown(names: impl IntoIterator, known: &HashSet<&str>) -> Vec { + let mut unknown: Vec = names + .into_iter() + .map(|name| { + let name = name.to_string_lossy().into_owned(); + // Windows matches variable names case-insensitively, so `moq_connect` + // sets `MOQ_CONNECT` there. + if cfg!(windows) { name.to_ascii_uppercase() } else { name } + }) + .filter(|name| name.starts_with(PREFIX) && !known.contains(name.as_str())) + .collect(); + unknown.sort(); + unknown.dedup(); + unknown +} + +#[cfg(test)] +mod tests { + use super::*; + + #[allow(dead_code, reason = "only the derived spec is read")] + #[derive(usage_rs::Args)] + struct Shared { + /// Declared by a flattened section. + #[usage(long, env = "MOQ_SHARED")] + shared: Option, + + /// A released spelling, still declared so it can be reported. + #[usage(long, env = "MOQ_RELEASED", hide)] + released: Option, + } + + #[allow(dead_code, reason = "only the derived spec is read")] + #[derive(usage_rs::Cli)] + #[usage(unknown_flags = "error")] + struct Cli { + #[usage(flatten)] + shared: Shared, + + #[usage(subcommand)] + command: Command, + } + + #[allow(dead_code, reason = "only the derived spec is read")] + #[derive(usage_rs::Subcommands)] + enum Command { + /// Declares a variable only under a subcommand. + Run { + #[usage(long, env = "MOQ_RUN")] + run: Option, + }, + } + + fn known() -> HashSet<&'static str> { + let mut known = HashSet::new(); + declared(Cli::spec().root, &mut known); + known + } + + fn names(names: &[&str]) -> Vec { + names.iter().map(OsString::from).collect() + } + + /// Flattened, hidden, and subcommand variables all count as read. + #[test] + fn declared_reaches_every_section() { + let known = known(); + for name in ["MOQ_SHARED", "MOQ_RELEASED", "MOQ_RUN"] { + assert!(known.contains(name), "{name} is declared"); + } + } + + /// Only `MOQ_*` names are checked, and each is reported once, sorted. + #[test] + fn unknown_names_only_moq() { + let found = unknown( + names(&["MOQ_SHARED", "PATH", "MOQ_TYPO", "MOQ", "MOQ_RUN", "MOQ_A", "MOQ_TYPO"]), + &known(), + ); + assert_eq!(found, ["MOQ_A", "MOQ_TYPO"]); + } + + /// A name that is not UTF-8 is still refused, rather than panicking or slipping past. + #[cfg(unix)] + #[test] + fn unknown_non_utf8() { + use std::os::unix::ffi::OsStringExt; + + let found = unknown([OsString::from_vec(b"MOQ_\xff".to_vec())], &known()); + assert_eq!(found, ["MOQ_\u{fffd}"]); + assert!(unknown([OsString::from_vec(b"OTHER_\xff".to_vec())], &known()).is_empty()); + } +} diff --git a/rs/moq-tokio/src/mdns.rs b/rs/moq-tokio/src/mdns.rs index 4abb47b7c36..947fe09694c 100644 --- a/rs/moq-tokio/src/mdns.rs +++ b/rs/moq-tokio/src/mdns.rs @@ -1344,14 +1344,14 @@ mod tests { /// /// Ignored because it multicasts on the host network; nightly runs it with /// `just rs multicast`. A host where no interface can announce skips, unless - /// MOQ_STRICT makes that a failure. + /// CI_STRICT makes that a failure. #[tokio::test] #[ignore = "needs multicast on the host network; run by just rs multicast"] async fn apps_partition_discovery() { let shared = unique_app(); let mut same_a = match discovery(shared.clone(), Some(KEY_A), "same-a").await { Ok(discovery) => discovery, - Err(err) if no_multicast(&err) && std::env::var_os("MOQ_STRICT").is_none() => { + Err(err) if no_multicast(&err) && std::env::var_os("CI_STRICT").is_none() => { eprintln!("skipping: {err}"); return; } diff --git a/rs/moq-uring/README.md b/rs/moq-uring/README.md index 0c4337111e3..3d63c91aa1b 100644 --- a/rs/moq-uring/README.md +++ b/rs/moq-uring/README.md @@ -106,7 +106,7 @@ steered two-worker reuseport group serving one port across threads, and datagram echo through the H3 framing, close codes through the capsule, and a full moq-lite session over WebTransport. All of them skip (loudly) below the kernel floor. CI runs them -on `ubuntu-24.04-arm`, whose kernel clears it, with `MOQ_STRICT=1` refusing a +on `ubuntu-24.04-arm`, whose kernel clears it, with `CI_STRICT=1` refusing a skip: in the `uring.yml` release gate and the nightly `rs uring` job. ## Benchmarks diff --git a/rs/moq-uring/src/udp.rs b/rs/moq-uring/src/udp.rs index fb11cb3069a..c3183fa820a 100644 --- a/rs/moq-uring/src/udp.rs +++ b/rs/moq-uring/src/udp.rs @@ -2052,7 +2052,7 @@ mod tests { fn a_failed_send_costs_only_its_packet() { let mut worker = match crate::Worker::new(crate::Config::default()) { Ok(worker) => worker, - Err(Error::Unsupported(reason)) if std::env::var_os("MOQ_STRICT").is_none() => { + Err(Error::Unsupported(reason)) if std::env::var_os("CI_STRICT").is_none() => { eprintln!("skipping io_uring socket test: {reason}"); return; } @@ -2140,7 +2140,7 @@ mod tests { fn a_stale_source_keeps_segmentation() { let mut worker = match crate::Worker::new(crate::Config::default()) { Ok(worker) => worker, - Err(Error::Unsupported(reason)) if std::env::var_os("MOQ_STRICT").is_none() => { + Err(Error::Unsupported(reason)) if std::env::var_os("CI_STRICT").is_none() => { eprintln!("skipping io_uring socket test: {reason}"); return; } @@ -2203,7 +2203,7 @@ mod tests { let mut worker = match crate::Worker::new(crate::Config::default()) { Ok(worker) => worker, - Err(Error::Unsupported(reason)) if std::env::var_os("MOQ_STRICT").is_none() => { + Err(Error::Unsupported(reason)) if std::env::var_os("CI_STRICT").is_none() => { eprintln!("skipping io_uring socket test: {reason}"); return; } diff --git a/rs/moq-uring/src/worker.rs b/rs/moq-uring/src/worker.rs index 124bfa51124..61b0202d0f4 100644 --- a/rs/moq-uring/src/worker.rs +++ b/rs/moq-uring/src/worker.rs @@ -779,7 +779,7 @@ mod tests { } fn worker_with(config: Config) -> Option { - worker_result(Worker::new(config), std::env::var_os("MOQ_STRICT").is_some()) + worker_result(Worker::new(config), std::env::var_os("CI_STRICT").is_some()) } /// A worker on a manual clock, which only `advance` moves. diff --git a/rs/moq-uring/tests/allocations.rs b/rs/moq-uring/tests/allocations.rs index 4c99709e719..3a8b1077044 100644 --- a/rs/moq-uring/tests/allocations.rs +++ b/rs/moq-uring/tests/allocations.rs @@ -1,6 +1,6 @@ //! The worker's UDP send and pump path must not allocate in steady state. //! -//! Unsupported local kernels skip loudly; MOQ_STRICT makes CI refuse them. +//! Unsupported local kernels skip loudly; CI_STRICT makes CI refuse them. #![cfg(target_os = "linux")] @@ -57,7 +57,7 @@ const SENDS: usize = 1_000; fn steady_state_sends_do_not_allocate() { let mut worker = match Worker::new(Config::default()) { Ok(worker) => worker, - Err(Error::Unsupported(reason)) if std::env::var_os("MOQ_STRICT").is_none() => { + Err(Error::Unsupported(reason)) if std::env::var_os("CI_STRICT").is_none() => { eprintln!("skipping io_uring allocation test: {reason}"); return; } diff --git a/rs/moq-uring/tests/integration/credit.rs b/rs/moq-uring/tests/integration/credit.rs index 79d5016616a..58af0cc0c55 100644 --- a/rs/moq-uring/tests/integration/credit.rs +++ b/rs/moq-uring/tests/integration/credit.rs @@ -3,7 +3,7 @@ //! write takes no more from its buffer than the peer's window admits, and a tiny //! frame keeps no more memory than its own bytes. //! -//! Unsupported local kernels skip loudly; MOQ_STRICT makes CI refuse them. +//! Unsupported local kernels skip loudly; CI_STRICT makes CI refuse them. #![cfg(all(target_os = "linux", feature = "quic"))] @@ -25,7 +25,7 @@ const WINDOW: usize = 32 * 1024; fn worker() -> Option { match Worker::new(Config::default()) { Ok(worker) => Some(worker), - Err(Error::Unsupported(reason)) if std::env::var_os("MOQ_STRICT").is_none() => { + Err(Error::Unsupported(reason)) if std::env::var_os("CI_STRICT").is_none() => { eprintln!("skipping io_uring credit test: {reason}"); None } diff --git a/rs/moq-uring/tests/integration/echo.rs b/rs/moq-uring/tests/integration/echo.rs index 10a99e3464f..86ff04c4673 100644 --- a/rs/moq-uring/tests/integration/echo.rs +++ b/rs/moq-uring/tests/integration/echo.rs @@ -14,7 +14,7 @@ const PAYLOAD: usize = 512 * 1024; fn worker() -> Option { match Worker::new(Config::default()) { Ok(worker) => Some(worker), - Err(Error::Unsupported(reason)) if std::env::var_os("MOQ_STRICT").is_none() => { + Err(Error::Unsupported(reason)) if std::env::var_os("CI_STRICT").is_none() => { eprintln!("skipping io_uring echo test: {reason}"); None } diff --git a/rs/moq-uring/tests/integration/ecn.rs b/rs/moq-uring/tests/integration/ecn.rs index 97a8728bcb0..76ec02d252c 100644 --- a/rs/moq-uring/tests/integration/ecn.rs +++ b/rs/moq-uring/tests/integration/ecn.rs @@ -4,7 +4,7 @@ //! traffic-class control messages the peer sees no mark, its ACKs carry no //! ECN counts, and moq-quic disables ECN on the first one. //! -//! Unsupported local kernels skip loudly; MOQ_STRICT makes CI refuse them. +//! Unsupported local kernels skip loudly; CI_STRICT makes CI refuse them. #![cfg(target_os = "linux")] @@ -15,7 +15,7 @@ use moq_uring::{Config, Error, Worker, udp}; fn worker() -> Option { match Worker::new(Config::default()) { Ok(worker) => Some(worker), - Err(Error::Unsupported(reason)) if std::env::var_os("MOQ_STRICT").is_none() => { + Err(Error::Unsupported(reason)) if std::env::var_os("CI_STRICT").is_none() => { eprintln!("skipping io_uring ecn test: {reason}"); None } diff --git a/rs/moq-uring/tests/integration/endpoint.rs b/rs/moq-uring/tests/integration/endpoint.rs index 110c76c3d00..3d8ac6d6261 100644 --- a/rs/moq-uring/tests/integration/endpoint.rs +++ b/rs/moq-uring/tests/integration/endpoint.rs @@ -2,7 +2,7 @@ //! accepting at once, version negotiation, the dial-only refusal, and how a //! close is reported. //! -//! Unsupported local kernels skip loudly; MOQ_STRICT makes CI refuse them. +//! Unsupported local kernels skip loudly; CI_STRICT makes CI refuse them. #![cfg(all(target_os = "linux", feature = "quic"))] @@ -19,7 +19,7 @@ use web_transport_trait::poll::{RecvStream as _, SendStream as _, Session as _}; fn worker() -> Option { match Worker::new(Config::default()) { Ok(worker) => Some(worker), - Err(Error::Unsupported(reason)) if std::env::var_os("MOQ_STRICT").is_none() => { + Err(Error::Unsupported(reason)) if std::env::var_os("CI_STRICT").is_none() => { eprintln!("skipping io_uring endpoint test: {reason}"); None } diff --git a/rs/moq-uring/tests/integration/identity.rs b/rs/moq-uring/tests/integration/identity.rs index 309ad0ddd16..4e206ddb9aa 100644 --- a/rs/moq-uring/tests/integration/identity.rs +++ b/rs/moq-uring/tests/integration/identity.rs @@ -2,7 +2,7 @@ //! endpoint runs where its socket was adopted, whichever handle is in scope, //! and a socket whose worker is gone refuses to start anything. //! -//! Unsupported local kernels skip loudly; MOQ_STRICT makes CI refuse them. +//! Unsupported local kernels skip loudly; CI_STRICT makes CI refuse them. #![cfg(all(target_os = "linux", feature = "quic"))] @@ -17,7 +17,7 @@ use moq_uring::{Config, Error, Worker, quic, udp}; fn worker() -> Option { match Worker::new(Config::default()) { Ok(worker) => Some(worker), - Err(Error::Unsupported(reason)) if std::env::var_os("MOQ_STRICT").is_none() => { + Err(Error::Unsupported(reason)) if std::env::var_os("CI_STRICT").is_none() => { eprintln!("skipping io_uring identity test: {reason}"); None } diff --git a/rs/moq-uring/tests/integration/local_addr.rs b/rs/moq-uring/tests/integration/local_addr.rs index def8f0af8d7..a6f5434a363 100644 --- a/rs/moq-uring/tests/integration/local_addr.rs +++ b/rs/moq-uring/tests/integration/local_addr.rs @@ -6,7 +6,7 @@ //! All of 127/8 is local, so IPv4 reaches `127.0.0.2`. IPv6 has only `::1`, so //! the IPv6 case is ignored by default and `just rs uring` runs it after its CI //! lanes add [`SECOND_V6`] to `lo`; without it the case skips loudly, and -//! MOQ_STRICT makes CI refuse it. +//! CI_STRICT makes CI refuse it. #![cfg(target_os = "linux")] @@ -23,7 +23,7 @@ const SECOND_V6: Ipv6Addr = Ipv6Addr::new(0xfd6d, 0x6f71, 0, 0, 0, 0, 0, 2); const TIMEOUT: Duration = Duration::from_secs(5); fn strict() -> bool { - std::env::var_os("MOQ_STRICT").is_some() + std::env::var_os("CI_STRICT").is_some() } fn worker() -> Option { diff --git a/rs/moq-uring/tests/integration/mtu.rs b/rs/moq-uring/tests/integration/mtu.rs index b03de41da57..2948ef3e190 100644 --- a/rs/moq-uring/tests/integration/mtu.rs +++ b/rs/moq-uring/tests/integration/mtu.rs @@ -7,7 +7,7 @@ //! word, the way a tunnel behind a firewall that eats ICMP does. It crosses //! real sockets, so these run on the wall clock. //! -//! Unsupported local kernels skip loudly; MOQ_STRICT makes CI refuse them. +//! Unsupported local kernels skip loudly; CI_STRICT makes CI refuse them. #![cfg(all(target_os = "linux", feature = "quic"))] @@ -36,7 +36,7 @@ const PAYLOAD: usize = 1 << 20; fn worker() -> Option { match Worker::new(Config::default()) { Ok(worker) => Some(worker), - Err(Error::Unsupported(reason)) if std::env::var_os("MOQ_STRICT").is_none() => { + Err(Error::Unsupported(reason)) if std::env::var_os("CI_STRICT").is_none() => { eprintln!("skipping io_uring MTU test: {reason}"); None } diff --git a/rs/moq-uring/tests/integration/qlog.rs b/rs/moq-uring/tests/integration/qlog.rs index e6f5003a1ab..e8fb3ca898b 100644 --- a/rs/moq-uring/tests/integration/qlog.rs +++ b/rs/moq-uring/tests/integration/qlog.rs @@ -5,7 +5,7 @@ //! actually produces a file for each end of the connection, and every record in it is JSON, so a reader is not handed a truncated or //! interleaved trace. //! -//! Unsupported local kernels skip loudly; MOQ_STRICT makes CI refuse them. +//! Unsupported local kernels skip loudly; CI_STRICT makes CI refuse them. #![cfg(all(target_os = "linux", feature = "qlog", feature = "quic"))] @@ -18,7 +18,7 @@ use moq_uring::{Config, Error, Worker, quic, udp}; fn worker() -> Option { match Worker::new(Config::default()) { Ok(worker) => Some(worker), - Err(Error::Unsupported(reason)) if std::env::var_os("MOQ_STRICT").is_none() => { + Err(Error::Unsupported(reason)) if std::env::var_os("CI_STRICT").is_none() => { eprintln!("skipping io_uring qlog test: {reason}"); None } diff --git a/rs/moq-uring/tests/integration/receive_credit.rs b/rs/moq-uring/tests/integration/receive_credit.rs index 08a3d44272d..adf57a8bd4a 100644 --- a/rs/moq-uring/tests/integration/receive_credit.rs +++ b/rs/moq-uring/tests/integration/receive_credit.rs @@ -8,7 +8,7 @@ //! JavaScript arm serves WebTransport to a Bun publisher; it needs Bun and runs in the //! interop workflow. //! -//! Unsupported local kernels skip loudly; MOQ_STRICT makes CI refuse them. +//! Unsupported local kernels skip loudly; CI_STRICT makes CI refuse them. #![cfg(all(target_os = "linux", feature = "quic"))] @@ -29,7 +29,7 @@ const WINDOW: usize = 256 * 1024; fn worker() -> Option { match Worker::new(Config::default()) { Ok(worker) => Some(worker), - Err(Error::Unsupported(reason)) if std::env::var_os("MOQ_STRICT").is_none() => { + Err(Error::Unsupported(reason)) if std::env::var_os("CI_STRICT").is_none() => { eprintln!("skipping io_uring receive credit test: {reason}"); None } diff --git a/rs/moq-uring/tests/integration/session.rs b/rs/moq-uring/tests/integration/session.rs index 33f060b6ea0..66ae281723b 100644 --- a/rs/moq-uring/tests/integration/session.rs +++ b/rs/moq-uring/tests/integration/session.rs @@ -20,7 +20,7 @@ use moq_uring::{Config, Error, Worker, quic, udp}; fn worker() -> Option { match Worker::new(Config::default()) { Ok(worker) => Some(worker), - Err(Error::Unsupported(reason)) if std::env::var_os("MOQ_STRICT").is_none() => { + Err(Error::Unsupported(reason)) if std::env::var_os("CI_STRICT").is_none() => { eprintln!("skipping io_uring session test: {reason}"); None } diff --git a/rs/moq-uring/tests/integration/teardown.rs b/rs/moq-uring/tests/integration/teardown.rs index ccb1b5d7da4..6dbf1bb8117 100644 --- a/rs/moq-uring/tests/integration/teardown.rs +++ b/rs/moq-uring/tests/integration/teardown.rs @@ -8,7 +8,7 @@ //! datagram, and a QUIC close whose CONNECTION_CLOSE is the last thing a //! one-shot client ever sends. //! -//! Unsupported local kernels skip loudly; MOQ_STRICT makes CI refuse them. +//! Unsupported local kernels skip loudly; CI_STRICT makes CI refuse them. #![cfg(all(target_os = "linux", feature = "quic"))] @@ -27,7 +27,7 @@ const CLOSE_REASON: &str = "done"; fn worker() -> Option { match Worker::new(Config::default()) { Ok(worker) => Some(worker), - Err(Error::Unsupported(reason)) if std::env::var_os("MOQ_STRICT").is_none() => { + Err(Error::Unsupported(reason)) if std::env::var_os("CI_STRICT").is_none() => { eprintln!("skipping io_uring teardown test: {reason}"); None } diff --git a/rs/moq-uring/tests/integration/web.rs b/rs/moq-uring/tests/integration/web.rs index 443991e144d..df295569264 100644 --- a/rs/moq-uring/tests/integration/web.rs +++ b/rs/moq-uring/tests/integration/web.rs @@ -3,7 +3,7 @@ //! streams and datagrams through the H3 framing; the other runs a whole //! moq-lite session over it, which is exactly the browser-to-relay path. //! -//! Unsupported local kernels skip loudly; MOQ_STRICT makes CI refuse them. +//! Unsupported local kernels skip loudly; CI_STRICT makes CI refuse them. #![cfg(all(target_os = "linux", feature = "quic"))] @@ -19,7 +19,7 @@ use web_transport_trait::poll::{RecvStream as _, SendStream as _, Session as _}; fn worker() -> Option { match Worker::new(Config::default()) { Ok(worker) => Some(worker), - Err(Error::Unsupported(reason)) if std::env::var_os("MOQ_STRICT").is_none() => { + Err(Error::Unsupported(reason)) if std::env::var_os("CI_STRICT").is_none() => { eprintln!("skipping io_uring web test: {reason}"); None } diff --git a/rs/moq-uring/tests/integration/workers.rs b/rs/moq-uring/tests/integration/workers.rs index 965da153ef4..9f744873d2c 100644 --- a/rs/moq-uring/tests/integration/workers.rs +++ b/rs/moq-uring/tests/integration/workers.rs @@ -7,7 +7,7 @@ //! continuation included) on that worker; a wrong prefix stalls the //! handshake, so every dial being accepted is what proves the steering. //! -//! Unsupported local kernels skip loudly; MOQ_STRICT makes CI refuse them. +//! Unsupported local kernels skip loudly; CI_STRICT makes CI refuse them. #![cfg(all(target_os = "linux", feature = "quic"))] @@ -23,7 +23,7 @@ use moq_uring::{Config, Error, Worker, quic, udp}; fn worker() -> Option { match Worker::new(Config::default()) { Ok(worker) => Some(worker), - Err(Error::Unsupported(reason)) if std::env::var_os("MOQ_STRICT").is_none() => { + Err(Error::Unsupported(reason)) if std::env::var_os("CI_STRICT").is_none() => { eprintln!("skipping io_uring workers test: {reason}"); None } diff --git a/rs/moq-video/src/lib.rs b/rs/moq-video/src/lib.rs index f596f66d781..695ec908d23 100644 --- a/rs/moq-video/src/lib.rs +++ b/rs/moq-video/src/lib.rs @@ -98,6 +98,16 @@ mod mf; #[cfg(all(target_os = "linux", feature = "v4l2"))] mod v4l2; +/// The environment variables this build reads, for a binary that refuses `MOQ_*` names nothing reads. +pub const ENV: &[&str] = &[ + #[cfg(all(target_os = "linux", feature = "vaapi"))] + "MOQ_VAAPI_DEVICE", + #[cfg(all(target_os = "linux", feature = "v4l2"))] + "MOQ_V4L2_ENCODER", + #[cfg(all(target_os = "linux", feature = "v4l2"))] + "MOQ_V4L2_DECODER", +]; + pub use color::Color; pub use error::Error; #[cfg(all(target_os = "linux", feature = "dmabuf"))] diff --git a/sh/coverage.test.py b/sh/coverage.test.py index 8be259b43d0..916e1290449 100644 --- a/sh/coverage.test.py +++ b/sh/coverage.test.py @@ -44,7 +44,7 @@ def setUp(self): target.chmod(0o755) self.calls = self.root / "calls" self.env = dict(os.environ, PATH=f"{self.bin}:{os.environ['PATH']}", - COVERAGE_CALLS=str(self.calls), BASH_ENV="/dev/null", GITHUB_ACTIONS="", MOQ_LOCAL_SUPERVISED="1") + COVERAGE_CALLS=str(self.calls), BASH_ENV="/dev/null", GITHUB_ACTIONS="", LOCAL_SUPERVISED="1") def javascript(self, name="", fail=False): directories = ["js/first", "js/second", "js/empty"] diff --git a/sh/cpp/check.sh b/sh/cpp/check.sh index 17d5d27bcfe..5fa9dad401e 100755 --- a/sh/cpp/check.sh +++ b/sh/cpp/check.sh @@ -7,7 +7,7 @@ # compiler on Unix; Windows uses MSVC. set -euo pipefail -if [[ "${GITHUB_ACTIONS:-}" != true && "${MOQ_LOCAL_SUPERVISED:-}" != 1 ]]; then +if [[ "${GITHUB_ACTIONS:-}" != true && "${LOCAL_SUPERVISED:-}" != 1 ]]; then exec bash "$(dirname "$0")/../local.sh" bash "$0" "$@" fi diff --git a/sh/dart/check.sh b/sh/dart/check.sh index 1d047d4ef18..d0f0f650c66 100755 --- a/sh/dart/check.sh +++ b/sh/dart/check.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -euo pipefail -if [[ "${GITHUB_ACTIONS:-}" != true && "${MOQ_LOCAL_SUPERVISED:-}" != 1 ]]; then +if [[ "${GITHUB_ACTIONS:-}" != true && "${LOCAL_SUPERVISED:-}" != 1 ]]; then exec bash "$(dirname "$0")/../local.sh" bash "$0" "$@" fi diff --git a/sh/dispatch-query.test.py b/sh/dispatch-query.test.py index 2b7b05c9786..69d61de2b06 100644 --- a/sh/dispatch-query.test.py +++ b/sh/dispatch-query.test.py @@ -28,11 +28,11 @@ def setUp(self): self.bin.mkdir() for command in ("bash", "git", "sort", "mktemp", "rm", "grep"): (self.bin / command).symlink_to(shutil.which(command)) - self.env = dict(os.environ, MOQ_LOCAL_SUPERVISED="1", PATH=str(self.bin), GIT_CONFIG_NOSYSTEM="1", - GIT_CONFIG_GLOBAL=os.devnull, MOQ_STRICT="1") + self.env = dict(os.environ, LOCAL_SUPERVISED="1", PATH=str(self.bin), GIT_CONFIG_NOSYSTEM="1", + GIT_CONFIG_GLOBAL=os.devnull, CI_STRICT="1") # The runner's own Actions variables would move the run's error # annotations to stdout and append to the real job summary. - for key in ("MOQ_DEV_SHELL", "MOQ_ALLOW_HOST", "MOQ_CHECK_JOBS", "GITHUB_BASE_REF", + for key in ("IN_MOQ_DEV_SHELL", "ALLOW_HOST_TOOLCHAIN", "CHECK_JOBS", "GITHUB_BASE_REF", "GITHUB_ACTIONS", "GITHUB_STEP_SUMMARY"): self.env.pop(key, None) self.git("init", "-q", "-b", "main") @@ -191,7 +191,7 @@ def stub_ci(self, just=""): nix = self.bin / "nix" nix.write_text('#!/usr/bin/env bash\nprintf "nix %s\\n" "$*" >>"$CALLS"\n') nix.chmod(0o755) - self.env.update(MOQ_DEV_SHELL="1", CALLS=str(self.root / "calls")) + self.env.update(IN_MOQ_DEV_SHELL="1", CALLS=str(self.root / "calls")) (self.root / "calls").unlink(missing_ok=True) self.env["PATH"] = f"{self.bin}:{os.environ['PATH']}" for script in ("markdown.sh", "shell.sh", "large-files.sh"): @@ -250,7 +250,7 @@ def test_terminating_the_run_stops_the_running_phase(self): for jobs in ("1", "3"): with self.subTest(jobs=jobs): run = subprocess.Popen(["bash", "sh/dispatch.sh", "ci", "origin/main"], - cwd=self.repo, env=dict(self.env, MOQ_CHECK_JOBS=jobs), + cwd=self.repo, env=dict(self.env, CHECK_JOBS=jobs), text=True, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE) started.read_text() diff --git a/sh/dispatch.sh b/sh/dispatch.sh index 8fd3e3f106f..3e4cbc78ab7 100755 --- a/sh/dispatch.sh +++ b/sh/dispatch.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # Run `just check`, `just fix`, or `just ci` over one resolved branch diff. -# check and ci run MOQ_CHECK_JOBS lanes of modules at once (default 3); 1 runs +# check and ci run CHECK_JOBS lanes of modules at once (default 3); 1 runs # them in order and streams their output. # `--query` prints the selection before CI installs its toolchain and caches. # `ci-platform` exists only as a query for the native platform workflows. @@ -24,11 +24,11 @@ esac # A host toolchain fails deep in a build instead: its gcc keeps the # _FORTIFY_SOURCE the dev shell disables, which breaks jemalloc's -Werror -# configure probes. This flake's dev shell sets MOQ_DEV_SHELL. Windows has no +# configure probes. This flake's dev shell sets IN_MOQ_DEV_SHELL. Windows has no # Nix, so it always runs on the host. -if [[ -z "$query" && -z "${MOQ_DEV_SHELL:-}" && -z "${MOQ_ALLOW_HOST:-}" && "$OSTYPE" != msys && "$OSTYPE" != cygwin ]]; then +if [[ -z "$query" && -z "${IN_MOQ_DEV_SHELL:-}" && -z "${ALLOW_HOST_TOOLCHAIN:-}" && "$OSTYPE" != msys && "$OSTYPE" != cygwin ]]; then echo "error: run inside the Nix dev shell ('nix develop' or direnv) so tools match CI" >&2 - echo " or set MOQ_ALLOW_HOST=1 to use the host toolchain anyway" >&2 + echo " or set ALLOW_HOST_TOOLCHAIN=1 to use the host toolchain anyway" >&2 exit 1 fi @@ -133,7 +133,7 @@ if [[ "$action" == ci-platform ]]; then fi # The tools each module needs. A module missing one is skipped locally, so an -# incomplete toolchain checks less; under MOQ_STRICT (CI) it is an error, up +# incomplete toolchain checks less; under CI_STRICT (CI) it is an error, up # front, because there a skip is indistinguishable from a pass. swift needs # none: it skips off macOS by design, and platform.yml is its real gate. declare -A tools=( @@ -231,7 +231,7 @@ for module in "${modules[@]}"; do done if ((${#absent[@]} == 0)); then selected+=("$module") - elif [[ -n "${MOQ_STRICT:-}" ]]; then + elif [[ -n "${CI_STRICT:-}" ]]; then missing+=("${absent[@]}") else echo "$action: skipping $module; missing ${absent[*]}" >&2 @@ -253,8 +253,8 @@ if [[ -n "$query" ]]; then fi if ((${#missing[@]})); then - echo "error: MOQ_STRICT is set but these tools are missing: $(printf '%s\n' "${missing[@]}" | sort -u | tr '\n' ' ')" >&2 - echo " run inside 'nix develop', or unset MOQ_STRICT to skip what isn't installed" >&2 + echo "error: CI_STRICT is set but these tools are missing: $(printf '%s\n' "${missing[@]}" | sort -u | tr '\n' ' ')" >&2 + echo " run inside 'nix develop', or unset CI_STRICT to skip what isn't installed" >&2 exit 1 fi @@ -325,10 +325,10 @@ step() { # Lanes run at most this many at a time. fix stays serial: its fixers rewrite # files the others read, such as taplo under `cargo clippy --fix`. -limit=${MOQ_CHECK_JOBS:-3} +limit=${CHECK_JOBS:-3} [[ "$action" != fix ]] || limit=1 if [[ ! "$limit" =~ ^[1-9][0-9]*$ ]]; then - echo "error: MOQ_CHECK_JOBS must be a positive integer, not '$limit'" >&2 + echo "error: CHECK_JOBS must be a positive integer, not '$limit'" >&2 exit 2 fi diff --git a/sh/gh/bench-report.py b/sh/gh/bench-report.py index a524b5f4a49..68ac551d34f 100644 --- a/sh/gh/bench-report.py +++ b/sh/gh/bench-report.py @@ -57,7 +57,7 @@ def rust(directory): metadata = json.loads((run / 'metadata.json').read_text()) if metadata['mode'] != '--criterion': raise ValueError(f'not a measured Criterion run: {run}') - label = metadata['environment'].get('MOQ_BENCH_LABEL') + label = metadata['environment'].get('BENCH_LABEL') if not isinstance(label, str) or not label: raise ValueError(f'missing Criterion source label: {run}') estimates = sorted((run / 'criterion').glob('**/new/estimates.json')) @@ -92,7 +92,7 @@ def paired(directory): for key in ('commit', 'base', 'threshold_pct', 'rounds'): if combined.setdefault(key, comparison[key]) != comparison[key]: raise ValueError(f'paired run disagrees on {key}: {run}') - label = data['environment']['MOQ_BENCH_LABEL'] + label = data['environment']['BENCH_LABEL'] combined['unavailable'] += [{'name': f'rust/{label}/{entry["target"]}', 'reason': entry['reason']} for entry in comparison['unavailable']] for case in comparison['cases']: diff --git a/sh/gh/bench-report.test.py b/sh/gh/bench-report.test.py index 334a9691285..d47b27e193b 100644 --- a/sh/gh/bench-report.test.py +++ b/sh/gh/bench-report.test.py @@ -64,7 +64,7 @@ def test_criterion_requires_fresh_measured_estimates(self): run.mkdir(parents=True) (self.root / 'criterion-runs.txt').write_text(f'{run}\n') (run / 'metadata.json').write_text(json.dumps({'mode': '--criterion', 'revision': 'abc', - 'environment': {'MOQ_BENCH_LABEL': 'net-cpu', 'SESSION_CPU': '1'}})) + 'environment': {'BENCH_LABEL': 'net-cpu', 'SESSION_CPU': '1'}})) with self.assertRaises(ValueError): report.rust(self.root) case = run / 'criterion' / 'delivery' / 'new' @@ -84,7 +84,7 @@ def paired_runs(self, comparisons): run = self.root / 'runs' / label run.mkdir(parents=True) (run / 'metadata.json').write_text(json.dumps({'mode': '--criterion', 'revision': 'c2', 'base': base, - 'environment': {'MOQ_BENCH_LABEL': label}})) + 'environment': {'BENCH_LABEL': label}})) if comparison is not None: (run / 'paired.json').write_text(json.dumps(comparison)) runs.append(str(run)) diff --git a/sh/gh/nightly.sh b/sh/gh/nightly.sh index d1cefc9f0a8..fc633d0ffc4 100755 --- a/sh/gh/nightly.sh +++ b/sh/gh/nightly.sh @@ -18,36 +18,36 @@ case "$1" in ;; esac -# MOQ_BENCH_BASE pairs every Rust bench target with its build at that revision, run on the +# BENCH_BASE pairs every Rust bench target with its build at that revision, run on the # same machine; `previous-nightly` is the commit of the latest other scheduled Nightly on main. -if [[ -n ${MOQ_BENCH_BASE:-} ]]; then +if [[ -n ${BENCH_BASE:-} ]]; then if [[ $report != rust ]]; then - echo "nightly: MOQ_BENCH_BASE applies only to the Rust bench groups" >&2 + echo "nightly: BENCH_BASE applies only to the Rust bench groups" >&2 exit 2 fi - if [[ $MOQ_BENCH_BASE == previous-nightly ]]; then - MOQ_BENCH_BASE=$(gh run list --workflow nightly.yml --branch main --event schedule --limit 2 \ + if [[ $BENCH_BASE == previous-nightly ]]; then + BENCH_BASE=$(gh run list --workflow nightly.yml --branch main --event schedule --limit 2 \ --json databaseId,headSha --jq "map(select(.databaseId != ${GITHUB_RUN_ID:-0}))[0].headSha // empty") - if [[ -z $MOQ_BENCH_BASE ]]; then + if [[ -z $BENCH_BASE ]]; then echo "nightly: no previous scheduled Nightly on main" >&2 exit 1 fi fi # A shallow CI checkout has only its own commit. Fetching a branch name only updates # FETCH_HEAD, so the base is exported as the commit it resolved to. - if ! base=$(git rev-parse --verify --quiet "$MOQ_BENCH_BASE^{commit}"); then - git fetch --no-tags --depth=1 origin "$MOQ_BENCH_BASE" + if ! base=$(git rev-parse --verify --quiet "$BENCH_BASE^{commit}"); then + git fetch --no-tags --depth=1 origin "$BENCH_BASE" base=$(git rev-parse --verify 'FETCH_HEAD^{commit}') fi - export MOQ_BENCH_BASE=$base + export BENCH_BASE=$base fi if [[ -n $report ]]; then root=$(git rev-parse --show-toplevel) - out=${MOQ_BENCH_RESULTS:-$root/target/bench/nightly/$1} + out=${BENCH_RESULTS:-$root/target/bench/nightly/$1} mkdir -p "$out" - export MOQ_BENCH_RUNS="$out/criterion-runs.txt" - : >"$MOQ_BENCH_RUNS" + export BENCH_RUNS="$out/criterion-runs.txt" + : >"$BENCH_RUNS" rm -f "$out/report.json" "$out/paired.json" fi @@ -60,7 +60,7 @@ run() { criterion() { local label=$1 shift - run env MOQ_BENCH_LABEL="$label" MOQ_BENCH_ARTIFACTS="$out/runs" just gh criterion "$@" + run env BENCH_LABEL="$label" BENCH_ARTIFACTS="$out/runs" just gh criterion "$@" } javascript() { diff --git a/sh/gh/nightly.test.py b/sh/gh/nightly.test.py index 0fd4c592e42..93a6068b7a7 100644 --- a/sh/gh/nightly.test.py +++ b/sh/gh/nightly.test.py @@ -25,7 +25,7 @@ def run_group(self, group, fail="", **environment): stub.write_text( '#!/usr/bin/env bash\n' 'printf "%s %s\n" "${0##*/}" "$*" >> "$NIGHTLY_CALLS"\n' - 'printf "%s\n" "${MOQ_BENCH_BASE:-}" >> "$NIGHTLY_CALLS.base"\n' + 'printf "%s\n" "${BENCH_BASE:-}" >> "$NIGHTLY_CALLS.base"\n' '[[ "$*" != "$NIGHTLY_FAIL" ]]\n' ) stub.chmod(0o755) @@ -35,8 +35,8 @@ def run_group(self, group, fail="", **environment): 'printf "%s" "$NIGHTLY_RUNS" | jq -r "$2"\n') gh.chmod(0o755) env = dict(os.environ, PATH=f"{scratch}:{os.environ['PATH']}", - MOQ_BENCH_RESULTS=str(scratch / "results"), NIGHTLY_CALLS=str(calls), NIGHTLY_FAIL=fail, BASH_ENV="/dev/null") - env.pop("MOQ_BENCH_BASE", None) + BENCH_RESULTS=str(scratch / "results"), NIGHTLY_CALLS=str(calls), NIGHTLY_FAIL=fail, BASH_ENV="/dev/null") + env.pop("BENCH_BASE", None) env.update(environment) result = subprocess.run(["bash", "sh/gh/nightly.sh", group], cwd=ROOT, env=env, capture_output=True, text=True) @@ -48,14 +48,14 @@ def test_paired_base_is_the_previous_scheduled_nightly(self): check=True).stdout.strip() for revision in ("HEAD", "HEAD~1")) # This run is the newest scheduled one; the previous run's commit is the base. runs = json.dumps([{"databaseId": 2, "headSha": parent}, {"databaseId": 1, "headSha": head}]) - result, _ = self.run_group("rust-uring", MOQ_BENCH_BASE="previous-nightly", GITHUB_RUN_ID="2", NIGHTLY_RUNS=runs) + result, _ = self.run_group("rust-uring", BENCH_BASE="previous-nightly", GITHUB_RUN_ID="2", NIGHTLY_RUNS=runs) self.assertEqual(result.returncode, 0, result.stderr) self.assertEqual(self.bases, {head}) # A named revision reaches the runner as its commit. - result, _ = self.run_group("rust-uring", MOQ_BENCH_BASE="HEAD~1") + result, _ = self.run_group("rust-uring", BENCH_BASE="HEAD~1") self.assertEqual(result.returncode, 0, result.stderr) self.assertEqual(self.bases, {parent}) - result, calls = self.run_group("rust-uring", MOQ_BENCH_BASE="previous-nightly", GITHUB_RUN_ID="1", + result, calls = self.run_group("rust-uring", BENCH_BASE="previous-nightly", GITHUB_RUN_ID="1", NIGHTLY_RUNS=json.dumps([{"databaseId": 1, "headSha": head}])) self.assertEqual(result.returncode, 1) self.assertIn("no previous scheduled Nightly", result.stderr) @@ -63,7 +63,7 @@ def test_paired_base_is_the_previous_scheduled_nightly(self): def test_paired_base_applies_only_to_rust_bench_groups(self): for group in ("js", "rust-test"): - result, calls = self.run_group(group, MOQ_BENCH_BASE="HEAD") + result, calls = self.run_group(group, BENCH_BASE="HEAD") self.assertEqual(result.returncode, 2, group) self.assertEqual(calls, []) diff --git a/sh/go/check.sh b/sh/go/check.sh index 5989be580aa..59ed9a918d6 100755 --- a/sh/go/check.sh +++ b/sh/go/check.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -euo pipefail -if [[ "${GITHUB_ACTIONS:-}" != true && "${MOQ_LOCAL_SUPERVISED:-}" != 1 ]]; then +if [[ "${GITHUB_ACTIONS:-}" != true && "${LOCAL_SUPERVISED:-}" != 1 ]]; then exec bash "$(dirname "$0")/../local.sh" bash "$0" "$@" fi diff --git a/sh/js/workspace.py b/sh/js/workspace.py index ef2a02b2728..1c04f45acfa 100644 --- a/sh/js/workspace.py +++ b/sh/js/workspace.py @@ -206,7 +206,7 @@ def main(): if action == "plan": print(json.dumps(plan, default=sorted)) else: - if plan["packages"] and os.environ.get("GITHUB_ACTIONS") != "true" and os.environ.get("MOQ_LOCAL_SUPERVISED") != "1": + if plan["packages"] and os.environ.get("GITHUB_ACTIONS") != "true" and os.environ.get("LOCAL_SUPERVISED") != "1": os.execvp("bash", ["bash", str(ROOT / "sh/local.sh"), sys.executable, str(Path(__file__).resolve()), *sys.argv[1:]]) started = time.monotonic() diff --git a/sh/js/workspace.test.py b/sh/js/workspace.test.py index 58d018fa1eb..c53b6889e00 100644 --- a/sh/js/workspace.test.py +++ b/sh/js/workspace.test.py @@ -62,7 +62,7 @@ def test_dispatcher_passes_only_js_impact_paths(self): just = tools / "just" subprocess.run(["git", "init", "--quiet", str(self.root)], check=True) calls = self.root / "calls" - env = dict(os.environ, PATH=f"{tools}:{os.environ['PATH']}", MOQ_ALLOW_HOST="1", + env = dict(os.environ, PATH=f"{tools}:{os.environ['PATH']}", ALLOW_HOST_TOOLCHAIN="1", SELECT_CALLS=str(calls)) for script in ("markdown.sh", "shell.sh", "large-files.sh"): path = sh / script diff --git a/sh/kt/check.sh b/sh/kt/check.sh index eb5ac57f7cd..48a6f64d5fb 100644 --- a/sh/kt/check.sh +++ b/sh/kt/check.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -euo pipefail -if [[ "${GITHUB_ACTIONS:-}" != true && "${MOQ_LOCAL_SUPERVISED:-}" != 1 ]]; then +if [[ "${GITHUB_ACTIONS:-}" != true && "${LOCAL_SUPERVISED:-}" != 1 ]]; then exec bash "$(dirname "$0")/../local.sh" bash "$0" "$@" fi diff --git a/sh/local.sh b/sh/local.sh index 1e29e3d3e94..6b065d8d648 100755 --- a/sh/local.sh +++ b/sh/local.sh @@ -10,7 +10,7 @@ if [[ "${GITHUB_ACTIONS:-}" == true ]]; then exec "$@" fi export NEXTEST_TEST_THREADS="${NEXTEST_TEST_THREADS-4}" -if [[ "${MOQ_LOCAL_SUPERVISED:-}" == 1 ]]; then +if [[ "${LOCAL_SUPERVISED:-}" == 1 ]]; then exec "$@" fi if [[ "${QUEST_GATE_ADMITTED:-}" == 1 ]]; then diff --git a/sh/local.test.py b/sh/local.test.py index de4b03fdbfd..79f25ce95c2 100644 --- a/sh/local.test.py +++ b/sh/local.test.py @@ -20,7 +20,7 @@ class LocalGate(unittest.TestCase): def env(self, **changes): env = dict(os.environ) - for key in ("QUEST_GATE_ADMITTED", "MOQ_LOCAL_SUPERVISED", "GITHUB_ACTIONS", "NEXTEST_TEST_THREADS"): + for key in ("QUEST_GATE_ADMITTED", "LOCAL_SUPERVISED", "GITHUB_ACTIONS", "NEXTEST_TEST_THREADS"): env.pop(key, None) env.update(changes) return env @@ -37,11 +37,11 @@ def test_hosted_ci_bypasses_admission_and_worker_defaults(self): def test_nested_admission_preserves_failures_and_worker_override(self): result = self.run_command('import os; print(os.environ["NEXTEST_TEST_THREADS"]); exit(9)', - MOQ_LOCAL_SUPERVISED="1", NEXTEST_TEST_THREADS="2", PATH="") + LOCAL_SUPERVISED="1", NEXTEST_TEST_THREADS="2", PATH="") self.assertEqual(result.returncode, 9, result.stderr) self.assertEqual(result.stdout.strip(), "2") result = self.run_command('import os; print(os.environ["NEXTEST_TEST_THREADS"])', - MOQ_LOCAL_SUPERVISED="1", PATH="") + LOCAL_SUPERVISED="1", PATH="") self.assertEqual(result.returncode, 0, result.stderr) self.assertLessEqual(int(result.stdout), 4) self.assertGreater(int(result.stdout), 0) @@ -67,7 +67,7 @@ def test_admission_precedes_launch_and_nested_calls_skip_it(self): def test_external_admission_keeps_descendant_supervision(self): with tempfile.TemporaryDirectory() as directory: (Path(directory) / "bun").symlink_to(BUN) - result = self.run_command('import os; print(os.environ["MOQ_LOCAL_SUPERVISED"])', + result = self.run_command('import os; print(os.environ["LOCAL_SUPERVISED"])', QUEST_GATE_ADMITTED="1", PATH=directory) self.assertEqual(result.returncode, 0, result.stderr) self.assertEqual(result.stdout.strip(), "1") diff --git a/sh/local.ts b/sh/local.ts index fdfc908ad37..24543e5bd54 100644 --- a/sh/local.ts +++ b/sh/local.ts @@ -17,7 +17,7 @@ const child = Bun.spawn(command, { stdin: "inherit", stdout: "inherit", stderr: "inherit", - env: { ...process.env, MOQ_LOCAL_SUPERVISED: "1" }, + env: { ...process.env, LOCAL_SUPERVISED: "1" }, }); // Forward cancellation and let the child clean up; once it exits, every survivor is ours. let signaled: number | undefined; diff --git a/sh/obs/check.sh b/sh/obs/check.sh index 5588f74d90f..802840905c3 100755 --- a/sh/obs/check.sh +++ b/sh/obs/check.sh @@ -32,11 +32,11 @@ fi # the change that opens the gap and so the one that should fail. # OBS_LINKED_VERSION comes from the dev shell (see flake.nix), so this leg # is skipped outside it, where there is no nixpkgs obs-studio to compare. -# MOQ_STRICT turns that skip into an error for the same reason it turns a +# CI_STRICT turns that skip into an error for the same reason it turns a # missing tool into one: in CI a leg that checks nothing still reports green. if [ -z "${OBS_LINKED_VERSION:-}" ]; then - if [ -n "${MOQ_STRICT:-}" ]; then - echo "MOQ_STRICT is set but OBS_LINKED_VERSION is unset; run inside 'nix develop', which exports it" >&2 + if [ -n "${CI_STRICT:-}" ]; then + echo "CI_STRICT is set but OBS_LINKED_VERSION is unset; run inside 'nix develop', which exports it" >&2 exit 1 fi else diff --git a/sh/obs/compile.sh b/sh/obs/compile.sh index d4ebb10926c..06c7f6e7fe8 100755 --- a/sh/obs/compile.sh +++ b/sh/obs/compile.sh @@ -18,7 +18,7 @@ # only where obs.yml's path filter reaches; `just obs test` runs nightly. set -euo pipefail -if [[ "${GITHUB_ACTIONS:-}" != true && "${MOQ_LOCAL_SUPERVISED:-}" != 1 ]]; then +if [[ "${GITHUB_ACTIONS:-}" != true && "${LOCAL_SUPERVISED:-}" != 1 ]]; then exec bash "$(dirname "$0")/../local.sh" bash "$0" "$@" fi @@ -44,9 +44,9 @@ done # Sources check in parallel under the same bound as the module lanes # sh/dispatch.sh runs at once, and with the same default. -limit=${MOQ_CHECK_JOBS:-3} +limit=${CHECK_JOBS:-3} if [[ ! "$limit" =~ ^[1-9][0-9]*$ ]]; then - echo "error: MOQ_CHECK_JOBS must be a positive integer, not '$limit'" >&2 + echo "error: CHECK_JOBS must be a positive integer, not '$limit'" >&2 exit 2 fi diff --git a/sh/obs/test.sh b/sh/obs/test.sh index 55e3ea752c4..15dda421fbb 100755 --- a/sh/obs/test.sh +++ b/sh/obs/test.sh @@ -9,7 +9,7 @@ # can't check. set -euo pipefail -if [[ "${GITHUB_ACTIONS:-}" != true && "${MOQ_LOCAL_SUPERVISED:-}" != 1 ]]; then +if [[ "${GITHUB_ACTIONS:-}" != true && "${LOCAL_SUPERVISED:-}" != 1 ]]; then exec bash "$(dirname "$0")/../local.sh" bash "$0" "$@" fi diff --git a/sh/obs/unit.sh b/sh/obs/unit.sh index 62704c05dee..6a21fb5e4a9 100755 --- a/sh/obs/unit.sh +++ b/sh/obs/unit.sh @@ -5,7 +5,7 @@ # both run the same assertions. set -euo pipefail -if [[ "${GITHUB_ACTIONS:-}" != true && "${MOQ_LOCAL_SUPERVISED:-}" != 1 ]]; then +if [[ "${GITHUB_ACTIONS:-}" != true && "${LOCAL_SUPERVISED:-}" != 1 ]]; then exec bash "$(dirname "$0")/../local.sh" bash "$0" "$@" fi diff --git a/sh/rs/c-tests.sh b/sh/rs/c-tests.sh index 873e69b93cb..461d874df8c 100755 --- a/sh/rs/c-tests.sh +++ b/sh/rs/c-tests.sh @@ -6,7 +6,7 @@ # Unix only. set -euo pipefail -if [[ "${GITHUB_ACTIONS:-}" != true && "${MOQ_LOCAL_SUPERVISED:-}" != 1 ]]; then +if [[ "${GITHUB_ACTIONS:-}" != true && "${LOCAL_SUPERVISED:-}" != 1 ]]; then exec bash "$(dirname "$0")/../local.sh" bash "$0" "$@" fi diff --git a/sh/rs/gpu.sh b/sh/rs/gpu.sh index 4ac870e4f41..460eb8a2a60 100755 --- a/sh/rs/gpu.sh +++ b/sh/rs/gpu.sh @@ -2,7 +2,7 @@ # Hardware tests are opt-in; a detected GPU must have its driver and pass its tests. set -euo pipefail -if [[ "${GITHUB_ACTIONS:-}" != true && "${MOQ_LOCAL_SUPERVISED:-}" != 1 ]]; then +if [[ "${GITHUB_ACTIONS:-}" != true && "${LOCAL_SUPERVISED:-}" != 1 ]]; then exec bash "$(dirname "$0")/../local.sh" bash "$0" "$@" fi cd "$(git rev-parse --show-toplevel)" diff --git a/sh/rs/media-features.sh b/sh/rs/media-features.sh index 70a73a7e20e..857c247fb4e 100755 --- a/sh/rs/media-features.sh +++ b/sh/rs/media-features.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -euo pipefail -if [[ "${GITHUB_ACTIONS:-}" != true && "${MOQ_LOCAL_SUPERVISED:-}" != 1 ]]; then +if [[ "${GITHUB_ACTIONS:-}" != true && "${LOCAL_SUPERVISED:-}" != 1 ]]; then exec bash "$(dirname "$0")/../local.sh" bash "$0" "$@" fi diff --git a/sh/rs/net-features.sh b/sh/rs/net-features.sh index 605ac62c13a..774a4682ca3 100644 --- a/sh/rs/net-features.sh +++ b/sh/rs/net-features.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -euo pipefail -if [[ "${GITHUB_ACTIONS:-}" != true && "${MOQ_LOCAL_SUPERVISED:-}" != 1 ]]; then +if [[ "${GITHUB_ACTIONS:-}" != true && "${LOCAL_SUPERVISED:-}" != 1 ]]; then exec bash "$(dirname "$0")/../local.sh" bash "$0" "$@" fi diff --git a/sh/rs/select.sh b/sh/rs/select.sh index 7e2357f26ee..ae6b88c06c6 100755 --- a/sh/rs/select.sh +++ b/sh/rs/select.sh @@ -115,7 +115,7 @@ esac # Selection and empty crate sets stay outside admission. The paths are # root-relative because the `cd` above invalidates a relative `$0`. -if [[ "${GITHUB_ACTIONS:-}" != true && "${MOQ_LOCAL_SUPERVISED:-}" != 1 ]]; then +if [[ "${GITHUB_ACTIONS:-}" != true && "${LOCAL_SUPERVISED:-}" != 1 ]]; then exec bash sh/local.sh bash sh/rs/select.sh "$@" fi diff --git a/sh/rs/select.test.py b/sh/rs/select.test.py index dbe616522e4..f3dbdce4df7 100644 --- a/sh/rs/select.test.py +++ b/sh/rs/select.test.py @@ -22,7 +22,7 @@ def selected(self, *paths, action="lint", github_actions=False): just.chmod(0o755) changed = scratch / "changed" changed.write_text("\n".join(paths) + "\n") - env = dict(os.environ, MOQ_LOCAL_SUPERVISED="1", PATH=f"{scratch}:{os.environ['PATH']}", + env = dict(os.environ, LOCAL_SUPERVISED="1", PATH=f"{scratch}:{os.environ['PATH']}", SELECT_CALLS=str(calls), BASH_ENV=os.devnull, GITHUB_ACTIONS=str(github_actions).lower()) subprocess.run(["bash", "sh/rs/select.sh", action, str(changed)], @@ -108,7 +108,7 @@ def test_unexecuted_bench_is_not_compiled(self): (scratch / "benches/unexecuted.rs").write_text( 'compile_error!("nextest must not compile a benchmark it never runs");\nfn main() {}\n' ) - env = dict(os.environ, MOQ_LOCAL_SUPERVISED="1", BASH_ENV=os.devnull, TMPDIR="/tmp", + env = dict(os.environ, LOCAL_SUPERVISED="1", BASH_ENV=os.devnull, TMPDIR="/tmp", NEXTEST_PROFILE="default") result = subprocess.run( ["just", "rs", "test", "--manifest-path", str(scratch / "Cargo.toml")], @@ -125,7 +125,7 @@ def trace(self, owner, *args): cargo = scratch / "cargo" cargo.write_text(CARGO_STUB) cargo.chmod(0o755) - env = dict(os.environ, MOQ_LOCAL_SUPERVISED="1", PATH=f"{scratch}:{os.environ['PATH']}", + env = dict(os.environ, LOCAL_SUPERVISED="1", PATH=f"{scratch}:{os.environ['PATH']}", FEATURE_CALLS=str(calls), BASH_ENV=os.devnull) result = subprocess.run(["bash", f"sh/rs/{owner}-features.sh", *args], cwd=ROOT, env=env, capture_output=True, text=True) diff --git a/sh/rs/test-lints.test.py b/sh/rs/test-lints.test.py index 005dd6eff01..ddc931b584e 100644 --- a/sh/rs/test-lints.test.py +++ b/sh/rs/test-lints.test.py @@ -30,7 +30,7 @@ def test_clippy_warning_fails_test_build(self): '#[test]\nfn runs() { assert!(empty(&[])); }\n' ) toolchain = Path(shutil.which("clippy-driver")).parent - env = dict(os.environ, MOQ_LOCAL_SUPERVISED="1", CARGO_TARGET_DIR=str(root / "target"), + env = dict(os.environ, LOCAL_SUPERVISED="1", CARGO_TARGET_DIR=str(root / "target"), PATH=f"{toolchain}:{os.environ['PATH']}", NEXTEST_PROFILE="default") subprocess.run(["cargo", "generate-lockfile", "--offline"], cwd=root, diff --git a/sh/rs/tokio-features.sh b/sh/rs/tokio-features.sh index 18f09c24ed2..b404e031565 100755 --- a/sh/rs/tokio-features.sh +++ b/sh/rs/tokio-features.sh @@ -5,7 +5,7 @@ # through unification. set -euo pipefail -if [[ "${GITHUB_ACTIONS:-}" != true && "${MOQ_LOCAL_SUPERVISED:-}" != 1 ]]; then +if [[ "${GITHUB_ACTIONS:-}" != true && "${LOCAL_SUPERVISED:-}" != 1 ]]; then exec bash "$(dirname "$0")/../local.sh" bash "$0" "$@" fi diff --git a/sh/rs/uring.test.py b/sh/rs/uring.test.py index 0646adfac3c..0f8dc75d477 100644 --- a/sh/rs/uring.test.py +++ b/sh/rs/uring.test.py @@ -31,7 +31,7 @@ def test_selection_follows_shared_dependencies(self): cargo.write_text('#!/bin/sh\ncat "$TEST_METADATA"\n') cargo.chmod(0o755) changed = scratch / "changed" - env = dict(os.environ, MOQ_LOCAL_SUPERVISED="1", PATH=f"{scratch}:{os.environ['PATH']}", + env = dict(os.environ, LOCAL_SUPERVISED="1", PATH=f"{scratch}:{os.environ['PATH']}", SELECT_CALLS=str(calls), TEST_METADATA=str(fixture)) for path, passes in ( ("rs/moq-uring/src/worker.rs", True), ("rs/moq-relay/src/uring.rs", True), diff --git a/sh/swift/check.sh b/sh/swift/check.sh index 3dec50d406b..0cf045c2829 100755 --- a/sh/swift/check.sh +++ b/sh/swift/check.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -euo pipefail -if [[ "${GITHUB_ACTIONS:-}" != true && "${MOQ_LOCAL_SUPERVISED:-}" != 1 ]]; then +if [[ "${GITHUB_ACTIONS:-}" != true && "${LOCAL_SUPERVISED:-}" != 1 ]]; then exec bash "$(dirname "$0")/../local.sh" bash "$0" "$@" fi diff --git a/sh/swift/simulator.sh b/sh/swift/simulator.sh index 2244d2bbc3a..f0a4140339b 100755 --- a/sh/swift/simulator.sh +++ b/sh/swift/simulator.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -euo pipefail -if [[ "${GITHUB_ACTIONS:-}" != true && "${MOQ_LOCAL_SUPERVISED:-}" != 1 ]]; then +if [[ "${GITHUB_ACTIONS:-}" != true && "${LOCAL_SUPERVISED:-}" != 1 ]]; then exec bash "$(dirname "$0")/../local.sh" bash "$0" "$@" fi diff --git a/test/README.md b/test/README.md index 43a9cb67058..9121c84ea71 100644 --- a/test/README.md +++ b/test/README.md @@ -32,15 +32,15 @@ when run concurrently or from different worktrees. The shared Every run owns three things and touches nothing else. **A private run directory.** `mktemp -d` under `$TMPDIR/moq-test-`, mode 700, -holding every log, generated config, and capture. `MOQ_TEST_RUNS` moves the root. +holding every log, generated config, and capture. `HARNESS_RUNS` moves the root. Client builds go here too (the Python venv, the staged Go modules, the browser page), so two runs from one checkout never rebuild a client the other is running. **Reserved ports.** A port is claimed by creating a directory under -`/tmp/moq-test-ports-` (`MOQ_TEST_PORTS`), held for the whole run, and +`/tmp/moq-test-ports-` (`HARNESS_PORT_ROOT`), held for the whole run, and released on the way out. That reservation is the point: probing for a free port and then releasing it is a race, and two runs that probe at the same moment pick the same -number. The walk starts at `MOQ_TEST_PORT_BASE` (4500). A reservation whose owner +number. The walk starts at `HARNESS_PORT_BASE` (4500). A reservation whose owner process is gone is reclaimed, atomically, so two reclaimers cannot both win. Replacement is serialized by `flock` on Linux or `lockf` on macOS, and the reservation records the owner's process start so a reused PID is not mistaken @@ -48,7 +48,7 @@ for the original run. The reservation root ignores `TMPDIR`: Nix shells have private temporary directories but share the host's ports. The user id avoids ownership conflicts in -world-writable `/tmp`. An override via `MOQ_TEST_PORTS` must be the same for every +world-writable `/tmp`. An override via `HARNESS_PORT_ROOT` must be the same for every run sharing the network. The root must belong to the current user and cannot be a symlink; new roots are private. Runs by different users still need disjoint ports. @@ -58,7 +58,7 @@ machine, so each harness still refuses a port something unrelated is already serving on. Pinning a port (`INTEROP_PORT`, `WASM_PORT`, `TSC_PORT`, `--port`) takes that exact one or fails. -Every port, pinned or walked to from `MOQ_TEST_PORT_BASE`, has to be 1024..65535 +Every port, pinned or walked to from `HARNESS_PORT_BASE`, has to be 1024..65535 before a reservation is created. A reservation is a directory named after the port, so the check keeps a malformed value from naming somewhere else on the filesystem, and it refuses an unbindable number up front instead of after the @@ -92,17 +92,17 @@ any Playwright trace survive with the command that reproduces it. A passing run deletes its own. ```bash -MOQ_TEST_KEEP=1 just test interop +HARNESS_KEEP=1 just test interop ``` -`MOQ_TEST_KEEP=1` keeps a passing run's directory too, for when the problem is in +`HARNESS_KEEP=1` keeps a passing run's directory too, for when the problem is in what the test did not assert. Either way the children are still reaped and the ports still released: what is kept is evidence, not a live session. Remove it with the `rm -rf` the run prints; nothing expires it for you. -In CI the harness writes under `MOQ_TEST_RUNS`, and `interop.yml` and `wasm.yml` +In CI the harness writes under `HARNESS_RUNS`, and `interop.yml` and `wasm.yml` upload that directory as a short-lived artifact when the job fails. -`MOQ_TEST_RESULTS` names a JSON Lines file a harness appends one record per case to, +`HARNESS_RESULTS` names a JSON Lines file a harness appends one record per case to, through `harness_result`; `interop.yml` builds its report from it. See [interop/README.md](interop/README.md#ci). diff --git a/test/audio-quality/record.sh b/test/audio-quality/record.sh index 0817e4dfbfc..48ab6563c8c 100755 --- a/test/audio-quality/record.sh +++ b/test/audio-quality/record.sh @@ -10,7 +10,7 @@ # replay budgets after. set -euo pipefail -if [[ "${GITHUB_ACTIONS:-}" != true && "${MOQ_LOCAL_SUPERVISED:-}" != 1 ]]; then +if [[ "${GITHUB_ACTIONS:-}" != true && "${LOCAL_SUPERVISED:-}" != 1 ]]; then exec bash "$(dirname "$0")/../../sh/local.sh" bash "$0" "$@" fi diff --git a/test/audio-quality/run.sh b/test/audio-quality/run.sh index 8f012671281..82fd717f83a 100755 --- a/test/audio-quality/run.sh +++ b/test/audio-quality/run.sh @@ -7,7 +7,7 @@ # README.md for the profiles, the metric contract, and the void rules. set -euo pipefail -if [[ "${GITHUB_ACTIONS:-}" != true && "${MOQ_LOCAL_SUPERVISED:-}" != 1 ]]; then +if [[ "${GITHUB_ACTIONS:-}" != true && "${LOCAL_SUPERVISED:-}" != 1 ]]; then exec bash "$(dirname "$0")/../../sh/local.sh" bash "$0" "$@" fi diff --git a/test/drain/run.sh b/test/drain/run.sh index ac83b3a56b7..a4d823ccac4 100755 --- a/test/drain/run.sh +++ b/test/drain/run.sh @@ -3,7 +3,7 @@ # migrates to relay B when A drains, without a dropped group. See README.md. set -euo pipefail -if [[ "${GITHUB_ACTIONS:-}" != true && "${MOQ_LOCAL_SUPERVISED:-}" != 1 ]]; then +if [[ "${GITHUB_ACTIONS:-}" != true && "${LOCAL_SUPERVISED:-}" != 1 ]]; then exec bash "$(dirname "$0")/../../sh/local.sh" bash "$0" "$@" fi diff --git a/test/ietf-conformance/README.md b/test/ietf-conformance/README.md index a252809a15d..b089af5a52d 100644 --- a/test/ietf-conformance/README.md +++ b/test/ietf-conformance/README.md @@ -25,7 +25,7 @@ relay before starting cases and rejects upstream publisher reconnects, so a recovered session cannot hide a failure. -The nightly workflow runs this recipe. `MOQ_TEST_KEEP=1` retains the upstream +The nightly workflow runs this recipe. `HARNESS_KEEP=1` retains the upstream reports, client and server logs, relay logs, configs, and endpoints. All children and port reservations belong to the shared harness and are reaped on exit. The pinned C++ build is opt-in under `legacyPackages..moxygen`; ordinary diff --git a/test/ietf-conformance/run.sh b/test/ietf-conformance/run.sh index df3502a4b81..77dfc024294 100755 --- a/test/ietf-conformance/run.sh +++ b/test/ietf-conformance/run.sh @@ -2,7 +2,7 @@ # Pinned upstream conformance under the relay profile, subgroup zero, one relay. set -euo pipefail -if [[ "${GITHUB_ACTIONS:-}" != true && "${MOQ_LOCAL_SUPERVISED:-}" != 1 ]]; then +if [[ "${GITHUB_ACTIONS:-}" != true && "${LOCAL_SUPERVISED:-}" != 1 ]]; then exec bash "$(dirname "$0")/../../sh/local.sh" bash "$0" "$@" fi @@ -19,7 +19,7 @@ relay="$WORKSPACE/${CARGO_TARGET_DIR:-target}/debug/moq-relay" # Cargo accepts an absolute target directory too. [[ "${CARGO_TARGET_DIR:-}" != /* ]] || relay="$CARGO_TARGET_DIR/debug/moq-relay" -harness_begin ietf-conformance "$(harness_env MOQ_TEST_RESULTS)just test ietf-conformance" +harness_begin ietf-conformance "$(harness_env HARNESS_RESULTS)just test ietf-conformance" python3 "$CONFORMANCE_DIR/prepare.py" "$package/share/moxygen/conformance_test.sh" "$HARNESS_RUN/conformance.sh" # LibreSSL in the dev shell has no system-wide openssl.cnf. cat >"$HARNESS_RUN/openssl.cnf" <<'EOF' diff --git a/test/interop/README.md b/test/interop/README.md index 3e0ad28f65e..d3e719bd1cf 100644 --- a/test/interop/README.md +++ b/test/interop/README.md @@ -484,7 +484,7 @@ and any claim about physical playback. The relay's port is reserved for the run rather than fixed, so two checkouts can run the interop test at once; `INTEROP_PORT` pins one instead. A failing run keeps its directory, including a Playwright trace of the failing page, and CI uploads it; -`MOQ_TEST_KEEP=1` keeps a passing run's too. See [the harness +`HARNESS_KEEP=1` keeps a passing run's too. See [the harness contract](../README.md). ## Layout @@ -530,7 +530,7 @@ table of publisher by subscriber for each suite, case, transport, and version, p workflow step's outcome. A red cell links to its run and to the failure artifact, and its tooltip names the log inside that artifact. -The report reads records, never logs. With `MOQ_TEST_RESULTS` set, `interop.sh` and +The report reads records, never logs. With `HARNESS_RESULTS` set, `interop.sh` and `compat.sh` append one JSON line per case through `harness_result` (`test/lib/harness.sh`): suite, case, publisher, subscriber, transport, version, outcome, seconds, detail, and log. A run first records every case it will reach as `not run`, before building @@ -539,7 +539,7 @@ rather than missing ones. Transport and version are `auto` where each client neg its own; a pinned pass, the drop lanes, and wire-compat record their version. `report.py` renders the page: ```bash -MOQ_TEST_RESULTS=/tmp/results.jsonl just test interop +HARNESS_RESULTS=/tmp/results.jsonl just test interop just test interop-report /tmp/results.jsonl /tmp/interop-report ``` diff --git a/test/interop/clients/js/harness.ts b/test/interop/clients/js/harness.ts index 6787e9453a0..51155355bbe 100644 --- a/test/interop/clients/js/harness.ts +++ b/test/interop/clients/js/harness.ts @@ -83,7 +83,7 @@ export const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve * file of its own. */ export function serve(files: Record = {}): { origin: string; stop: () => void } { - const run = process.env.MOQ_TEST_RUN; + const run = process.env.HARNESS_RUN_DIR; const root = run ? join(run, "js-dist") : join(new URL(".", import.meta.url).pathname, "dist"); const server = Bun.serve({ port: 0, @@ -142,18 +142,18 @@ const traces: Array<{ context: BrowserContext; name: string }> = []; /** * Start a Playwright trace on the page's context, before it navigates. * - * A no-op outside a harness run: without `MOQ_TEST_RUN` there is no directory to write to, and a + * A no-op outside a harness run: without `HARNESS_RUN_DIR` there is no directory to write to, and a * trace only survives a failure anyway. See {@link finishTraces}. */ export async function startTrace(page: Page, name: string): Promise { - if (!process.env.MOQ_TEST_RUN) return; + if (!process.env.HARNESS_RUN_DIR) return; await page.context().tracing.start({ screenshots: true, snapshots: true }); traces.push({ context: page.context(), name: `${name}-${randomUUID()}` }); } /** Save a trace per started context into the run directory when `failed`, and discard it otherwise. */ export async function finishTraces(failed: boolean): Promise { - const run = process.env.MOQ_TEST_RUN; + const run = process.env.HARNESS_RUN_DIR; for (const { context, name } of traces) { try { // `path` is what writes the trace; without it, stop only frees the buffers. diff --git a/test/interop/compat.sh b/test/interop/compat.sh index 17c12f84185..9ed72206a53 100755 --- a/test/interop/compat.sh +++ b/test/interop/compat.sh @@ -2,7 +2,7 @@ # Compare this checkout with registry releases using the existing interop drivers. set -euo pipefail -if [[ "${GITHUB_ACTIONS:-}" != true && "${MOQ_LOCAL_SUPERVISED:-}" != 1 ]]; then +if [[ "${GITHUB_ACTIONS:-}" != true && "${LOCAL_SUPERVISED:-}" != 1 ]]; then exec bash "$(dirname "$0")/../../sh/local.sh" bash "$0" "$@" fi DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) @@ -172,7 +172,7 @@ cell() { ran=$((ran + 1)) echo "=== $name${planned:+ (planned break $planned)} ===" # The nested interop.sh runs are this cell, not cases of their own. - if (unset MOQ_TEST_RESULTS && "$@"); then + if (unset HARNESS_RESULTS && "$@"); then echo "PASS $name" result=pass else @@ -188,7 +188,7 @@ cell() { fetch() { local relay="$1" pub="$2" sub="$3" js="$4" version="$5" - RELAY_BIN="$relay" MOQ_BIN="$pub" INTEROP_SUB_MOQ="$sub" INTEROP_VERSION="$version" \ + RELAY_BIN="$relay" CLI_BIN="$pub" INTEROP_SUB_MOQ="$sub" INTEROP_VERSION="$version" \ INTEROP_COMPAT_CLIENT="$js" INTEROP_FETCH_TRACK=1 \ bash "$DIR/interop.sh" --publishers rust --subscribers rust } @@ -205,7 +205,7 @@ while read -r source version <&3; do exit 1 ;; esac - cell media-control "$version" "$source" "$source" env RELAY_BIN="$relay" MOQ_BIN="$pub" INTEROP_SUB_MOQ="$pub" INTEROP_VERSION="$version" \ + cell media-control "$version" "$source" "$source" env RELAY_BIN="$relay" CLI_BIN="$pub" INTEROP_SUB_MOQ="$pub" INTEROP_VERSION="$version" \ INTEROP_COMPAT_CLIENT="$js" INTEROP_DECODE=1 bash "$DIR/interop.sh" --subscribers rust,js-native-node done 3<"$HARNESS_RUN/controls" @@ -244,14 +244,14 @@ while read -r version <&3; do fi # One cell per reader, so a planned break in one reader's release keeps the other running. for reader in rust js-native-node; do - cell "media-$reader" "$version" "$relay_source" "$source" env RELAY_BIN="$relay" MOQ_BIN="$pub" INTEROP_SUB_MOQ="$sub" INTEROP_VERSION="$version" \ + cell "media-$reader" "$version" "$relay_source" "$source" env RELAY_BIN="$relay" CLI_BIN="$pub" INTEROP_SUB_MOQ="$sub" INTEROP_VERSION="$version" \ INTEROP_COMPAT_CLIENT="$other_js" INTEROP_DECODE=1 bash "$DIR/interop.sh" --subscribers "$reader" done [[ "$released_fetch" == true && "$current_fetch" == true ]] || continue # Drive JS publication from actual subscriber demand: the publisher's own JS # subscribes and observes the group, which the opposite Rust CLI then # FETCHes by ID. Reading the newest group races its live delivery. - cell js-publish "$version" "$relay_source" "$source" env RELAY_BIN="$relay" MOQ_BIN="$pub" INTEROP_SUB_MOQ="$sub" INTEROP_VERSION="$version" \ + cell js-publish "$version" "$relay_source" "$source" env RELAY_BIN="$relay" CLI_BIN="$pub" INTEROP_SUB_MOQ="$sub" INTEROP_VERSION="$version" \ INTEROP_COMPAT_CLIENT="$own_js" INTEROP_FETCH_DATA=1 bash "$DIR/interop.sh" --publishers js-native --subscribers rust # Both Rust sources fetch the same group and compare exact payloads. The # publisher's own JS finds the group, so a catalog break fails only the diff --git a/test/interop/interop.sh b/test/interop/interop.sh index b3d392c568a..5839e06fbb2 100755 --- a/test/interop/interop.sh +++ b/test/interop/interop.sh @@ -31,7 +31,7 @@ # version per pass, such as each even moq-transport draft (`--versions ietf`). set -euo pipefail -if [[ "${GITHUB_ACTIONS:-}" != true && "${MOQ_LOCAL_SUPERVISED:-}" != 1 ]]; then +if [[ "${GITHUB_ACTIONS:-}" != true && "${LOCAL_SUPERVISED:-}" != 1 ]]; then exec bash "$(dirname "$0")/../../sh/local.sh" bash "$0" "$@" fi @@ -50,7 +50,7 @@ source "$INTEROP_DIR/../lib/harness.sh" # Captured before the parse below consumes it, so the rerun command carries every # flag and every environment override this run was actually given. -RERUN="$(harness_env INTEROP_TIMEOUT INTEROP_FPS INTEROP_SIZE INTEROP_PORT INTEROP_PROFILE RELAY_BIN MOQ_BIN INTEROP_SUB_MOQ INTEROP_VERSION INTEROP_COMPAT_CLIENT INTEROP_DECODE INTEROP_FETCH_DATA INTEROP_FETCH_TRACK)just test interop$(harness_argv "$@")" +RERUN="$(harness_env INTEROP_TIMEOUT INTEROP_FPS INTEROP_SIZE INTEROP_PORT INTEROP_PROFILE RELAY_BIN CLI_BIN INTEROP_SUB_MOQ INTEROP_VERSION INTEROP_COMPAT_CLIENT INTEROP_DECODE INTEROP_FETCH_DATA INTEROP_FETCH_TRACK)just test interop$(harness_argv "$@")" PUBLISHERS="rust" SUBSCRIBERS="rust" @@ -59,7 +59,7 @@ SUBSCRIBERS="rust" # can't be held to them: a released client may not close cleanly, a released relay names no # connection when one closes, and the tail clients are built from this checkout only. IN_TREE=1 -if [[ -n "${RELAY_BIN:-}${MOQ_BIN:-}${INTEROP_SUB_MOQ:-}${INTEROP_COMPAT_CLIENT:-}" ]]; then +if [[ -n "${RELAY_BIN:-}${CLI_BIN:-}${INTEROP_SUB_MOQ:-}${INTEROP_COMPAT_CLIENT:-}" ]]; then IN_TREE=0 fi TIMEOUT="${INTEROP_TIMEOUT:-20}" @@ -86,9 +86,9 @@ IETF_VERSIONS="moq-transport-14,moq-transport-16,moq-transport-18,moq-transport- PROFILE="${INTEROP_PROFILE:-debug}" # Binaries under test. Built from source below unless overridden to point at a -# prebuilt (mirrors test/smoke's RELAY_BIN/MOQ_BIN escape hatch). +# prebuilt (mirrors test/smoke's RELAY_BIN/CLI_BIN escape hatch). RELAY="${RELAY_BIN:-}" -MOQ="${MOQ_BIN:-}" +MOQ="${CLI_BIN:-}" require_value() { # require_value "$@": the flag plus the rest of the argv. Ensures a @@ -331,7 +331,7 @@ COMPRESS_VERSIONS=(moq-lite-07-wip moq-lite-06) # checks audio only in its decoding media lanes, and the bindings' clients, which always check it, # refuse to run in the rest. AUDIO=1 -[[ -z "${MOQ_BIN:-}${INTEROP_SUB_MOQ:-}${INTEROP_COMPAT_CLIENT:-}" || "${INTEROP_DECODE:-0}" == 1 ]] || AUDIO=0 +[[ -z "${CLI_BIN:-}${INTEROP_SUB_MOQ:-}${INTEROP_COMPAT_CLIENT:-}" || "${INTEROP_DECODE:-0}" == 1 ]] || AUDIO=0 if [[ "$AUDIO" -eq 0 ]]; then for sub in "${SUB_LIST[@]}"; do case "$sub" in @@ -340,7 +340,7 @@ if [[ "$AUDIO" -eq 0 ]]; then *) sub_needs_audio="$sub" ;; esac if [[ -n "${sub_needs_audio:-}" ]]; then - echo "error: the $sub subscriber always checks audio, which a run with MOQ_BIN, INTEROP_SUB_MOQ, or INTEROP_COMPAT_CLIENT turns off without INTEROP_DECODE" >&2 + echo "error: the $sub subscriber always checks audio, which a run with CLI_BIN, INTEROP_SUB_MOQ, or INTEROP_COMPAT_CLIENT turns off without INTEROP_DECODE" >&2 exit 2 fi done diff --git a/test/interop/report.py b/test/interop/report.py index 94d0e6241b0..d4b1093c684 100644 --- a/test/interop/report.py +++ b/test/interop/report.py @@ -65,7 +65,7 @@ def steps(text): def passed(records, suites): """Cases were recorded, nothing failed or went unreached, and something passed. - A run that recorded no case (a lost MOQ_TEST_RESULTS) or skipped every step is not green. + A run that recorded no case (a lost HARNESS_RESULTS) or skipped every step is not green. """ outcomes = [record['outcome'] for record in records] + list(suites.values()) return bool(records) and 'pass' in outcomes and all(outcome in ('pass', 'skip') for outcome in outcomes) diff --git a/test/interop/report.test.py b/test/interop/report.test.py index 0e03ed1ac07..3a7cf25255f 100644 --- a/test/interop/report.test.py +++ b/test/interop/report.test.py @@ -27,7 +27,7 @@ def setUp(self): def harness(self, *args): """Record through the real harness_result, as interop.sh does.""" script = f'source {HERE.parent / "lib" / "harness.sh"}; HARNESS_RUN={self.run}; harness_result "$@"' - env = dict(os.environ, MOQ_TEST_RESULTS=str(self.results)) + env = dict(os.environ, HARNESS_RESULTS=str(self.results)) return subprocess.run(['bash', '-euo', 'pipefail', '-c', script, 'harness', *args], env=env, capture_output=True, text=True) @@ -97,9 +97,9 @@ def test_the_harness_refuses_malformed_records(self): ('pass', 'suite=s', 'case=c', 'outcome=fail'), ('pass', 'suite=s', 'case=c', 'seconds=soon')): self.assertNotEqual(self.harness(*args).returncode, 0, args) self.assertFalse(self.results.exists()) - # Without MOQ_TEST_RESULTS the harness records nothing, for any input. + # Without HARNESS_RESULTS the harness records nothing, for any input. script = f'source {HERE.parent / "lib" / "harness.sh"}; harness_result bogus' - env = {k: v for k, v in os.environ.items() if k != 'MOQ_TEST_RESULTS'} + env = {k: v for k, v in os.environ.items() if k != 'HARNESS_RESULTS'} subprocess.run(['bash', '-euo', 'pipefail', '-c', script], env=env, check=True) def test_the_report_refuses_malformed_records_and_steps(self): diff --git a/test/justfile b/test/justfile index 8e8911e39a2..b0544b043af 100644 --- a/test/justfile +++ b/test/justfile @@ -71,7 +71,7 @@ interop *args: --run-ignored all ./interop/interop.sh "$@" -# The harnesses append one record per case to MOQ_TEST_RESULTS; flags link the page to its +# The harnesses append one record per case to HARNESS_RESULTS; flags link the page to its # workflow run. See interop/report.py. # Render interop case records as a static HTML report. @@ -278,5 +278,5 @@ p2p: # Retain complete backend assets, parity, and raw alternating browser samples. [positional-arguments] wasm-baseline *args: - MOQ_TEST_RUNS="${MOQ_TEST_RUNS:-../target/test/wasm-backend}" ./wasm/run.sh "$@" - MOQ_TEST_RUNS="${MOQ_TEST_RUNS:-../target/test/wasm-backend}" ./wasm/run.sh --baseline "$@" + HARNESS_RUNS="${HARNESS_RUNS:-../target/test/wasm-backend}" ./wasm/run.sh "$@" + HARNESS_RUNS="${HARNESS_RUNS:-../target/test/wasm-backend}" ./wasm/run.sh --baseline "$@" diff --git a/test/lib/harness.sh b/test/lib/harness.sh index 196ccaa98c7..bc8e04497d6 100644 --- a/test/lib/harness.sh +++ b/test/lib/harness.sh @@ -65,7 +65,7 @@ harness_argv() { # is exactly what a collision or a filesystem failure depends on. harness_env() { local name value - for name in MOQ_TEST_RUNS MOQ_TEST_PORTS MOQ_TEST_PORT_BASE MOQ_TEST_KEEP "$@"; do + for name in HARNESS_RUNS HARNESS_PORT_ROOT HARNESS_PORT_BASE HARNESS_KEEP "$@"; do value="${!name-}" [[ -n "$value" ]] || continue printf '%s=%q ' "$name" "$value" @@ -77,9 +77,9 @@ harness_env() { harness_begin() { local name="$1" rerun="${2:-}" - local root="${MOQ_TEST_RUNS:-${TMPDIR:-/tmp}}" + local root="${HARNESS_RUNS:-${TMPDIR:-/tmp}}" root="${root%/}" - [[ -n "${MOQ_TEST_RUNS:-}" ]] || root="$root/moq-test-$(id -u)" + [[ -n "${HARNESS_RUNS:-}" ]] || root="$root/moq-test-$(id -u)" mkdir -p "$root" # Harnesses change directory after this, so a relative root would move under them. root=$(CDPATH='' cd -- "$root" && pwd) @@ -90,7 +90,7 @@ harness_begin() { HARNESS_RERUN="$rerun" # The browser drivers cannot see a shell variable, and a Playwright trace has # to land beside the logs it explains, so the path rides the environment. - export MOQ_TEST_RUN="$HARNESS_RUN" + export HARNESS_RUN_DIR="$HARNESS_RUN" # Cancellation needs its own traps: children run in their own process groups # (see `harness_spawn`), so a ^C aimed at this shell's group never reaches @@ -111,9 +111,9 @@ harness_begin() { # host network. Keep claims in /tmp regardless of each shell's scratch root. # The user id avoids ownership conflicts with another user's harnesses. harness_port_root() { - local root="${MOQ_TEST_PORTS:-/tmp}" + local root="${HARNESS_PORT_ROOT:-/tmp}" root="${root%/}" - [[ -n "${MOQ_TEST_PORTS:-}" ]] || root="$root/moq-test-ports-$(id -u)" + [[ -n "${HARNESS_PORT_ROOT:-}" ]] || root="$root/moq-test-ports-$(id -u)" echo "$root" } @@ -131,7 +131,7 @@ harness_valid_port() { # # `harness_port