From 0406026dc9c09344e3a425273786d0a25d4bd11c Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Wed, 7 Oct 2026 11:30:04 -0700 Subject: [PATCH 1/6] fix(net): skip the empty namespace on draft-14 and draft-15 An empty SUBSCRIBE_NAMESPACE is a protocol violation before draft-16. Do not send one, and keep accepting unsolicited announcements. Co-authored-by: Grok 4.7 --- js/net/src/ietf/subscriber.test.ts | 47 ++++++++++++ js/net/src/ietf/subscriber.ts | 12 ++- rs/moq-net/src/ietf/session.rs | 113 ++++++++++++++++++++++++++++- rs/moq-net/src/ietf/subscriber.rs | 5 +- 4 files changed, 172 insertions(+), 5 deletions(-) diff --git a/js/net/src/ietf/subscriber.test.ts b/js/net/src/ietf/subscriber.test.ts index ff6415c9d58..62f99f5490d 100644 --- a/js/net/src/ietf/subscriber.test.ts +++ b/js/net/src/ietf/subscriber.test.ts @@ -65,6 +65,53 @@ test("every peer is asked", async () => { expect(await nextStream(pair.client)).toBeDefined(); }); +/** + * Draft-16 is the first that allows a zero-field track namespace. Asking for one + * earlier is a protocol violation, and there is no other "every namespace" request, + * so an unscoped subscriber sends nothing and still takes an unsolicited announcement. + */ +test.each([ + ["draft-14", Version.DRAFT_14, ALPN.DRAFT_14], + ["draft-15", Version.DRAFT_15, ALPN.DRAFT_15], +] as const)("%s does not ask for the empty namespace", async (_name, version, alpn) => { + const pair = createMockTransportPair(alpn); + const session = new NativeSession(pair.server, version, true); + const subscriber = new Subscriber({ session }); + const announced = subscriber.announced(); + + expect(await nextStream(pair.client)).toBeUndefined(); + + const stream = await Stream.open(pair.server, { version }); + void subscriber.runPublishNamespace( + new PublishNamespace({ requestId: 0n, trackNamespace: Path.from("surprise") }), + stream, + ); + expect(await announced.next()).toMatchObject({ prefix: Path.from("surprise"), kind: "start" }); + announced.close(); +}); + +/** A named prefix is still legal on the drafts that reject the empty one. */ +test("draft-14 still asks for a named prefix", async () => { + const pair = createMockTransportPair(ALPN.DRAFT_14); + const session = new NativeSession(pair.server, Version.DRAFT_14, true); + const subscriber = new Subscriber({ session }); + + subscriber.announced(Path.Pattern.subtree(Path.from("cam"))); + + expect(await nextStream(pair.client)).toBeDefined(); +}); + +/** The empty prefix is the "every namespace" request from draft-16 on. */ +test("draft-16 still asks for the empty namespace", async () => { + const pair = createMockTransportPair(ALPN.DRAFT_16); + const session = new NativeSession(pair.server, Version.DRAFT_16, true); + const subscriber = new Subscriber({ session }); + + subscriber.announced(); + + expect(await nextStream(pair.client)).toBeDefined(); +}); + /** * The other half of discovery: a peer that tells us unasked. Asking must not make us deaf * to a PUBLISH_NAMESPACE that arrives on its own stream instead. diff --git a/js/net/src/ietf/subscriber.ts b/js/net/src/ietf/subscriber.ts index dbffb1c1f73..88d99926079 100644 --- a/js/net/src/ietf/subscriber.ts +++ b/js/net/src/ietf/subscriber.ts @@ -215,7 +215,8 @@ export class Subscriber { * * The peer is asked with SUBSCRIBE_NAMESPACE regardless of what it declared, and an * unsolicited PUBLISH_NAMESPACE lands here too, so a peer that only tells and one - * that only answers are both discovered. + * that only answers are both discovered. Draft-14 and draft-15 cannot be asked for + * the empty prefix, so an unscoped subscriber only hears what the peer tells. * * Hidden routes (a `.`-prefixed segment below the scope's head) are left out unless * `options.hidden` opts in. The opt-in rides the SUBSCRIBE_NAMESPACE when the peer @@ -321,6 +322,15 @@ export class Subscriber { async #runAnnounced(announced: announce.Producer, prefix: Path.Valid, hidden: boolean) { const version = this.#session.version; + // A zero-field track namespace was a protocol violation until draft-16 allowed + // it. There is no other way to ask for every namespace on the older drafts, so + // send nothing and stay registered: an unsolicited PUBLISH_NAMESPACE still lands + // here. Returning without waiting would drop this consumer before one could. + if ((version === Version.DRAFT_14 || version === Version.DRAFT_15) && prefix.length === 0) { + await announced.closed; + return; + } + // Suffixes live on this stream, so a repeat is recognized as an update to the // advertisement rather than a second one, which would leak the count. const live = new Set(); diff --git a/rs/moq-net/src/ietf/session.rs b/rs/moq-net/src/ietf/session.rs index b87101968af..639932fc08d 100644 --- a/rs/moq-net/src/ietf/session.rs +++ b/rs/moq-net/src/ietf/session.rs @@ -14,6 +14,16 @@ use super::{ subscriber::{is_protocol_violation, subscribe_prefixes}, }; +/// Whether `prefix` may be sent in SUBSCRIBE_NAMESPACE on `version`. +/// +/// Draft-16 is the first that allows a zero-field track namespace. Before that the +/// minimum was one field, and an empty prefix was a protocol violation. An unscoped +/// subscriber has nothing legal to ask for on those drafts; the peer can still +/// advertise with an unsolicited PUBLISH_NAMESPACE. +fn ask_namespace(version: Version, prefix: &crate::Path<'_>) -> bool { + !prefix.is_empty() || !matches!(version, Version::Draft14 | Version::Draft15) +} + /// Everything one moq-transport session needs to start. pub struct Config { /// The runtime that arms the session's timers. @@ -124,8 +134,15 @@ where let (goaway_handle, goaway) = crate::goaway::Handle::new(!client); // One SUBSCRIBE_NAMESPACE per permitted prefix, like `lite::Subscriber`: the - // scope is what we may ask for, and it is not the origin's root. - let namespaces = subscribe.as_ref().map(subscribe_prefixes).unwrap_or_default(); + // scope is what we may ask for, and it is not the origin's root. An empty + // prefix is illegal before draft-16, so those drafts are not asked for it. + let namespaces: Vec<_> = subscribe + .as_ref() + .map(subscribe_prefixes) + .unwrap_or_default() + .into_iter() + .filter(|prefix| ask_namespace(version, prefix)) + .collect(); let withdrawal = crate::session::Withdrawal::default(); let withdrawing = withdrawal.clone(); @@ -1226,6 +1243,98 @@ mod tests { assert_eq!(occurrences(&log, b"rootns"), 0, "asked the peer for our local root"); } + /// The bytes of one legacy SUBSCRIBE_NAMESPACE, as the session writes them. + async fn subscribe_namespace_legacy(version: Version, namespace: &str) -> Vec { + let log = crate::lite::test_transport::Log::default(); + let mut writer = Writer::new(crate::lite::test_transport::SinkSend::new(log.clone()), version); + let msg = ietf::SubscribeNamespaceLegacy { + request_id: RequestId(0), + namespace: crate::Path::new(namespace), + subscribe_options: 0x01, + hidden: false, + }; + writer.varint(ietf::SubscribeNamespaceLegacy::ID).await.unwrap(); + writer.encode(&msg).await.unwrap(); + log.writes.lock().unwrap().clone() + } + + /// How many times a session with this scope writes SUBSCRIBE_NAMESPACE for it. + /// + /// `prefix: None` is an unscoped origin, whose only interest head is empty. + async fn asked_namespace(version: Version, prefix: Option<&str>) -> usize { + let origin = crate::origin::Config::new(crate::Hop::new(1).unwrap()).produce(); + let subscribe = match prefix { + Some(name) => { + let scope: crate::Patterns = [crate::Pattern::subtree(name).unwrap()].into_iter().collect(); + origin.scope("rootns", &scope).expect("scope the origin") + } + None => origin, + }; + + let gate = kio::Producer::new(true); + let mut session = crate::lite::test_transport::SinkSession::gated_bi(gate.consume()); + let log = session.log.clone(); + let setup = Stream::open(&mut session, version) + .await + .expect("open the control stream"); + + let (driver, _goaway, _) = start(Config { + runtime: crate::time::Clock::sim(), + session, + setup: Some(setup), + request_id_max: None, + client: true, + publish: None, + subscribe: Some(subscribe), + peer_hop: None, + cost: None, + version, + path: None, + authority: None, + peer_setup_stream: None, + peer_declared: None, + early_unis: Vec::new(), + }) + .expect("start the session"); + let driver = moq_net_sim::spawn(driver); + + let needle = subscribe_namespace_legacy(version, prefix.unwrap_or("")).await; + for _ in 0..ANNOUNCE_TURNS { + if occurrences(&log, &needle) > 0 { + break; + } + moq_net_sim::sleep(std::time::Duration::from_millis(1)).await; + } + + assert!(!driver.is_finished(), "{version:?} ended the session"); + assert!(log.closes().is_empty(), "{version:?} closed: {:?}", log.closes()); + occurrences(&log, &needle) + } + + /// Draft-14 and draft-15 reject a zero-field track namespace. An unscoped + /// subscriber must not send one, and a real prefix must still go out. Draft-16 + /// made the empty prefix the way to ask for every namespace, so it stays. + #[moq_net_sim::test] + async fn an_empty_namespace_is_not_asked_before_draft_16() { + for version in [Version::Draft14, Version::Draft15] { + assert_eq!( + asked_namespace(version, None).await, + 0, + "{version:?} asked for every namespace" + ); + assert_eq!( + asked_namespace(version, Some("cam")).await, + 1, + "{version:?} skipped a real prefix" + ); + } + assert_eq!( + asked_namespace(Version::Draft16, None).await, + 1, + "draft-16 dropped the empty prefix" + ); + } + /// How many scheduling turns an advertisement gets before the count is taken. Time is /// paused in these tests, so each turn costs nothing and only runs the driver until it /// parks again; a busy machine cannot turn a slow announce into a passing silence. diff --git a/rs/moq-net/src/ietf/subscriber.rs b/rs/moq-net/src/ietf/subscriber.rs index f144d58419d..e7db86bc7a7 100644 --- a/rs/moq-net/src/ietf/subscriber.rs +++ b/rs/moq-net/src/ietf/subscriber.rs @@ -595,8 +595,9 @@ pub(super) struct Subscriber { /// our namespace -- a peer outside it has never heard of our root, so a rooted /// subscriber asks for its scope and mounts the replies under the root. /// -/// Asked unconditionally: a peer with nothing to advertise answers with an empty set, -/// which costs one stream. +/// Every prefix is asked: a peer with nothing to advertise answers with an empty set, +/// which costs one stream. The session leaves out an empty prefix before draft-16, +/// where that request is illegal. pub(super) fn subscribe_prefixes(origin: &origin::Producer) -> Vec { crate::model::interest_prefixes(&origin.allowed()) } From b8424b3c3699d5452ed47b0136ce2c52abcab93b Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Wed, 7 Oct 2026 20:22:27 -0700 Subject: [PATCH 2/6] fix(net): still ask a soliciting peer for the empty namespace Every moq-net and js/net session declares MoQ Solicit, so our own peers never announce unasked. Skipping the empty SUBSCRIBE_NAMESPACE for them on draft-14/15 left two of our endpoints discovering nothing. Skip it only when the peer's SETUP declared no Solicit, which marks a foreign peer. Co-Authored-By: Claude Opus 5.5 --- js/net/src/ietf/connection.ts | 2 +- js/net/src/ietf/subscriber.test.ts | 22 ++++++++++--- js/net/src/ietf/subscriber.ts | 23 +++++++++---- rs/moq-net/src/ietf/session.rs | 53 +++++++++++++----------------- rs/moq-net/src/ietf/subscriber.rs | 18 ++++++++-- 5 files changed, 74 insertions(+), 44 deletions(-) diff --git a/js/net/src/ietf/connection.ts b/js/net/src/ietf/connection.ts index 9bf00846513..c92d3b2658f 100644 --- a/js/net/src/ietf/connection.ts +++ b/js/net/src/ietf/connection.ts @@ -162,7 +162,7 @@ export class Connection implements Established { }); this.#solicit = solicit; this.#cluster = cluster; - this.#subscriber = new Subscriber({ session: this.#session, quic, cluster, hidden }); + this.#subscriber = new Subscriber({ session: this.#session, quic, cluster, hidden, solicit }); registerWire(this, { consume: (path) => this.#subscriber.consume(path), goaway: this.#goaway }); void this.#run(early); diff --git a/js/net/src/ietf/subscriber.test.ts b/js/net/src/ietf/subscriber.test.ts index fc58ee9176c..1a190761da4 100644 --- a/js/net/src/ietf/subscriber.test.ts +++ b/js/net/src/ietf/subscriber.test.ts @@ -68,14 +68,14 @@ test("every peer is asked", async () => { }); /** - * Draft-16 is the first that allows a zero-field track namespace. Asking for one - * earlier is a protocol violation, and there is no other "every namespace" request, - * so an unscoped subscriber sends nothing and still takes an unsolicited announcement. + * Draft-16 is the first that allows a zero-field track namespace. Asking a foreign peer + * (one that declared no MoQ Solicit) for one earlier is a protocol violation, so an + * unscoped subscriber sends nothing and still takes an unsolicited announcement. */ test.each([ ["draft-14", Version.DRAFT_14, ALPN.DRAFT_14], ["draft-15", Version.DRAFT_15, ALPN.DRAFT_15], -] as const)("%s does not ask for the empty namespace", async (_name, version, alpn) => { +] as const)("%s does not ask a foreign peer for the empty namespace", async (_name, version, alpn) => { const pair = createMockTransportPair(alpn); const session = new NativeSession(pair.server, version, true); const subscriber = new Subscriber({ session }); @@ -92,6 +92,20 @@ test.each([ announced.close(); }); +/** A peer that declared MoQ Solicit is ours: it only tells when asked, so it still is. */ +test.each([ + ["draft-14", Version.DRAFT_14, ALPN.DRAFT_14], + ["draft-15", Version.DRAFT_15, ALPN.DRAFT_15], +] as const)("%s still asks a soliciting peer for the empty namespace", async (_name, version, alpn) => { + const pair = createMockTransportPair(alpn); + const session = new NativeSession(pair.server, version, true); + const subscriber = new Subscriber({ session, solicit: true }); + + subscriber.announced(); + + expect(await nextStream(pair.client)).toBeDefined(); +}); + /** A named prefix is still legal on the drafts that reject the empty one. */ test("draft-14 still asks for a named prefix", async () => { const pair = createMockTransportPair(ALPN.DRAFT_14); diff --git a/js/net/src/ietf/subscriber.ts b/js/net/src/ietf/subscriber.ts index 3a735fd766d..adf65c2b9a1 100644 --- a/js/net/src/ietf/subscriber.ts +++ b/js/net/src/ietf/subscriber.ts @@ -150,6 +150,10 @@ export class Subscriber { // Whether the peer understands the HIDDEN parameter (MoQ Hidden). #hidden: boolean; + // What the peer's SETUP declared about being solicited (MoQ Solicit), `undefined` + // when it declared nothing. + #solicit?: boolean; + /** Marks this subscriber's deliberate local session close. @internal */ close() { this.#localClose = true; @@ -165,6 +169,7 @@ export class Subscriber { quic, cluster, hidden = false, + solicit, }: { /** The session abstraction for bidi streams and request IDs. */ session: Session; @@ -174,11 +179,14 @@ export class Subscriber { cluster?: Cluster.Hops; /** Whether the peer understands the HIDDEN parameter (MoQ Hidden). */ hidden?: boolean; + /** What the peer's SETUP declared about being solicited (MoQ Solicit). */ + solicit?: boolean; }) { this.#session = session; this.#quic = quic; this.#cluster = cluster; this.#hidden = hidden; + this.#solicit = solicit; } /** @@ -205,8 +213,9 @@ export class Subscriber { * * The peer is asked with SUBSCRIBE_NAMESPACE regardless of what it declared, and an * unsolicited PUBLISH_NAMESPACE lands here too, so a peer that only tells and one - * that only answers are both discovered. Draft-14 and draft-15 cannot be asked for - * the empty prefix, so an unscoped subscriber only hears what the peer tells. + * that only answers are both discovered. A draft-14 or draft-15 peer that declared no + * MoQ Solicit is not asked for the empty prefix, so an unscoped subscriber only hears + * what that peer tells. * * Hidden routes (a `.`-prefixed segment below the scope's head) are left out unless * `options.hidden` opts in. The opt-in rides the SUBSCRIBE_NAMESPACE when the peer @@ -313,10 +322,12 @@ export class Subscriber { const version = this.#session.version; // A zero-field track namespace was a protocol violation until draft-16 allowed - // it. There is no other way to ask for every namespace on the older drafts, so - // send nothing and stay registered: an unsolicited PUBLISH_NAMESPACE still lands - // here. Returning without waiting would drop this consumer before one could. - if ((version === Version.DRAFT_14 || version === Version.DRAFT_15) && prefix.length === 0) { + // it. A peer that never declared MoQ Solicit is not ours: it may enforce that, and + // it tells us unasked anyway, so send nothing and stay registered for its + // unsolicited PUBLISH_NAMESPACE. Returning would drop this consumer before one + // could land. A peer that declared Solicit only tells when asked, so it still is. + const legacy = version === Version.DRAFT_14 || version === Version.DRAFT_15; + if (legacy && prefix.length === 0 && this.#solicit === undefined) { await announced.closed; return; } diff --git a/rs/moq-net/src/ietf/session.rs b/rs/moq-net/src/ietf/session.rs index 639932fc08d..f8f2723fcee 100644 --- a/rs/moq-net/src/ietf/session.rs +++ b/rs/moq-net/src/ietf/session.rs @@ -14,16 +14,6 @@ use super::{ subscriber::{is_protocol_violation, subscribe_prefixes}, }; -/// Whether `prefix` may be sent in SUBSCRIBE_NAMESPACE on `version`. -/// -/// Draft-16 is the first that allows a zero-field track namespace. Before that the -/// minimum was one field, and an empty prefix was a protocol violation. An unscoped -/// subscriber has nothing legal to ask for on those drafts; the peer can still -/// advertise with an unsolicited PUBLISH_NAMESPACE. -fn ask_namespace(version: Version, prefix: &crate::Path<'_>) -> bool { - !prefix.is_empty() || !matches!(version, Version::Draft14 | Version::Draft15) -} - /// Everything one moq-transport session needs to start. pub struct Config { /// The runtime that arms the session's timers. @@ -134,15 +124,8 @@ where let (goaway_handle, goaway) = crate::goaway::Handle::new(!client); // One SUBSCRIBE_NAMESPACE per permitted prefix, like `lite::Subscriber`: the - // scope is what we may ask for, and it is not the origin's root. An empty - // prefix is illegal before draft-16, so those drafts are not asked for it. - let namespaces: Vec<_> = subscribe - .as_ref() - .map(subscribe_prefixes) - .unwrap_or_default() - .into_iter() - .filter(|prefix| ask_namespace(version, prefix)) - .collect(); + // scope is what we may ask for, and it is not the origin's root. + let namespaces = subscribe.as_ref().map(subscribe_prefixes).unwrap_or_default(); let withdrawal = crate::session::Withdrawal::default(); let withdrawing = withdrawal.clone(); @@ -1260,8 +1243,9 @@ mod tests { /// How many times a session with this scope writes SUBSCRIBE_NAMESPACE for it. /// - /// `prefix: None` is an unscoped origin, whose only interest head is empty. - async fn asked_namespace(version: Version, prefix: Option<&str>) -> usize { + /// `prefix: None` is an unscoped origin, whose only interest head is empty. `solicit` + /// is what the peer's SETUP declared (MoQ Solicit). + async fn asked_namespace(version: Version, prefix: Option<&str>, solicit: Option) -> usize { let origin = crate::origin::Config::new(crate::Hop::new(1).unwrap()).produce(); let subscribe = match prefix { Some(name) => { @@ -1292,7 +1276,10 @@ mod tests { path: None, authority: None, peer_setup_stream: None, - peer_declared: None, + peer_declared: Some(peer::Peer { + solicit, + ..Default::default() + }), early_unis: Vec::new(), }) .expect("start the session"); @@ -1311,25 +1298,31 @@ mod tests { occurrences(&log, &needle) } - /// Draft-14 and draft-15 reject a zero-field track namespace. An unscoped - /// subscriber must not send one, and a real prefix must still go out. Draft-16 - /// made the empty prefix the way to ask for every namespace, so it stays. + /// Draft-14 and draft-15 reject a zero-field track namespace, so a foreign peer (one + /// that declared no MoQ Solicit) is not asked for it, and a real prefix still goes + /// out. A peer that declared Solicit is ours: it only tells when asked, so it still + /// gets the empty prefix. Draft-16 made the empty prefix legal, so it stays. #[moq_net_sim::test] - async fn an_empty_namespace_is_not_asked_before_draft_16() { + async fn an_empty_namespace_is_not_asked_of_a_foreign_peer_before_draft_16() { for version in [Version::Draft14, Version::Draft15] { assert_eq!( - asked_namespace(version, None).await, + asked_namespace(version, None, None).await, 0, - "{version:?} asked for every namespace" + "{version:?} asked a foreign peer for every namespace" ); assert_eq!( - asked_namespace(version, Some("cam")).await, + asked_namespace(version, Some("cam"), None).await, 1, "{version:?} skipped a real prefix" ); + assert_eq!( + asked_namespace(version, None, Some(true)).await, + 1, + "{version:?} did not ask a soliciting peer for every namespace" + ); } assert_eq!( - asked_namespace(Version::Draft16, None).await, + asked_namespace(Version::Draft16, None, None).await, 1, "draft-16 dropped the empty prefix" ); diff --git a/rs/moq-net/src/ietf/subscriber.rs b/rs/moq-net/src/ietf/subscriber.rs index 082adea5fe8..b4b4ac81099 100644 --- a/rs/moq-net/src/ietf/subscriber.rs +++ b/rs/moq-net/src/ietf/subscriber.rs @@ -591,9 +591,9 @@ pub(super) struct Subscriber { /// our namespace -- a peer outside it has never heard of our root, so a rooted /// subscriber asks for its scope and mounts the replies under the root. /// -/// Every prefix is asked: a peer with nothing to advertise answers with an empty set, -/// which costs one stream. The session leaves out an empty prefix before draft-16, -/// where that request is illegal. +/// Asked unconditionally: a peer with nothing to advertise answers with an empty set, +/// which costs one stream. [`Subscriber::run_subscribe_namespace`] holds back the empty +/// prefix from a foreign draft-14/15 peer. pub(super) fn subscribe_prefixes(origin: &origin::Producer) -> Vec { crate::model::interest_prefixes(&origin.allowed()) } @@ -850,6 +850,18 @@ where let declared = self.peer_setup.get().await; let hidden = declared.hidden; + // Draft-16 is the first to allow a zero-field namespace, so the empty prefix is a + // protocol violation on draft-14/15. A peer that never declared MoQ Solicit is not + // ours: it may enforce that, and it tells us unasked anyway. One that declared it + // accepts the empty prefix and only tells when asked, so it still gets one. + if prefix.is_empty() + && declared.solicit.is_none() + && matches!(self.version, Version::Draft14 | Version::Draft15) + { + tracing::debug!(version = ?self.version, "not asking a foreign peer for the empty namespace"); + return Ok(()); + } + let request_id = self.control.next_request_id(&self.runtime).await?; // Draft-18+ uses SUBSCRIBE_NAMESPACE (0x50); earlier drafts use the legacy From 865511b9fbc87654c5035ab47e361258711ddb66 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Wed, 7 Oct 2026 20:34:03 -0700 Subject: [PATCH 3/6] quest: finish ietf-d14-root-prefix, document the d14 discovery gap Co-Authored-By: Claude Opus 5.5 --- doc/bin/relay/cluster.md | 6 +++++ quest/m0/README.md | 1 - quest/m0/ietf-d14-root-prefix.md | 39 -------------------------------- 3 files changed, 6 insertions(+), 40 deletions(-) delete mode 100644 quest/m0/ietf-d14-root-prefix.md diff --git a/doc/bin/relay/cluster.md b/doc/bin/relay/cluster.md index 4054ff05e3d..4de861e35b3 100644 --- a/doc/bin/relay/cluster.md +++ b/doc/bin/relay/cluster.md @@ -16,6 +16,12 @@ same way so the cluster converges instead of flapping. Both wire protocols carry it: natively on moq-lite, and via the [cluster extension](/draft/moq-cluster) on moq-transport 17+. +moq-transport drafts 14 and 15 cannot ask for every broadcast, since an empty +namespace prefix is illegal before draft 16. On such a link to a peer without +the MoQ Solicit extension, such as moxygen, the relay does not ask for the +whole namespace and learns only what the peer announces unasked. moxygen +announces nothing unasked on draft 14, so that link discovers no broadcasts. + When a moq-lite-04 or later peer withdraws its last advertisement for a broadcast, a relay drops every other route to it that passed through that peer, since each was relayed from what the peer just withdrew, rather than falling back to them one diff --git a/quest/m0/README.md b/quest/m0/README.md index fcfeb086b24..0ebc9c813c0 100644 --- a/quest/m0/README.md +++ b/quest/m0/README.md @@ -54,7 +54,6 @@ a published `@moq/watch` break. - [moq-transport parameters per draft](/quest/m0/ietf-params-per-draft.md) - every control message accepts exactly the parameters its draft allows, so moqx's draft-16 SUBSCRIBE_NAMESPACE with FORWARD stops failing - [NAMESPACE on the stream](/quest/m0/ietf-namespace-stream.md) - every draft-16+ SUBSCRIBE_NAMESPACE stream carries NAMESPACE for each match, whatever the peer's SETUP options - [Dialed split horizon](/quest/m0/dial-split-horizon.md) - a session moq-net dials gets a per-connection hop, so routes never echo back to the peer they came from -- [No empty d14 prefix](/quest/m0/ietf-d14-root-prefix.md) - draft-14 never sends SUBSCRIBE_NAMESPACE with an empty prefix, and the docs say to scope a d14 link to moxygen - [End of Track Location](/quest/m0/ietf-end-of-track-location.md) - a relay forwards END_OF_TRACK at its upstream's Location, on the last group's stream, instead of re-sending it at the next group's object 0 - [End of Group status](/quest/m0/ietf-end-of-group-status.md) - an End of Group status on a stream whose header already marks the group's end is accepted, so imquic's last object per group arrives - [Subgroup at object 0](/quest/m0/ietf-first-object-zero.md) - a draft-18 subgroup with FIRST_OBJECT clear that starts at object 0 is read whole diff --git a/quest/m0/ietf-d14-root-prefix.md b/quest/m0/ietf-d14-root-prefix.md deleted file mode 100644 index 3c3fc0866d2..00000000000 --- a/quest/m0/ietf-d14-root-prefix.md +++ /dev/null @@ -1,39 +0,0 @@ -# [XS] No empty namespace prefix on draft-14 - -## Goal - -On draft-14, moq-net never sends SUBSCRIBE_NAMESPACE with an empty prefix. -d14 ยง9.28 makes a prefix with N = 0 a PROTOCOL_VIOLATION, and moxygen -refuses it today when an unscoped moq-relay cluster link dials it. The -relay docs say an unscoped d14 link discovers nothing from moxygen, so -operators scope it. - -## Plan - -Triaged from Fastly's moq-relay-interop report (2026-09-23 run, item 2) on -2026-10-07. - -Decided 2026-10-07: on d14, skip a SUBSCRIBE_NAMESPACE whose prefix is -empty. Keep today's warn-and-continue when the peer refuses a namespace -subscription. Rejected: failing the link on refusal, and requiring a scope -on d14 links at startup. - -Revised 2026-10-07 after Fastly's pcap runs (#issuecomment-6046932019): -moxygen sends no PUBLISH_NAMESPACE on d14 to a peer that has not -subscribed, and moqx no longer speaks d14. So skipping alone leaves an -unscoped moq-dev downstream of moxygen with no namespaces. Decided to keep -the quest narrow and document the gap, since moxygen on d14 is the only -affected pair and scoped links already work. Rejected: subscribing per -prefix on demand when a local subscriber misses, and routing unknown -SUBSCRIBEs upstream; both need a hook on origin misses. - -Where it lives: `subscribe_prefixes` (`rs/moq-net/src/ietf/subscriber.rs`, -around line 600) returns `interest_prefixes(origin.allowed())`, which is -`[""]` for an unscoped origin. `run_subscribe_namespace` (around line 861) -sends it. Log at debug when the root is skipped. The note belongs in -`doc/bin/relay/cluster.md`. - -Test: a d14 session with an unscoped origin sends no SUBSCRIBE_NAMESPACE, -and a scoped one still does. Check `js/net` for the same path. - -Public API: none. Wire: d14 stops sending a message the draft forbids. From f066a4f871c0d6e7a016a173d19c78a2b59b8611 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Wed, 7 Oct 2026 20:45:37 -0700 Subject: [PATCH 4/6] fix(js): end an unasked announcement reader with its session The empty-prefix skip has no request stream to fail on disconnect, so the reader waited until its caller closed it. Race the wait against the transport closing. Co-Authored-By: Claude Opus 5.5 --- js/net/src/ietf/subscriber.test.ts | 15 +++++++++++++++ js/net/src/ietf/subscriber.ts | 5 ++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/js/net/src/ietf/subscriber.test.ts b/js/net/src/ietf/subscriber.test.ts index 50e528dae5d..c57d4465105 100644 --- a/js/net/src/ietf/subscriber.test.ts +++ b/js/net/src/ietf/subscriber.test.ts @@ -92,6 +92,21 @@ test.each([ announced.close(); }); +/** With no request stream to end it, the unasked reader ends with the session, from either side. */ +test.each([ + ["local", "server"], + ["remote", "client"], +] as const)("an unasked draft-14 reader ends on a %s close", async (_name, side) => { + const pair = createMockTransportPair(ALPN.DRAFT_14); + const session = new NativeSession(pair.server, Version.DRAFT_14, true); + const subscriber = new Subscriber({ session, quic: pair.server }); + const announced = subscriber.announced(); + + pair[side].close(); + + expect(await announced.next()).toBeUndefined(); +}); + /** A peer that declared MoQ Solicit is ours: it only tells when asked, so it still is. */ test.each([ ["draft-14", Version.DRAFT_14, ALPN.DRAFT_14], diff --git a/js/net/src/ietf/subscriber.ts b/js/net/src/ietf/subscriber.ts index cf6263e447a..1d48a9c7460 100644 --- a/js/net/src/ietf/subscriber.ts +++ b/js/net/src/ietf/subscriber.ts @@ -328,7 +328,10 @@ export class Subscriber { // could land. A peer that declared Solicit only tells when asked, so it still is. const legacy = version === Version.DRAFT_14 || version === Version.DRAFT_15; if (legacy && prefix.length === 0 && this.#solicit === undefined) { - await announced.closed; + // No request stream ends this wait, so the session's end has to. + const ends: PromiseLike[] = [announced.closed]; + if (this.#quic) ends.push(this.#quic.closed.catch(() => undefined)); + await Promise.race(ends); return; } From 0a6a263af5521296aff1e3bda8a502440b76a04f Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Wed, 7 Oct 2026 23:05:09 -0700 Subject: [PATCH 5/6] fix(net): update the empty-namespace test for main's session limits and SubscribeOptions Co-Authored-By: Claude Opus 5.5 --- rs/moq-net/src/ietf/session.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rs/moq-net/src/ietf/session.rs b/rs/moq-net/src/ietf/session.rs index 47bfbfeca68..e40b3f5a73f 100644 --- a/rs/moq-net/src/ietf/session.rs +++ b/rs/moq-net/src/ietf/session.rs @@ -1263,7 +1263,7 @@ mod tests { let msg = ietf::SubscribeNamespaceLegacy { request_id: RequestId(0), namespace: crate::Path::new(namespace), - subscribe_options: 0x01, + subscribe_options: ietf::SubscribeOptions::Namespace, hidden: false, }; writer.varint(ietf::SubscribeNamespaceLegacy::ID).await.unwrap(); @@ -1297,6 +1297,7 @@ mod tests { session, setup: Some(setup), request_id_max: None, + limits: Default::default(), client: true, publish: None, subscribe: Some(subscribe), From 8c7be137d0f1b79d4a8b2a9cf6f986628467ee41 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Wed, 7 Oct 2026 23:50:44 -0700 Subject: [PATCH 6/6] test(net): declare Solicit in the draft-14 GOAWAY announce test The empty namespace is no longer asked of a foreign draft-14 peer, so the fixture models one of ours to keep exercising the request after GOAWAY. Co-Authored-By: Claude Opus 5.5 --- js/net/src/goaway-requests.test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/net/src/goaway-requests.test.ts b/js/net/src/goaway-requests.test.ts index e58fc5e2e38..9724288716a 100644 --- a/js/net/src/goaway-requests.test.ts +++ b/js/net/src/goaway-requests.test.ts @@ -254,7 +254,8 @@ test("announcing and subscribing after GOAWAY still open streams, on the adapter close() {}, }; - const subscriber = new Subscriber({ session, goaway }); + // A soliciting peer, so draft-14 still asks it for the empty namespace. + const subscriber = new Subscriber({ session, goaway, solicit: true }); const track = subscriber.consume(Path.from("room")).track("video").subscribe(); await track.closed; expect(opened).toBe(true);