From 56ef98b187c225cfcc225499518845f28fad364e Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Mon, 26 Oct 2026 18:10:34 -0700 Subject: [PATCH 1/3] chore(quest): claim quest/m1/bbr-test-seed.md Quest-Claim: 1c96622568f1f27a From b1ea872e8b60eeccb1d39682ae3789bab48cb6cb Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Mon, 26 Oct 2026 18:20:07 -0700 Subject: [PATCH 2/3] fix(congestion): seed default BBR3 controllers in unit tests Use a fixed cfg(test) fallback while preserving explicit seeds and production entropy. Keep the quest open for full validation after unrelated base Rust failures. Co-Authored-By: Codex --- quest/m1/bbr-test-seed.md | 24 ++++++++++++++++------ rs/moq-congestion/src/bbr3/mod.rs | 34 +++++++++++++++++++++++-------- 2 files changed, 44 insertions(+), 14 deletions(-) diff --git a/quest/m1/bbr-test-seed.md b/quest/m1/bbr-test-seed.md index b75c4bde4ce..6b5b77a1189 100644 --- a/quest/m1/bbr-test-seed.md +++ b/quest/m1/bbr-test-seed.md @@ -8,9 +8,21 @@ replays the same randomness on every run, as it did before ## Plan -- `Bbr3::new` falls back to `Pcg32::from_rng(&mut rand::rng())` - (`rs/moq-congestion/src/bbr3/mod.rs`, about line 620); before the extraction - it used `crate::entropy::rng()`, which tests seeded per thread. -- Under `cfg(test)`, fall back to a fixed seed (moq-quic already reseeds its - own tests in `rs/moq-quic/src/config/transport.rs`). Production keeps OS - randomness. +Implemented on this branch: `Bbr3::new` falls back to a fixed seed under +`cfg(test)`. Explicit seeds retain their precedence, and production retains +OS randomness. Two default controllers now replay their probe schedules; +before the fix their first waits were 2.193 s and 2.292 s. The selected suite +passes 96 tests, with one existing skip, including the explicit-seed test. + +Remaining: finish the required scoped gates once the unrelated base Rust +failures are fixed, then remove this quest. + +- `just fix` reaches `rs/moq-mux/benches/catalog.rs:226`, which still refers + to the `hang::catalog::MAX_RENDITIONS` constant removed by + [moq-dev/moq#6827](https://github.com/moq-dev/moq/pull/6827). The benchmark + arrived in [moq-dev/moq#6784](https://github.com/moq-dev/moq/pull/6784). +- `just rs fix -p moq-congestion` passes. Its unrelated CARLA formatting + output was restored; the base's `demo/carla/bridge` files still fail the + workspace-wide format check. No open fix was found before this checkpoint. +- Run `just ci` on the clean committed head; this checkpoint leaves full + validation pending rather than relaxing the gate or mixing base repairs. diff --git a/rs/moq-congestion/src/bbr3/mod.rs b/rs/moq-congestion/src/bbr3/mod.rs index 89836b795ae..ed73ddbf4a8 100644 --- a/rs/moq-congestion/src/bbr3/mod.rs +++ b/rs/moq-congestion/src/bbr3/mod.rs @@ -529,12 +529,18 @@ impl Bbr3 { /// equivalent to BBROnInit fn new(config: Arc, init: Init) -> Self { - let probe_rng: Pcg32; - if let Some(probe_seed) = config.probe_rng_seed { - probe_rng = Pcg32::from_seed(probe_seed); + let probe_rng = if let Some(probe_seed) = config.probe_rng_seed { + Pcg32::from_seed(probe_seed) } else { - probe_rng = Pcg32::from_rng(&mut rand::rng()); - } + #[cfg(test)] + { + Pcg32::from_seed([0; 16]) + } + #[cfg(not(test))] + { + Pcg32::from_rng(&mut rand::rng()) + } + }; let smss = Ord::min( Ord::max(MIN_MAX_DATAGRAM_SIZE, init.mtu) as u64, MAX_DATAGRAM_SIZE, @@ -2317,6 +2323,19 @@ mod test { } } + #[test] + fn default_probe_schedule_replays() { + let mut first = Driver::new(Arc::new(Bbr3Config::default()), 2500); + let mut replay = Driver::new(Arc::new(Bbr3Config::default()), 2500); + for _ in 0..8 { + first.pick_probe_wait(); + replay.pick_probe_wait(); + assert_eq!(first.rounds_since_bw_probe, replay.rounds_since_bw_probe); + assert_eq!(first.bw_probe_wait, replay.bw_probe_wait); + assert_eq!(first.reno_rounds_bound, replay.reno_rounds_bound); + } + } + #[test] fn test_probe_rng() { let seed: [u8; 16] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; @@ -6647,10 +6666,9 @@ mod test { // bottleneck serialization time for one MSS-sized packet let btl_service_ns: u64 = (MSS as f64 / BW * 1e9).round() as u64; - // Production default, but pin the probe RNG: once app-limiting lifts at the + // Pin this scenario's probe schedule: once app-limiting lifts at the // PROBE_REFILL -> PROBE_UP edge the flow does genuine PROBE_BW cycling, whose - // phase timing is RNG-driven, and default() seeds from entropy (cf. sibling - // probing tests). + // phase timing is RNG-driven (cf. sibling probing tests). let config = Bbr3Config { probe_rng_seed: Some([6; 16]), ..Bbr3Config::default() From cc8f44be8e1fd30861167023c84d40643df8e013 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Mon, 26 Oct 2026 20:18:30 -0700 Subject: [PATCH 3/3] quest(congestion): complete deterministic BBR test defaults The full isolated gate passes. Remove the completed quest and its milestone link; production and explicit-seed behavior remain unchanged. Co-Authored-By: Codex --- quest/m1/README.md | 1 - quest/m1/bbr-test-seed.md | 28 ---------------------------- 2 files changed, 29 deletions(-) delete mode 100644 quest/m1/bbr-test-seed.md diff --git a/quest/m1/README.md b/quest/m1/README.md index df699f8d8ac..ec37a7735f7 100644 --- a/quest/m1/README.md +++ b/quest/m1/README.md @@ -161,7 +161,6 @@ surface and zero-copy texture import, land before the cut. - [HLS takeover leak](/quest/m1/hls-takeover-leak.md) - a replaced instance's recording cursor never yields the replacement's media, and ends or fails instead of stalling - [HLS and DASH segment conformance](/quest/m1/hls-conformance.md) - nightly ffprobe checks that advertised timing, sync flags, and bytes match the media served - [App-limited BBR3 estimate ages](/quest/m1/bbr-app-limited.md) - an app-limited BBR3 estimate falls within seconds after the path drops -- [Seeded BBR3 in tests](/quest/m1/bbr-test-seed.md) - unseeded `Bbr3Config::default()` tests replay the same randomness - [Aborted epoch reads keep their cause](/quest/m1/epoch-abort-cause.md) - an aborted read through an epoch route ends with its own error, not NotFound - [Bindings name every session code](/quest/m1/ffi-malformed-auth-kind.md) - MALFORMED_AUTH_TOKEN and its siblings reach moq-ffi, moq-c, and the wrappers - [A profiling host](/quest/m1/perf-host.md) - condition: a quiet host with `perf_event_paranoid=-1`, recorded in `bench/README.md` diff --git a/quest/m1/bbr-test-seed.md b/quest/m1/bbr-test-seed.md deleted file mode 100644 index 6b5b77a1189..00000000000 --- a/quest/m1/bbr-test-seed.md +++ /dev/null @@ -1,28 +0,0 @@ -# [XS] Seeded BBR3 in tests - -## Goal - -Every moq-congestion test that builds `Bbr3Config::default()` without a seed -replays the same randomness on every run, as it did before -[moq-dev/moq#6602](https://github.com/moq-dev/moq/pull/6602). - -## Plan - -Implemented on this branch: `Bbr3::new` falls back to a fixed seed under -`cfg(test)`. Explicit seeds retain their precedence, and production retains -OS randomness. Two default controllers now replay their probe schedules; -before the fix their first waits were 2.193 s and 2.292 s. The selected suite -passes 96 tests, with one existing skip, including the explicit-seed test. - -Remaining: finish the required scoped gates once the unrelated base Rust -failures are fixed, then remove this quest. - -- `just fix` reaches `rs/moq-mux/benches/catalog.rs:226`, which still refers - to the `hang::catalog::MAX_RENDITIONS` constant removed by - [moq-dev/moq#6827](https://github.com/moq-dev/moq/pull/6827). The benchmark - arrived in [moq-dev/moq#6784](https://github.com/moq-dev/moq/pull/6784). -- `just rs fix -p moq-congestion` passes. Its unrelated CARLA formatting - output was restored; the base's `demo/carla/bridge` files still fail the - workspace-wide format check. No open fix was found before this checkpoint. -- Run `just ci` on the clean committed head; this checkpoint leaves full - validation pending rather than relaxing the gate or mixing base repairs.