diff --git a/quest/m1/README.md b/quest/m1/README.md index 38a87c57bec..ac0520b5ee9 100644 --- a/quest/m1/README.md +++ b/quest/m1/README.md @@ -87,7 +87,6 @@ disabled rung strands WHEP, HLS, and moq-mux export viewers. - [Untimed lite-07](/quest/m1/lite-untimed.md) - lite-07 carries an untimed track in both languages; lite-05/06 write send time - [A watch and publish release ships assets()](/quest/m1/assets-release.md) - the release that lets the sites host the worklets - [Dogfood hosted worklets](/quest/m1/dogfood-assets.md) - the moq.pro dashboard hosts the worklets and calls `assets()` after the release -- [Initial catalog routing](/quest/m1/initial-catalog-routing.md) - a usable fallback does not strand initial catalog acquisition with a spurious Unroutable - [Live TS clock validation](/quest/m1/ts-live-clock.md) - resolve the local PCR-rate failure with reproducible timing evidence and CI controls - [Same-instance TS resume](/quest/m1/ts-same-instance-resume.md) - prove valid continuation and fix the unexpected final exporter failure without weakening identity - [More tests under load](/quest/m1/test-flakes-2/README.md) - the second round of load-only failures, one quest per flake, fixed at the cause diff --git a/quest/m1/initial-catalog-routing.md b/quest/m1/initial-catalog-routing.md deleted file mode 100644 index c29da821975..00000000000 --- a/quest/m1/initial-catalog-routing.md +++ /dev/null @@ -1,61 +0,0 @@ -# [M] Initial catalog acquisition survives a usable transport fallback - -## Goal - -Fix the initial `catalog.json` routing failure observed by TS validation, -with a deterministic regression and an automated round trip. A publisher -remaining available on a usable path must not leave the subscriber with a -spurious `Unroutable`; genuine refusal or disappearance still fails explicitly. - -## Plan - -Decided with the maintainer on 2026-10-11: reproduce and fix the cause, not -stop at diagnosis. This is independent of the pair grader's acquisition -contract. It is not a general transport redesign or a TS-specific retry path. - -Local live, EIT and HRD runs during #5328 failed their initial `catalog.json` -track-info request shortly after selecting WebSocket fallback. The exporter -exited one with `moq: unroutable`; the publisher continued to normal EOF and -exited zero. The live grader received zero packets. Live and EIT ran -concurrently; HRD reproduced later. Do not count these as three independent -sequential reproductions. The full PR TS job passed, including EIT and HRD; -its event skipped the live and pair arms. No transport root cause is established. - -Trace the failing initial request across publication discovery, catalog -availability, route selection and any session replacement. Preserve enough -session/broadcast/request identity to distinguish a real unavailable route -from a stale handle or handover race. First check current main and #5284: -that PR preserves a pending QUIC dial after an early WebSocket close, but -similar timing is not proof that it fixes this failure. If it owns the same -cause, add the missing regression there and verify the landed fix instead of -creating competing implementations. Otherwise keep the fix focused on the -layer that loses the usable route. - -Turn the observed ordering into a controlled regression before changing -behavior. Hold or order the relevant events and mock time where needed; -do not rely on load, sleeps, repeated reruns or larger timeouts to reproduce -or hide the failure. Cover the successful fallback/acquisition path and the -adjacent terminal path so a fix cannot silently retry genuine refusal or -keep a disappeared publication alive. Preserve existing broadcast/track -identity and epoch semantics. - -Verify the affected path with the TS round-trip harness and its existing -process-status, nonempty-content and decoder assertions. A successful rerun -alone does not finish the quest. Wire every regression and any new controls -into CI, with long live coverage at least nightly; retain diagnostic logs -and failing fixtures. Keep the publisher and exporter statuses in the verdict. - -Keep the older short-duration capture regression and midstream `--stitch` -catalog-linger work separate unless reproduction establishes the same cause. -Update comments and affected feature docs with the fix. No new guide, public -API or wire change is expected; a newly required contract needs a maintainer -decision rather than an invented retry or compatibility layer. - -## Related - -- [Validation PR #5328](https://github.com/moq-dev/moq/pull/5328) - records the process failures and successful PR CI baseline -- [Fallback PR #5284](https://github.com/moq-dev/moq/pull/5284) - check its actual effect on this reproduction before duplicating work -- [Transport upgrade](/quest/m1/transport-upgrade/README.md) - existing handover and epoch contracts -- [TS duration fidelity](/quest/m0/ts-duration-fidelity.md) - previously captured only a short suffix, not zero-packet initial acquisition -- [Replacement catalog linger #5305](https://github.com/moq-dev/moq/pull/5305) - bounds a midstream stitch, not initial discovery -- [Pair validation](/test/ts/README.md#table-anchoring-table-anchorpy) - independent grader/acquisition checks diff --git a/rs/moq-net/tests/catalog_acquisition.rs b/rs/moq-net/tests/catalog_acquisition.rs new file mode 100644 index 00000000000..b0d0c60719a --- /dev/null +++ b/rs/moq-net/tests/catalog_acquisition.rs @@ -0,0 +1,80 @@ +//! Initial catalog acquisition while the same publisher gains a second session. + +mod support; + +use moq_net::{Error, Hop, Version, origin}; +use support::harness::{MockConnectOptions, MockPair, connect_mock}; + +fn origin(hop: u64) -> origin::Producer { + let (producer, driver) = origin::Producer::new(origin::Config::new(Hop::new(hop).unwrap())); + support::harness::spawn(driver); + producer +} + +async fn link(version: Version, from: &origin::Producer, to: &origin::Producer, cost: u64) -> MockPair { + let mut options = MockConnectOptions::new(version); + options.server_publish = Some(from.consume()); + options.client_subscribe = Some(to.clone()); + options.cost = Some(cost); + connect_mock(options).await +} + +async fn acquisition(version: &str) { + let version: Version = version.parse().unwrap(); + let publisher = origin(1); + let subscriber = origin(2); + let broadcast = publisher.create_broadcast("live").unwrap(); + let mut dynamic = broadcast.dynamic(); + broadcast + .announce(origin::Route::default().with_epoch(moq_net::Epoch::mint())) + .unwrap(); + let _old = link(version, &publisher, &subscriber, 100).await; + let remote = subscriber.consume().routed_broadcast("live").await.unwrap(); + let mut announced = subscriber.consume().follow("live").unwrap(); + let old_cost = match announced.next().await { + Some(moq_net::announce::Event::Start(announce)) => announce.route.cost, + other => panic!("expected the first route, got {other:?}"), + }; + let mut pending = Box::pin(remote.track("catalog.json").unwrap().subscribe(None)); + let request = match futures::future::select(Box::pin(dynamic.requested_track()), &mut pending).await { + futures::future::Either::Left((request, _)) => request.unwrap(), + _ => panic!("catalog resolved before the publisher answered"), + }; + // The publisher is still available and the old session remains alive. Holding + // TRACK_INFO makes the replacement happen during acquisition without sleeps. + let _new = link(version, &publisher, &subscriber, 1).await; + // An epochless replacement restarts the advertisement; a matching epoch only updates it. + let lite07 = version == "moq-lite-07-wip".parse().unwrap(); + let new_cost = match announced.next().await { + Some(moq_net::announce::Event::Update(announce)) if lite07 => announce.route.cost, + Some(moq_net::announce::Event::Restart(announce)) if !lite07 => announce.route.cost, + other => panic!("{version}: unexpected route change {other:?}"), + }; + assert!(new_cost < old_cost, "the cheaper session wins the route"); + let track = request.accept(None); + let mut group = track.append_group().unwrap(); + group.write_frame(None, b"catalog".to_vec()).unwrap(); + group.finish().unwrap(); + let result = pending.await; + if lite07 { + let mut subscription = result.expect("same epoch must acquire"); + let mut group = subscription.recv_group().await.unwrap().unwrap(); + assert_eq!(group.read_frame().await.unwrap().unwrap().payload.as_ref(), b"catalog"); + } else { + assert!( + matches!(result, Err(Error::Unroutable)), + "epochless replacement: {:?}", + result.err() + ); + } +} + +#[moq_net_sim::test] +async fn epochless_replacement_refuses_pending_catalog() { + acquisition("moq-lite-06").await; +} + +#[moq_net_sim::test] +async fn same_epoch_replacement_acquires_pending_catalog() { + acquisition("moq-lite-07-wip").await; +}