From 7b57cb022138fa9b01fd8298732e418a0ae80a6d Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Wed, 28 Oct 2026 03:42:01 -0700 Subject: [PATCH 1/6] chore(quest): claim quest/m1/subscribe-timestamps.md Quest-Claim: fe3d3759f11edcfc From c35a21ffed7fb56cff08a8cbff02928a0fb20cd4 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Wed, 28 Oct 2026 03:59:58 -0700 Subject: [PATCH 2/6] fix(net): honor the Track Properties opt-out on IETF SUBSCRIBE and PUBLISH A moq-transport SUBSCRIBE or SUBSCRIBE_TRACKS listing with INCLUDE_PROPERTIES=0 gets no TIMESCALE, so the Rust publisher now sends it unstamped objects, as the JS publisher does. The Rust subscriber's resumed SUBSCRIBE asks for the properties whenever its copy is timed, so it keeps reading timestamps from either publisher. Co-Authored-By: Claude Opus 5.5 --- doc/concept/standard.md | 2 +- quest/m1/README.md | 1 - quest/m1/subscribe-timestamps.md | 25 --------- rs/moq-net/src/ietf/publisher.rs | 22 ++++---- rs/moq-net/src/ietf/publisher/tracks.rs | 67 +++++++++++++++++++++++-- rs/moq-net/src/ietf/subscriber.rs | 65 ++++++++++++------------ 6 files changed, 111 insertions(+), 71 deletions(-) delete mode 100644 quest/m1/subscribe-timestamps.md diff --git a/doc/concept/standard.md b/doc/concept/standard.md index 6d56cad8c94..524acc81562 100644 --- a/doc/concept/standard.md +++ b/doc/concept/standard.md @@ -30,7 +30,7 @@ subset drops. What a peer actually observes against this implementation: - **A Rust TRACKS listing sends `SUBSCRIBE_TRACKS` upstream, only on demand.** Listing a broadcast from a moq-transport peer sends `SUBSCRIBE_TRACKS` with `FORWARD=0` while someone lists it, never on connect, announce, or subscribe, so a peer that refuses, resets, or ignores it affects only that listing. Each listed track's paused `PUBLISH` is its upstream copy, which a reader resumes rather than subscribing again. Only a `PUBLISH_DONE` with `TRACK_ENDED` removes a listed track, and it lists as finished; any other end, including the error our own answerer sends for a track that left unfinished, fails the listing, and readers list again. - **History is fetched in ranges.** In Rust, Object ID gaps must be marked by Prior Object ID Gap properties for a group to be fetchable. A `FETCH` returns a range of groups from the cache, which a relay fills upstream with one `FETCH` per run of missing groups, or on draft 18 the saved prefix of the group a new subscription just joined. The range ends at Largest Object's group and reads it whole, so a `FETCH` of a group still being written waits for it to finish. That departs from draft 22's cap at Largest Object: a cache cannot know an open group's real Largest Object, and a cut group would be cached downstream as complete. On draft 18, `FETCH_OK` End Object 0 covers the entire End Group, matching the request; Rust also accepts the legacy answer naming the next group with Object 0. On draft 22, `FETCH_OK`'s End Location is the requested end, capped at Largest Object's group: a range holding no objects gets an empty fetch stream, and only a start past Largest Object is refused, with `INVALID_RANGE`. A Rust relay retains the upstream Largest Object from `TRACK_STATUS`, so even a fetch-only copy can resolve a draft 22 `LOCATION_FILTER` relative to it; without a publisher report or live feed, it refuses that filter as `NOT_SUPPORTED`. JavaScript publishing answers a `FETCH` from its cache alone, and a joining `FETCH` only for the head of its subscription's own group. Datagrams are never fetchable. A Rust reader that only fetches learns the track from `TRACK_STATUS` instead of subscribing, so a finished track stays fetchable; a reader whose publisher refuses `TRACK_STATUS` as `NOT_SUPPORTED` still subscribes. - **Compression.** Rust peers exchange compressed tracks when both offer the [Flate extension](/draft/moq-flate). Other peers receive one shared inflated copy. A publisher that seals the compression declaration makes that fallback unavailable: an incompatible peer is refused, preserving the sealed metadata. JavaScript does not offer the IETF extension. -- **Timing.** A track whose `SUBSCRIBE_OK` declares no `TIMESCALE` is untimed. A Rust reader that never subscribed takes the units from `TRACK_STATUS`. +- **Timing.** A track whose `SUBSCRIBE_OK` or `PUBLISH` declares no `TIMESCALE` is untimed, so one answering `INCLUDE_PROPERTIES=0` carries unstamped objects. A Rust reader that never subscribed takes the units from `TRACK_STATUS`, and still asks for the properties whenever it subscribes to a timed track. - **Strict SETUP and parameters.** Repeated unknown `SETUP` options, GREASE included, are accepted if well-formed; a repeated known option is rejected. A `GROUP_ORDER` other than Ascending (1) or Descending (2) closes the session. An unknown message parameter, or one defined only for another message, closes the session. Other malformed control input closes the session with the draft's code too, such as a server `SETUP` carrying `PATH` or `AUTHORITY`, a namespace field ending in `/` (it would map to a path with an empty segment), a request cut short by FIN, or a second `GOAWAY` on one stream; a first `GOAWAY` on a request stream is legal. - **One `SETUP` credential**, forwarded to the [auth server](/bin/relay/auth#the-contract) unverified. A second `SETUP` token closes the session. We advertise no token cache, so an alias reference in `SETUP` closes it with `PROTOCOL_VIOLATION`, one on a request with `UNKNOWN_AUTH_TOKEN_ALIAS`, and a registration on a request with `AUTH_TOKEN_CACHE_OVERFLOW`. Where the Rust side authorizes the peer or verifies tokens, a token on a `SUBSCRIBE` or `PUBLISH_NAMESPACE` is verified like an in-band session token and authorizes that one request alone, even where that authorization already covers it; it never widens the session. It is refused with `NOT_SUPPORTED` when nothing verifies it, when it is empty, or when its Token Type is anything but 0 (out of band). A side that does neither, JavaScript included, ignores the token. Rust refuses a request carrying more than one distinct token with `NOT_SUPPORTED`, since it verifies one; JavaScript, which verifies none, ignores them all. A token-authorized `SUBSCRIBE` still stays within the grant the peer gave us. A token-authorized `PUBLISH_NAMESPACE` needs a grant covering everything beneath the namespace, and the tracks we subscribe under it rely on that announce instead of our limit, ending with it. An update renews the token, and a refused renewal ends only that request. Rust and JavaScript send the token a route names (`Route::auth`) on its `PUBLISH_NAMESPACE`, and swapping it renews the request with `REQUEST_UPDATE`; the inline `NAMESPACE` that answers a solicited `SUBSCRIBE_NAMESPACE` carries no token. A token added to a reconnecting connection's auth handle rides every session it makes, so the announcement keeps it across a reconnect; one added to a single session's handle ends with that session. A token on any other request is decoded and grants nothing, and a request repeating one is refused with `MALFORMED_AUTH_TOKEN`. The negotiated [MoQ Auth extension](/concept/moq-lite#authorization) accepts additional session tokens in band. - **Pause delivery.** `FORWARD=0` on a `SUBSCRIBE` or its update drops the subscription, closing its data streams and holding nothing upstream, while the request and its slot stay. `FORWARD=1` subscribes again as a new `SUBSCRIBE` with the same filter would, so nothing carries across the pause: its `REQUEST_OK` names the live edge it joined at. A paused update may change only priority and max age. diff --git a/quest/m1/README.md b/quest/m1/README.md index 3f93058e5c5..f3e2a93fe77 100644 --- a/quest/m1/README.md +++ b/quest/m1/README.md @@ -149,7 +149,6 @@ removed). - [Drop web-transport-trait](/quest/m1/drop-web-transport-trait.md) - iroh, wasm, and ffi implement moq-net's `transport::poll` traits, and the remaining `web_transport_trait` adapters are deleted - [On-demand JavaScript FETCH](/quest/m1/js-fetch-on-demand.md) - browser publishers answer IETF FETCH for evicted or uncached groups through the JS ranges request surface - [Rust FETCH parity](/quest/m1/ietf-fetch-parity.md) - Rust finishes an answered joining FETCH's head, refuses a lost head with DOES_NOT_EXIST, and sends no timestamps without TIMESCALE, as the JS publisher does -- [SUBSCRIBE honors the properties opt-out](/quest/m1/subscribe-timestamps.md) - the Rust publisher sends untimed objects to a SUBSCRIBE that declines Track Properties, and the Rust subscriber asks for them when it needs timestamps - [JS FETCH timeout test](/quest/m1/js-fetch-timeout-test.md) - a JS joining FETCH still waiting on its SUBSCRIBE at the deadline is refused with TIMEOUT - [Mock reset codes](/quest/m1/mock-reset-codes.md) - `js/net`'s mock transport carries only reset codes, and any reset found sending the wrong code is fixed - [IETF fill timeout](/quest/m1/ietf-fill-timeout.md) - Rust honors native FILL_TIMEOUT to bound upstream waiting on drafts 18 and 22, alongside local content-age enforcement diff --git a/quest/m1/subscribe-timestamps.md b/quest/m1/subscribe-timestamps.md deleted file mode 100644 index eebabb9d138..00000000000 --- a/quest/m1/subscribe-timestamps.md +++ /dev/null @@ -1,25 +0,0 @@ -# [S] Rust SUBSCRIBE honors the Track Properties opt-out - -## Goal - -A moq-transport SUBSCRIBE that opts out of Track Properties -(INCLUDE_PROPERTIES `0`) gets no TIMESCALE and untimed objects from the Rust -publisher, as from the JS publisher and as Rust FETCH already does -([moq-dev/moq#6999](https://github.com/moq-dev/moq/pull/6999)). The Rust -subscriber asks for properties whenever it needs timestamps, so it reads a -timed track timed from either publisher. - -## Plan - -Decided 2026-10-27 (maintainer): one rule for both publishers and both -request kinds. Today the Rust subscriber opts out on some SUBSCRIBEs -(`properties_wanted: matches!(target, Target::Request(_))` in -`rs/moq-net/src/ietf/subscriber.rs`) and still expects timestamps, so a JS -publisher would hand it untimed objects on a timed track. Fix the subscriber -first, then the publisher. Land after -[lite-05/06 timestamps](https://github.com/moq-dev/moq/pull/6996), which -changes how moq-transport tracks are stamped. - -Test both directions against JS in `just test interop --all`. - -Public API: none. Wire: the Rust publisher omits timestamps when asked to. diff --git a/rs/moq-net/src/ietf/publisher.rs b/rs/moq-net/src/ietf/publisher.rs index f5d8396da80..61d7a12282b 100644 --- a/rs/moq-net/src/ietf/publisher.rs +++ b/rs/moq-net/src/ietf/publisher.rs @@ -1428,9 +1428,7 @@ impl Publisher { None => return Ok(Subscribed::Withdrawn), }; let cache = track; - // A subscriber that opted out of this SUBSCRIBE_OK's properties learns the - // Timestamp's units from TRACK_STATUS, so the opt-out strips nothing from the - // objects. + // The fill stamps its objects as the subscription does. let timescale = track_serve.timescale; let properties = match track_properties( track_serve.track.info(), @@ -2015,9 +2013,9 @@ impl Publisher { } range.apply(&mut subscription); let _ = subscribed.update(subscription); - // A Timestamp goes out wherever the track has units. An untimed track declares none, - // so its objects stay unstamped. - let timescale = subscribed.info().timescale; + // Only the TIMESCALE in SUBSCRIBE_OK opts the answer into timestamps, so an untimed + // track, or a subscriber that opted out of the properties, gets unstamped objects. + let timescale = subscribed.info().timescale.filter(|_| msg.properties_wanted); // Serve the track while reading updates; only abrupt closure cancels on draft-22. A // fill or joining FETCH ranks in the same subscription as the group it carries. @@ -9054,10 +9052,10 @@ mod serve_tests { } } - /// Opting out of SUBSCRIBE_OK's properties does not strip the objects' timestamps: - /// their units come from TRACK_STATUS instead. + /// Opting out of SUBSCRIBE_OK's properties also opts out of timestamps: with no + /// TIMESCALE declared, the objects go out unstamped. #[moq_clock::test] - async fn the_properties_opt_out_keeps_object_timestamps() { + async fn the_properties_opt_out_strips_object_timestamps() { let version = Version::Draft22; let stamp = crate::Timestamp::from_millis(123_456).unwrap(); let mut properties = Vec::new(); @@ -9079,7 +9077,11 @@ mod serve_tests { run_live(&mut h, msg).await; assert_eq!(occurrences(&h.log, b"stamped"), 1, "wanted={wanted}"); - assert_eq!(occurrences(&h.log, &properties), 1, "wanted={wanted}: object unstamped"); + assert_eq!( + occurrences(&h.log, &properties), + usize::from(wanted), + "wanted={wanted}: stamped only when TIMESCALE is declared" + ); } } diff --git a/rs/moq-net/src/ietf/publisher/tracks.rs b/rs/moq-net/src/ietf/publisher/tracks.rs index 19b1bfa6970..43696a01fcc 100644 --- a/rs/moq-net/src/ietf/publisher/tracks.rs +++ b/rs/moq-net/src/ietf/publisher/tracks.rs @@ -865,6 +865,9 @@ impl Publisher { // An update may ask for a new group only if the PUBLISH sent DYNAMIC_GROUPS, which // INCLUDE_PROPERTIES=0 leaves out. let dynamic = properties.dynamic_groups; + // Objects carry a Timestamp only in units the PUBLISH declared, which + // INCLUDE_PROPERTIES=0 also leaves out. + let timescale = properties.timescale; let absolute = self.origin.root().rejoin(&namespace); // Every wait on the peer for the PUBLISH's bytes lasts only while the track is listed @@ -1000,6 +1003,7 @@ impl Publisher { &mut params, how, dynamic, + timescale, join.as_ref(), &listed, &mut gate, @@ -1144,8 +1148,9 @@ impl Publisher { Ok(Served::UpdateFailed(err)) } - /// Forward a paused PUBLISH subscription from the cache with `params`, as a SUBSCRIBE - /// with them would be served, until it pauses again or ends. Answers the resuming update + /// Forward a paused PUBLISH subscription from the cache with `params`, its objects + /// stamped in `timescale`, as a SUBSCRIBE with them would be served, until it pauses again + /// or ends. Answers the resuming update /// with where the subscription now joins, when `answer` says one asked. `Err(())` when the /// subscriber cancelled. #[expect( @@ -1161,6 +1166,7 @@ impl Publisher { params: &mut Params, how: Resume, dynamic: bool, + timescale: Option, join: Option<&Join>>, listed: &kio::Consumer, gate: &mut crate::auth::Gate, @@ -1224,7 +1230,6 @@ impl Publisher { let range = subscribe_range(params.filter, edge, self.version); range.apply(&mut subscription); let _ = subscriber.update(subscription); - let timescale = subscriber.info().timescale; let mut serve = TrackServe::new( self.session.clone(), subscriber, @@ -1669,6 +1674,62 @@ mod tests { } } + /// A listing that opted out of Track Properties gets a PUBLISH with no TIMESCALE, so its + /// objects go out unstamped, as a SUBSCRIBE's or FETCH's would. + #[moq_clock::test] + async fn a_publish_stamps_objects_only_with_its_timescale() { + let version = Version::Draft22; + let stamp = crate::Timestamp::from_millis(123_456).unwrap(); + let mut stamped = Vec::new(); + ietf::encode_object_time( + &mut crate::coding::Encoder::new(&mut stamped, version.into()), + stamp, + crate::track::Info::timed().timescale.expect("a timed track"), + ) + .unwrap(); + + for wanted in [true, false] { + let mut h = harness(version); + let video = h.tracks.remove("video").unwrap(); + let request = ietf::SubscribeTracks { + properties_wanted: wanted, + ..listing(false) + }; + let mut request = h.request(&request).await; + assert_eq!(next(&mut request).await.0, ietf::RequestOk::ID, "wanted={wanted}"); + let mut stream = loop { + let (stream, _, name, _) = h.publish().await; + if name == "video" { + break stream; + } + }; + publish_ok(&mut stream).await; + send(&mut stream, &update(2, true)).await; + assert_eq!(next(&mut stream).await.0, ietf::RequestOk::ID, "wanted={wanted}"); + + let mut group = video.append_group().unwrap(); + group.write_frame(stamp, b"live".as_slice()).unwrap(); + group.finish().unwrap(); + let recv = timeout(std::future::poll_fn(|cx| h.peer.poll_accept_uni(cx))) + .await + .unwrap(); + let mut reader = crate::coding::Reader::new(crate::transport::boxed::RecvStream::new(recv), version); + let mut bytes = Vec::new(); + while let Some(chunk) = timeout(std::future::poll_fn(|cx| reader.poll_read_chunk(cx, 1024))) + .await + .unwrap() + { + bytes.extend_from_slice(&chunk); + } + assert!(bytes.windows(4).any(|w| w == b"live"), "wanted={wanted}"); + assert_eq!( + bytes.windows(stamped.len()).any(|w| w == stamped), + wanted, + "wanted={wanted}: stamped only when the PUBLISH declares TIMESCALE" + ); + } + } + /// A listed compressed track is declared and served compressed only to a peer that /// negotiated FLATE; any other peer gets the plain copy with no declaration. #[moq_clock::test] diff --git a/rs/moq-net/src/ietf/subscriber.rs b/rs/moq-net/src/ietf/subscriber.rs index 54cebefe420..7c4c2090807 100644 --- a/rs/moq-net/src/ietf/subscriber.rs +++ b/rs/moq-net/src/ietf/subscriber.rs @@ -3106,8 +3106,13 @@ impl Subscriber { group_order: order.into(), filter: join.filter, fill: join.fill, - // A resumed copy already knows the track, from the answer that accepted it. - properties_wanted: matches!(target, Target::Request(_)), + // A resumed copy already knows the track, from the answer that accepted + // it, but only a TIMESCALE in this answer opts its objects into the + // timestamps a timed copy reads. + properties_wanted: match &target { + Target::Request(_) => true, + Target::Resume(idle) => idle.timescale.is_some(), + }, forward: true, rendezvous: false, range_filters: false, @@ -3333,20 +3338,10 @@ impl Subscriber { properties, largest, } = accepted; - // What a pause holds again: the properties the track was listed with. - let held_properties = properties.clone(); - // A resumed copy opts out of the properties from draft-22, so it keeps the units it - // learned. Before that the answer declares them again. - let timescale = properties - .timescale - .or(resumed.as_ref().and_then(|idle| idle.timescale)); - let info = accepted_info( - &ietf::Properties { - timescale, - ..properties - }, - self.version, - ); + // The objects are stamped in the units the answer declares. A timed copy asked for + // them; an untimed one that opted out has none to keep. + let timescale = properties.timescale; + let info = accepted_info(&properties, self.version); // The copy already holds the track: it is current again up to the answer's Largest // Location once the join's head lands or a newer group does, since leaving cut the // group it was in. @@ -3784,7 +3779,8 @@ impl Subscriber { messages, request_id, alias, - properties: held_properties, + // What a pause holds again: the properties the track was listed with. + properties, owed: unanswered.load(Ordering::Relaxed), copy: Some(track.clone()), }; @@ -8109,13 +8105,17 @@ mod tests { } /// A copy that already knows its track, here from TRACK_STATUS_OK, opts out of the - /// properties when a subscriber returns, and keeps the units it learned rather than - /// taking the empty block the opted-out SUBSCRIBE_OK carries. + /// properties when a subscriber returns only if the track is untimed: a publisher stamps + /// objects only for a subscriber that took the TIMESCALE. #[moq_clock::test] - async fn a_resumed_subscribe_opts_out_of_known_properties() { + async fn a_resumed_subscribe_opts_out_only_when_untimed() { let declared = Timescale::new(90_000).unwrap(); - for version in [Version::Draft18, Version::Draft22] { - let opts_out = ietf::Filter::is_draft22(version); + for (version, timed) in [Version::Draft18, Version::Draft22] + .into_iter() + .flat_map(|version| [(version, true), (version, false)]) + { + // Before draft-22 SUBSCRIBE cannot opt out. + let wanted = timed || !ietf::Filter::is_draft22(version); let declares = |yes: bool| ietf::Properties { timescale: yes.then_some(declared), ..Default::default() @@ -8124,20 +8124,19 @@ mod tests { ietf::TrackStatusOk::ID, &ietf::TrackStatusOk { largest: Some(ietf::Location { group: 3, object: 42 }), - properties: declares(true), + properties: declares(timed), }, version, ); let session = crate::lite::test_transport::ScriptedSession::per_stream(vec![ status_ok, - // Empty when opted out. Before draft-22 SUBSCRIBE cannot opt out, so it declares - // the units again. + // Empty when opted out, which an untimed track's would be anyway. message( ietf::SubscribeOk::ID, &ietf::SubscribeOk { track_alias: 7, largest: None, - properties: declares(!opts_out), + properties: declares(timed), }, version, ), @@ -8193,10 +8192,14 @@ mod tests { subscribes.push(ietf::Subscribe::decode_msg(&mut body, version).unwrap()); } } - assert_eq!(subscribes.len(), 1, "{version}: the returning subscriber subscribes"); assert_eq!( - subscribes[0].properties_wanted, !opts_out, - "{version}: TRACK_STATUS_OK already gave the properties" + subscribes.len(), + 1, + "{version} timed={timed}: the returning subscriber subscribes" + ); + assert_eq!( + subscribes[0].properties_wanted, wanted, + "{version} timed={timed}: only the TIMESCALE opts the objects into timestamps" ); let timescale = probe @@ -8209,8 +8212,8 @@ mod tests { .timescale; assert_eq!( timescale, - Some(declared), - "{version}: the copy keeps the units it learned" + timed.then_some(declared), + "{version} timed={timed}: the copy reads objects in the units it learned" ); serving.abort(); } From f2f6b359a8e788c9b0cc01d2007a4e82a060a92d Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Thu, 29 Oct 2026 00:13:22 -0700 Subject: [PATCH 3/6] fix(net): leave the SUBSCRIBE_TRACKS answerer to its removal quest/m1/ietf-tracks-refuse.md deletes the Rust SUBSCRIBE_TRACKS answerer, so drop this PR's PUBLISH change and its test, and scope the Timing bullet to SUBSCRIBE. Word the opt-out comment by draft 18 so it stays true once draft 20 returns. Co-Authored-By: Claude Opus 5.5 --- doc/concept/standard.md | 2 +- rs/moq-net/src/ietf/publisher/tracks.rs | 67 ++----------------------- rs/moq-net/src/ietf/subscriber.rs | 2 +- 3 files changed, 5 insertions(+), 66 deletions(-) diff --git a/doc/concept/standard.md b/doc/concept/standard.md index cb35116c521..17f842bdc6c 100644 --- a/doc/concept/standard.md +++ b/doc/concept/standard.md @@ -30,7 +30,7 @@ subset drops. What a peer actually observes against this implementation: - **A Rust TRACKS listing sends `SUBSCRIBE_TRACKS` upstream, only on demand.** Listing a broadcast from a moq-transport peer sends `SUBSCRIBE_TRACKS` with `FORWARD=0` while someone lists it, never on connect, announce, or subscribe, so a peer that refuses, resets, or ignores it affects only that listing. Each listed track's paused `PUBLISH` is its upstream copy, which a reader resumes rather than subscribing again. Only a `PUBLISH_DONE` with `TRACK_ENDED` removes a listed track, and it lists as finished; any other end, including the error our own answerer sends for a track that left unfinished, fails the listing, and readers list again. - **History is fetched in ranges.** In Rust, Object ID gaps must be marked by Prior Object ID Gap properties for a group to be fetchable. A `FETCH` returns a range of groups from the cache, which a relay fills upstream with one `FETCH` per run of missing groups, or on draft 18 the saved prefix of the group a new subscription just joined. The range ends at Largest Object's group and reads it whole, so a `FETCH` of a group still being written waits for it to finish. That departs from draft 22's cap at Largest Object: a cache cannot know an open group's real Largest Object, and a cut group would be cached downstream as complete. On draft 18, `FETCH_OK` End Object 0 covers the entire End Group, matching the request; Rust also accepts the legacy answer naming the next group with Object 0. On draft 22, `FETCH_OK`'s End Location is the requested end, capped at Largest Object's group: a range holding no objects gets an empty fetch stream, and only a start past Largest Object is refused, with `INVALID_RANGE`. A Rust relay retains the upstream Largest Object from `TRACK_STATUS`, so even a fetch-only copy can resolve a draft 22 `LOCATION_FILTER` relative to it; without a publisher report or live feed, it refuses that filter as `NOT_SUPPORTED`. JavaScript publishing answers a `FETCH` from its cache alone, and a joining `FETCH` only for the head of its subscription's own group. It honors `FILL_TIMEOUT` on a `FETCH` or a fill as a total budget for waiting on objects that have not arrived, zero meaning cache only; once it runs out, the rest of each group still arriving is marked an Unknown gap on draft 18 and a Timed-Out gap on draft 22, never left implying the objects do not exist. It bounds the wait, not how old a cached object is. Rust still refuses `FILL_TIMEOUT` with `NOT_SUPPORTED`. Datagrams are never fetchable. A Rust reader that only fetches learns the track from `TRACK_STATUS` instead of subscribing, so a finished track stays fetchable; a reader whose publisher refuses `TRACK_STATUS` as `NOT_SUPPORTED` still subscribes. - **Compression.** Rust peers exchange compressed tracks when both offer the [Flate extension](/draft/moq-flate). Other peers receive one shared inflated copy. A publisher that seals the compression declaration makes that fallback unavailable: an incompatible peer is refused, preserving the sealed metadata. JavaScript does not offer the IETF extension. -- **Timing.** A track whose `SUBSCRIBE_OK` or `PUBLISH` declares no `TIMESCALE` is untimed, so one answering `INCLUDE_PROPERTIES=0` carries unstamped objects. A Rust reader that never subscribed takes the units from `TRACK_STATUS`, and still asks for the properties whenever it subscribes to a timed track. +- **Timing.** A track whose `SUBSCRIBE_OK` or `PUBLISH` declares no `TIMESCALE` is untimed. A `SUBSCRIBE` with `INCLUDE_PROPERTIES=0` gets no `TIMESCALE`, so its objects go out unstamped. A Rust reader that never subscribed takes the units from `TRACK_STATUS`, and still asks for the properties whenever it subscribes to a timed track. - **Strict SETUP and parameters.** Repeated unknown `SETUP` options, GREASE included, are accepted if well-formed; a repeated known option is rejected. A `GROUP_ORDER` other than Ascending (1) or Descending (2) closes the session. An unknown message parameter, or one defined only for another message, closes the session. Other malformed control input closes the session with the draft's code too, such as a server `SETUP` carrying `PATH` or `AUTHORITY`, a namespace field ending in `/` (it would map to a path with an empty segment), a request cut short by FIN, or a second `GOAWAY` on one stream; a first `GOAWAY` on a request stream is legal. - **One `SETUP` credential**, forwarded to the [auth server](/bin/relay/auth#the-contract) unverified. A second `SETUP` token closes the session. We advertise no token cache, so an alias reference in `SETUP` closes it with `PROTOCOL_VIOLATION`, one on a request with `UNKNOWN_AUTH_TOKEN_ALIAS`, and a registration on a request with `AUTH_TOKEN_CACHE_OVERFLOW`. Where the Rust side authorizes the peer or verifies tokens, a token on a `SUBSCRIBE` or `PUBLISH_NAMESPACE` is verified like an in-band session token and authorizes that one request alone, even where that authorization already covers it; it never widens the session. It is refused with `NOT_SUPPORTED` when nothing verifies it, when it is empty, or when its Token Type is anything but 0 (out of band). A side that does neither, JavaScript included, ignores the token. Rust refuses a request carrying more than one distinct token with `NOT_SUPPORTED`, since it verifies one; JavaScript, which verifies none, ignores them all. A token-authorized `SUBSCRIBE` still stays within the grant the peer gave us. A token-authorized `PUBLISH_NAMESPACE` needs a grant covering everything beneath the namespace, and the tracks we subscribe under it rely on that announce instead of our limit, ending with it. An update renews the token, and a refused renewal ends only that request. Rust and JavaScript send the token a route names (`Route::auth`) on its `PUBLISH_NAMESPACE`, and swapping it renews the request with `REQUEST_UPDATE`; the inline `NAMESPACE` that answers a solicited `SUBSCRIBE_NAMESPACE` carries no token. A token added to a reconnecting connection's auth handle rides every session it makes, so the announcement keeps it across a reconnect; one added to a single session's handle ends with that session. A token on any other request is decoded and grants nothing, and a request repeating one is refused with `MALFORMED_AUTH_TOKEN`. The negotiated [MoQ Auth extension](/concept/moq-lite#authorization) accepts additional session tokens in band. - **Pause delivery.** `FORWARD=0` on a `SUBSCRIBE` or its update drops the subscription, closing its data streams and holding nothing upstream, while the request and its slot stay. `FORWARD=1` subscribes again as a new `SUBSCRIBE` with the same filter would, so nothing carries across the pause: its `REQUEST_OK` names the live edge it joined at. A paused update may change only priority and max age. diff --git a/rs/moq-net/src/ietf/publisher/tracks.rs b/rs/moq-net/src/ietf/publisher/tracks.rs index 53a92ad2170..066a563f983 100644 --- a/rs/moq-net/src/ietf/publisher/tracks.rs +++ b/rs/moq-net/src/ietf/publisher/tracks.rs @@ -861,9 +861,6 @@ impl Publisher { // An update may ask for a new group only if the PUBLISH sent DYNAMIC_GROUPS, which // INCLUDE_PROPERTIES=0 leaves out. let dynamic = properties.dynamic_groups; - // Objects carry a Timestamp only in units the PUBLISH declared, which - // INCLUDE_PROPERTIES=0 also leaves out. - let timescale = properties.timescale; let absolute = self.origin.root().rejoin(&namespace); // Every wait on the peer for the PUBLISH's bytes lasts only while the track is listed @@ -998,7 +995,6 @@ impl Publisher { &mut params, how, dynamic, - timescale, join.as_ref(), &listed, &mut gate, @@ -1142,9 +1138,8 @@ impl Publisher { Ok(Served::UpdateFailed(err)) } - /// Forward a paused PUBLISH subscription from the cache with `params`, its objects - /// stamped in `timescale`, as a SUBSCRIBE with them would be served, until it pauses again - /// or ends. Answers the resuming update + /// Forward a paused PUBLISH subscription from the cache with `params`, as a SUBSCRIBE + /// with them would be served, until it pauses again or ends. Answers the resuming update /// with where the subscription now joins, when `answer` says one asked. `Err(())` when the /// subscriber cancelled. #[expect( @@ -1160,7 +1155,6 @@ impl Publisher { params: &mut Params, how: Resume, dynamic: bool, - timescale: Option, join: Option<&Join>>, listed: &kio::Consumer, gate: &mut crate::auth::Gate, @@ -1224,6 +1218,7 @@ impl Publisher { let range = subscribe_range(params.filter, edge, self.version); range.apply(&mut subscription); let _ = subscriber.update(subscription); + let timescale = subscriber.info().timescale; let mut serve = TrackServe::new( self.session.clone(), subscriber, @@ -1668,62 +1663,6 @@ mod tests { } } - /// A listing that opted out of Track Properties gets a PUBLISH with no TIMESCALE, so its - /// objects go out unstamped, as a SUBSCRIBE's or FETCH's would. - #[moq_clock::test] - async fn a_publish_stamps_objects_only_with_its_timescale() { - let version = Version::Draft22; - let stamp = crate::Timestamp::from_millis(123_456).unwrap(); - let mut stamped = Vec::new(); - ietf::encode_object_time( - &mut crate::coding::Encoder::new(&mut stamped, version.into()), - stamp, - crate::track::Info::timed().timescale.expect("a timed track"), - ) - .unwrap(); - - for wanted in [true, false] { - let mut h = harness(version); - let video = h.tracks.remove("video").unwrap(); - let request = ietf::SubscribeTracks { - properties_wanted: wanted, - ..listing(false) - }; - let mut request = h.request(&request).await; - assert_eq!(next(&mut request).await.0, ietf::RequestOk::ID, "wanted={wanted}"); - let mut stream = loop { - let (stream, _, name, _) = h.publish().await; - if name == "video" { - break stream; - } - }; - publish_ok(&mut stream).await; - send(&mut stream, &update(2, true)).await; - assert_eq!(next(&mut stream).await.0, ietf::RequestOk::ID, "wanted={wanted}"); - - let mut group = video.append_group().unwrap(); - group.write_frame(stamp, b"live".as_slice()).unwrap(); - group.finish().unwrap(); - let recv = timeout(std::future::poll_fn(|cx| h.peer.poll_accept_uni(cx))) - .await - .unwrap(); - let mut reader = crate::coding::Reader::new(crate::transport::boxed::RecvStream::new(recv), version); - let mut bytes = Vec::new(); - while let Some(chunk) = timeout(std::future::poll_fn(|cx| reader.poll_read_chunk(cx, 1024))) - .await - .unwrap() - { - bytes.extend_from_slice(&chunk); - } - assert!(bytes.windows(4).any(|w| w == b"live"), "wanted={wanted}"); - assert_eq!( - bytes.windows(stamped.len()).any(|w| w == stamped), - wanted, - "wanted={wanted}: stamped only when the PUBLISH declares TIMESCALE" - ); - } - } - /// A listed compressed track is declared and served compressed only to a peer that /// negotiated FLATE; any other peer gets the plain copy with no declaration. #[moq_clock::test] diff --git a/rs/moq-net/src/ietf/subscriber.rs b/rs/moq-net/src/ietf/subscriber.rs index d09b4d415bf..889bc8421cd 100644 --- a/rs/moq-net/src/ietf/subscriber.rs +++ b/rs/moq-net/src/ietf/subscriber.rs @@ -8104,7 +8104,7 @@ mod tests { .into_iter() .flat_map(|version| [(version, true), (version, false)]) { - // Before draft-22 SUBSCRIBE cannot opt out. + // Draft 18's SUBSCRIBE cannot opt out. let wanted = timed || !ietf::Filter::is_draft22(version); let declares = |yes: bool| ietf::Properties { timescale: yes.then_some(declared), From 9191e61f197aec95da5ec0ae1640c42f99adefc9 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Thu, 29 Oct 2026 17:30:36 -0700 Subject: [PATCH 4/6] quest: drop the finished subscribe-timestamps blocker Co-Authored-By: Claude Opus 5.5 --- quest/m1/ietf-publisher-unknown-range.md | 1 - 1 file changed, 1 deletion(-) diff --git a/quest/m1/ietf-publisher-unknown-range.md b/quest/m1/ietf-publisher-unknown-range.md index 39fb45e3401..f27b71865dd 100644 --- a/quest/m1/ietf-publisher-unknown-range.md +++ b/quest/m1/ietf-publisher-unknown-range.md @@ -36,4 +36,3 @@ Public API: none. Wire: none; the marker exists in both drafts. - [Rust FETCH parity](/quest/m1/ietf-fetch-parity.md) - edits the same FETCH answer path - [Our moq-transport publishers serve at most one group](/quest/m1/ietf-publisher-one-group.md) - narrows the same FETCH answer and fill paths to one group -- [SUBSCRIBE honors the properties opt-out](/quest/m1/subscribe-timestamps.md) - edits the same publisher From e7b509684bb54b10bdc01009dbd72edbbb15efda Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Fri, 30 Oct 2026 20:53:23 -0700 Subject: [PATCH 5/6] quest: unblock ietf-publisher-unknown-range The base merge emptied its Required list; drop the heading and note the blockers have landed. Co-Authored-By: Claude Opus 5.5 --- quest/m1/ietf-publisher-unknown-range.md | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/quest/m1/ietf-publisher-unknown-range.md b/quest/m1/ietf-publisher-unknown-range.md index b350caab994..dfb757042fe 100644 --- a/quest/m1/ietf-publisher-unknown-range.md +++ b/quest/m1/ietf-publisher-unknown-range.md @@ -20,10 +20,12 @@ than only an eviction. `NotFound` and `Old` map to `0x10C`. Decide in the PR whether `Unsupported` and `NotFetchable` mean "unknown" too, or need their own handling, and record the reason. -Decided 2026-10-28 (maintainer): it starts after the quests below land, -since each edits the same publisher. Rust FETCH parity, also listed then, -landed in [moq-dev/moq#6999](https://github.com/moq-dev/moq/pull/6999). A -third was IETF fill timeout, which +Decided 2026-10-28 (maintainer): it starts after the open quests that edit +the same publisher land. Those have landed: Rust FETCH parity in +[moq-dev/moq#6999](https://github.com/moq-dev/moq/pull/6999), and the +SUBSCRIBE properties opt-out in +[moq-dev/moq#7085](https://github.com/moq-dev/moq/pull/7085). A third was +IETF fill timeout, which [moq-dev/moq#7194](https://github.com/moq-dev/moq/pull/7194) dropped for [one group](https://github.com/moq-dev/moq/pull/7204), which edited the same paths and has landed. A FETCH or fill now lists at most one group, so this @@ -33,6 +35,3 @@ Tests: a listed group evicted before it is written, for FETCH on drafts 18 and 22 and for a draft-22 fill, each failing before the fix. Run `just test interop --all` if the framing order changes. Public API: none. Wire: none; the marker exists in both drafts. - -## Required - From 31c3f87618d40b027d06a96e9e81ea49e1a30d2b Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sat, 31 Oct 2026 02:33:57 -0700 Subject: [PATCH 6/6] docs: the Timing bullet covers FETCH's properties opt-out Both Rust directions apply the same rule to FETCH since moq-dev/moq#6999. Co-Authored-By: Claude Opus 5.5 --- doc/concept/standard.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/concept/standard.md b/doc/concept/standard.md index 8950848d4fa..c30cd1e8c20 100644 --- a/doc/concept/standard.md +++ b/doc/concept/standard.md @@ -30,7 +30,7 @@ subset drops. What a peer actually observes against this implementation: - **A Rust TRACKS listing sends `SUBSCRIBE_TRACKS` upstream, only on demand.** Listing a broadcast from a moq-transport peer sends `SUBSCRIBE_TRACKS` with `FORWARD=0` while someone lists it, never on connect, announce, or subscribe, so a peer that refuses, resets, or ignores it affects only that listing. Each listed track's paused `PUBLISH` is its upstream copy, which a reader resumes rather than subscribing again. Only a `PUBLISH_DONE` with `TRACK_ENDED` removes a listed track, and it lists as finished; any other end, including the error our own answerer sends for a track that left unfinished, fails the listing, and readers list again. - **History is served one group at a time.** Our moq-transport publishers answer a `FETCH` only within one group, a draft-18 joining `FETCH` for the subscription's current group head, and a draft 20+ fill for the largest group's head. Whole-group fetches wait for an open group to finish. Both implementations accept and ignore `FILL_TIMEOUT`, including zero. A JavaScript subscription joins at the current group: on draft 18 it fetches the group's head with a Relative Joining `FETCH`, and from draft 20 asks for it with a fill. Datagrams are never fetchable. Subscribers still request ranges upstream, one per run of missing groups; a third-party publisher can answer those ranges and mark their gaps. A Rust reader that only fetches learns the track from `TRACK_STATUS`, so a finished track stays fetchable; a reader whose publisher refuses `TRACK_STATUS` as `NOT_SUPPORTED` still subscribes. - **Compression.** Rust peers exchange compressed tracks when both offer the [Flate extension](/draft/moq-flate). Other peers receive one shared inflated copy. A publisher that seals the compression declaration makes that fallback unavailable: an incompatible peer is refused, preserving the sealed metadata. JavaScript does not offer the IETF extension. -- **Timing.** A track whose `SUBSCRIBE_OK` or `PUBLISH` declares no `TIMESCALE` is untimed. A `SUBSCRIBE` with `INCLUDE_PROPERTIES=0` gets no `TIMESCALE`, so its objects go out unstamped. A Rust reader that never subscribed takes the units from `TRACK_STATUS`, and still asks for the properties whenever it subscribes to a timed track. +- **Timing.** A track whose `SUBSCRIBE_OK` or `PUBLISH` declares no `TIMESCALE` is untimed. A `SUBSCRIBE` or `FETCH` with `INCLUDE_PROPERTIES=0` gets no `TIMESCALE` in its `SUBSCRIBE_OK` or `FETCH_OK`, so its objects go out unstamped. A Rust reader that never subscribed takes the units from `TRACK_STATUS`, and still asks for the properties whenever it subscribes to or fetches a timed track. - **Strict SETUP and parameters.** Repeated unknown `SETUP` options, GREASE included, are accepted if well-formed; a repeated known option is rejected. A `GROUP_ORDER` other than Ascending (1) or Descending (2) closes the session. An unknown message parameter, or one defined only for another message, closes the session. Other malformed control input closes the session with the draft's code too, such as a server `SETUP` carrying `PATH` or `AUTHORITY`, a namespace field ending in `/` (it would map to a path with an empty segment), a request cut short by FIN, or a second `GOAWAY` on one stream; a first `GOAWAY` on a request stream is legal. - **One `SETUP` credential**, forwarded to the [auth server](/bin/relay/auth#the-contract) unverified. A second `SETUP` token closes the session. We advertise no token cache, so an alias reference in `SETUP` closes it with `PROTOCOL_VIOLATION`, one on a request with `UNKNOWN_AUTH_TOKEN_ALIAS`, and a registration on a request with `AUTH_TOKEN_CACHE_OVERFLOW`. Where the Rust side authorizes the peer or verifies tokens, a token on a `SUBSCRIBE` or `PUBLISH_NAMESPACE` is verified like an in-band session token and authorizes that one request alone, even where that authorization already covers it; it never widens the session. It is refused with `NOT_SUPPORTED` when nothing verifies it, when it is empty, or when its Token Type is anything but 0 (out of band). A side that does neither, JavaScript included, ignores the token. Rust refuses a request carrying more than one distinct token with `NOT_SUPPORTED`, since it verifies one; JavaScript, which verifies none, ignores them all. A token-authorized `SUBSCRIBE` still stays within the grant the peer gave us. A token-authorized `PUBLISH_NAMESPACE` needs a grant covering everything beneath the namespace, and the tracks we subscribe under it rely on that announce instead of our limit, ending with it. An update renews the token, and a refused renewal ends only that request. Rust and JavaScript send the token a route names (`Route::auth`) on its `PUBLISH_NAMESPACE`, and swapping it renews the request with `REQUEST_UPDATE`; the inline `NAMESPACE` that answers a solicited `SUBSCRIBE_NAMESPACE` carries no token. A token added to a reconnecting connection's auth handle rides every session it makes, so the announcement keeps it across a reconnect; one added to a single session's handle ends with that session. A token on any other request is decoded and grants nothing, and a request repeating one is refused with `MALFORMED_AUTH_TOKEN`. The negotiated [MoQ Auth extension](/concept/moq-lite#authorization) accepts additional session tokens in band. - **Pause delivery.** `FORWARD=0` on a `SUBSCRIBE` or its update drops the subscription, closing its data streams and holding nothing upstream, while the request and its slot stay. `FORWARD=1` subscribes again as a new `SUBSCRIBE` with the same filter would, so nothing carries across the pause: its `REQUEST_OK` names the live edge it joined at. A paused update may change only priority and max age.