From 5cc19cc1597fe0ed410efdaab59d5a5349f8a85a Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Fri, 20 Nov 2026 17:13:20 -0800 Subject: [PATCH 1/3] chore(quest): claim quest/m0/ci/rust-test-reads.md Quest-Claim: 89eb59e90651f0f6 From 6cc3161beece63547e2e5b27e73d902604201fd1 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Fri, 20 Nov 2026 17:25:33 -0800 Subject: [PATCH 2/3] ci: Rust tests run when a file they read outside rs changes sh/rs/reads.sh lists every path a Rust source reads outside its crate. select.sh seeds the reading crate from it, replacing the hand-kept NixOS module seed, and select.test.py holds dispatch's rs scope to cover every read outside rs/, run by `just gh check` on every diff. Co-Authored-By: Claude Opus 5.5 --- .github/justfile | 3 +- quest/m0/ci/rust-test-reads.md | 54 -------------------------------- rs/moq-audio/src/jitter.rs | 3 +- rs/moq-net/src/ietf/publisher.rs | 5 ++- rs/moq-net/src/test_interop.rs | 25 +++++++-------- rs/moq-relay/src/config.rs | 39 +++++++++++++---------- sh/dispatch.sh | 10 +++--- sh/rs/reads.sh | 47 +++++++++++++++++++++++++++ sh/rs/select.sh | 17 ++++++++-- sh/rs/select.test.py | 50 ++++++++++++++++++++++++++--- 10 files changed, 151 insertions(+), 102 deletions(-) delete mode 100644 quest/m0/ci/rust-test-reads.md create mode 100755 sh/rs/reads.sh diff --git a/.github/justfile b/.github/justfile index 20c60bce7f..bb845950e4 100644 --- a/.github/justfile +++ b/.github/justfile @@ -48,7 +48,7 @@ runner-userns: runner-vm: bash sh/local.sh nix build --no-link .#checks.x86_64-linux.github-runner-vm .#checks.x86_64-linux.github-runner-vm-image .#checks.x86_64-linux.github-runner-vm-config --print-build-logs -# Lint GitHub Actions workflows, their security, their alert coverage, that every step runs a recipe, that every opt-in test has a caller, and that every benchmark test Nightly filters on still exists in the Rust sources. +# Lint GitHub Actions workflows, their security, their alert coverage, that every step runs a recipe, that every opt-in test has a caller, that every benchmark test Nightly filters on still exists in the Rust sources, and that the gate's Rust scope covers every file the Rust sources read outside rs/. check: python3 sh/version.py actionlint @@ -59,6 +59,7 @@ check: python3 sh/gh/test-inventory.py python3 bench/relay.test.py python3 sh/gh/nightly.test.py NightlyTest.test_every_nightly_benchmark_test_exists + python3 sh/rs/select.test.py SelectTest.test_dispatch_scope_covers_rust_reads # Repository tooling tests; the merge gate runs every ordinary test file whole when tooling changes. test: diff --git a/quest/m0/ci/rust-test-reads.md b/quest/m0/ci/rust-test-reads.md deleted file mode 100644 index e725bad449..0000000000 --- a/quest/m0/ci/rust-test-reads.md +++ /dev/null @@ -1,54 +0,0 @@ -# [M] Rust tests run when a file they read outside rs changes - -## Goal - -A change to any file a Rust test or build reads selects the Rust work that -reads it in `just check` and `just ci`, the way a change to the test does. One -check keeps it so: a new Rust read of a path the `rs` scope in -`sh/dispatch.sh` misses fails `just check`, naming the path. Today such a -change skips the Rust tests, so a broken read lands. - -## Plan - -Caused by [moq-dev/moq#8459](https://github.com/moq-dev/moq/pull/8459), -fixed by [moq-dev/moq#8486](https://github.com/moq-dev/moq/pull/8486): a new -`test/**.toml` broke a relay test that parses it, and the gate had scoped the -Rust tests out. #8486 moved the file but left the scope as it was. The -2026-11-11 and 2026-11-18 mistake audits in moq-dev/quest -([moq-dev/quest#641](https://github.com/moq-dev/quest/pull/641), -[moq-dev/quest#786](https://github.com/moq-dev/quest/pull/786)) both kept it. - -Decided 2026-11-19 (maintainer): ✅ each read either moves into its crate or -is covered by widening the `rs` scope, with no hand-kept list of what a crate -reads (rejected: each crate declaring its outside reads in `Cargo.toml`; -moving every read in-crate as the only option). - -Reads outside `rs/` that the `rs` scope misses today, found by grepping -`CARGO_MANIFEST_DIR` joins and `include_*!` paths: - -- `test/receive-credit/sender.ts`, `test/max-age/client.ts`, - `test/stream-limits/client.ts`, `test/relay-fill/relay.ts`, and - `test/datagram-tracks/client.ts`, which moq-tokio's and moq-uring's - integration tests run. -- `doc/concept/audio-jitter/{stretch,comfort}/*.json`, which moq-audio - includes. -- moq-relay's `repository_configs_load`, which loads every tracked TOML - under `demo/relay`, `packaging`, and `test`. - -Recommended: - -- Move a file into its crate when only Rust reads it. Widen the scope for a - file that lives where it does for another reason, such as a TS script the - JS side also checks, or a config a deployment ships. A widened path selects - the whole workspace, since nothing else maps it to a crate. Narrow each - widened pattern to the files read, such as `test/**.toml` rather than - `test/`, and give the PR a count of how often those paths changed in recent - history. That count is the gate's cost. -- `sh/rs/select.sh`'s seed from `nix/modules/moq-relay.nix` to moq-relay is - the same kind of hand-kept mapping, so fold it into the same rule. -- The check finds the outside paths a Rust source names, whether through - `CARGO_MANIFEST_DIR` or an `include_*!` path, and fails when the `rs` scope - does not match one. `sh/rs/select.test.py` already checks that the scope - covers targets outside their crate; extend that rather than add a script. -- Show that the check fails on #8459's shape, a new `test/**.toml`, before the - fix, and passes after. diff --git a/rs/moq-audio/src/jitter.rs b/rs/moq-audio/src/jitter.rs index 4d003c4245..0c56be992d 100644 --- a/rs/moq-audio/src/jitter.rs +++ b/rs/moq-audio/src/jitter.rs @@ -588,8 +588,7 @@ pub(crate) mod tests { /// implementation is graded against the other. pub(crate) fn case(name: &str) -> Case { let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR")) - .join("../../doc/concept/audio-jitter") - .join(format!("{name}.json")); + .join(format!("../../doc/concept/audio-jitter/{name}.json")); let json = std::fs::read_to_string(&path).unwrap_or_else(|err| panic!("read {}: {err}", path.display())); serde_json::from_str(&json).unwrap() } diff --git a/rs/moq-net/src/ietf/publisher.rs b/rs/moq-net/src/ietf/publisher.rs index ea8b3809cf..cc218e4087 100644 --- a/rs/moq-net/src/ietf/publisher.rs +++ b/rs/moq-net/src/ietf/publisher.rs @@ -22345,8 +22345,7 @@ mod compression_tests { use crate::lite::test_transport::{Log, SinkSession}; for (version, draft) in [(Version::Draft18, 18), (Version::Draft22, 22)] { let input = serde_json::json!({"draft": draft}); - let bytes: Vec = - serde_json::from_slice(&crate::test_interop::bun("ietf-compression.ts", input)).unwrap(); + let bytes: Vec = serde_json::from_slice(&crate::test_interop::bun("ietf-compression", input)).unwrap(); let (parameters, consumed) = ietf::Parameters::decode_slice(&bytes, version).unwrap(); assert_eq!(consumed, bytes.len()); let negotiated = super::super::flate::from_setup(¶meters).unwrap(); @@ -22384,7 +22383,7 @@ mod compression_tests { let written = log.writes.lock().unwrap().clone(); let input = serde_json::json!({"draft": draft, "response": response.to_vec(), "group": written}); let received: Vec> = - serde_json::from_slice(&crate::test_interop::bun("ietf-compression.ts", input)).unwrap(); + serde_json::from_slice(&crate::test_interop::bun("ietf-compression", input)).unwrap(); assert_eq!(received, frames, "draft{draft}: plain JS fallback"); } } diff --git a/rs/moq-net/src/test_interop.rs b/rs/moq-net/src/test_interop.rs index 9d904febfa..27419ecf5a 100644 --- a/rs/moq-net/src/test_interop.rs +++ b/rs/moq-net/src/test_interop.rs @@ -4,10 +4,10 @@ use crate::coding::{Decoder, Encode, Encoder, Form, varint}; use crate::{ietf, lite}; -// Runs a script with a JSON argument, returning its stdout. +// Runs `test/interop/