Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/concept/standard.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 fails the listing, and readers list again. Our own moq-transport publishers refuse it, so a Rust listing of one fails.
- **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` 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. 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.
Expand Down
1 change: 0 additions & 1 deletion quest/m1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ removed).
- [moq-quic's API improves on quinn's](/quest/m1/quic-api/README.md) - moq-quic and both QUIC drivers ship one mirrored API: `send::`/`recv::` namespaces, one error per direction, consuming terminal operations, plain configs, no quinn baggage
- [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 cancels an unclaimed fill head when a subscription ends](/quest/m1/ietf-fill-end-cancel.md) - SUBSCRIPTION_ENDED cancels, not finishes, a fill no group was sent for, as in JS
- [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
- [A resumed untimed copy keeps DYNAMIC_GROUPS](/quest/m1/ietf-dynamic-groups-resume.md) - opting out of properties on a draft-22 resume no longer forgets DYNAMIC_GROUPS
- [Rust marks a lost listed group unknown](/quest/m1/ietf-publisher-unknown-range.md) - the Rust IETF publisher sends End of Unknown Range for a listed group it can't serve, after the publisher's open quests land
- [Native rung disable](/quest/m1/simulcast-rung-disable.md) - OBS stops sending the top renditions its grant cannot fund, as the Rust/FFI publishers do, and a shaped uplink through moq-ffi proves the resume
Expand Down
14 changes: 6 additions & 8 deletions quest/m1/ietf-publisher-unknown-range.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -33,7 +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

- [SUBSCRIBE honors the properties opt-out](/quest/m1/subscribe-timestamps.md) - edits the same publisher
25 changes: 0 additions & 25 deletions quest/m1/subscribe-timestamps.md

This file was deleted.

22 changes: 12 additions & 10 deletions rs/moq-net/src/ietf/publisher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1381,9 +1381,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(),
Expand Down Expand Up @@ -1975,9 +1973,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.
Expand Down Expand Up @@ -8938,10 +8936,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();
Expand All @@ -8963,7 +8961,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"
);
}
}

Expand Down
65 changes: 34 additions & 31 deletions rs/moq-net/src/ietf/subscriber.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3189,8 +3189,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,
Expand Down Expand Up @@ -3416,20 +3421,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;
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
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.
Expand Down Expand Up @@ -3961,7 +3956,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()),
};
Expand Down Expand Up @@ -8498,13 +8494,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::Draft20, Version::Draft22] {
let opts_out = ietf::Filter::is_draft20(version);
for (version, timed) in [Version::Draft18, Version::Draft20, Version::Draft22]
.into_iter()
.flat_map(|version| [(version, true), (version, false)])
{
// Draft 18's SUBSCRIBE cannot opt out.
let wanted = timed || !ietf::Filter::is_draft20(version);
let declares = |yes: bool| ietf::Properties {
timescale: yes.then_some(declared),
..Default::default()
Expand All @@ -8513,20 +8513,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,
),
Expand Down Expand Up @@ -8582,10 +8581,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
Expand All @@ -8598,8 +8601,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();
}
Expand Down