From 1a96d19e0e9dbb5aaca12fb5fe183f13b09096f7 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Thu, 8 Oct 2026 16:29:58 -0700 Subject: [PATCH 1/3] quest: claim m0/ietf-end-of-track-location Co-Authored-By: Claude Opus 5.5 From 5d9c32704bcf1190252add17861b69652ac7b36f Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Thu, 8 Oct 2026 17:02:02 -0700 Subject: [PATCH 2/3] fix(net): a capped IETF stream never claims END_OF_GROUP A subgroup stream cut short by the subscription's end Location set the END_OF_GROUP header bit, so a subscriber inferred the group ended at the cap. Clear it whenever the range caps the group, in Rust and JS. Co-Authored-By: Claude Opus 5.5 --- js/net/src/ietf/publisher.test.ts | 18 ++++++++++--- js/net/src/ietf/publisher.ts | 4 ++- quest/m0/README.md | 1 - quest/m0/ietf-end-of-track-location.md | 29 --------------------- rs/moq-net/src/ietf/publisher.rs | 36 ++++++++++++++++++++++++++ 5 files changed, 54 insertions(+), 34 deletions(-) delete mode 100644 quest/m0/ietf-end-of-track-location.md diff --git a/js/net/src/ietf/publisher.test.ts b/js/net/src/ietf/publisher.test.ts index 329a1ef3a8e..6c844fddd72 100644 --- a/js/net/src/ietf/publisher.test.ts +++ b/js/net/src/ietf/publisher.test.ts @@ -1523,6 +1523,8 @@ interface ServedGroup { sequence: number; /** Whether the header claimed the stream starts at the group's first object. */ firstObject: boolean; + /** Whether the header claimed the stream's FIN ends the group (END_OF_GROUP). */ + endOfGroup: boolean; /** Each object's absolute id (reconstructed from its delta) and payload. */ objects: { id: number; payload: string }[]; } @@ -1654,7 +1656,12 @@ async function readGroup(stream: ReadableStream): Promise): Promise /** * An absolute filter names the objects it wants, so the boundary groups are trimmed to it * and the groups outside it are never opened. The first object written carries its absolute - * id, or the subscriber would read a silently renumbered group. + * id, or the subscriber would read a silently renumbered group, and a capped tail does not + * claim END_OF_GROUP, or the subscriber would think the group ended at the cap. */ test("draft-20: an absolute filter trims the range it serves", async () => { const fx = fixture(); @@ -1746,6 +1754,7 @@ test("draft-20: an absolute filter trims the range it serves", async () => { sequence: 1, // The head was trimmed, so the stream does not start at the group's first object. firstObject: false, + endOfGroup: true, objects: [ { id: 1, payload: "1.1" }, { id: 2, payload: "1.2" }, @@ -1757,6 +1766,8 @@ test("draft-20: an absolute filter trims the range it serves", async () => { expect(await readGroup(second)).toEqual({ sequence: 2, firstObject: true, + // The filter ends at object 0 of 3, so the stream stops before the group does. + endOfGroup: false, objects: [{ id: 0, payload: "2.0" }], }); @@ -1818,6 +1829,7 @@ test("draft-20: a fill serves the current group's head on a fetch stream", async expect(await readGroup(live)).toEqual({ sequence: 0, firstObject: false, + endOfGroup: true, objects: [{ id: 2, payload: "0.2" }], }); } finally { @@ -1894,7 +1906,7 @@ test("draft-20: a backwards range within one group serves nothing and ends the s try { const served = await nextUni(fx.uni); if (!served) throw new Error("the group stream never opened"); - expect(await readGroup(served)).toEqual({ sequence: 0, firstObject: false, objects: [] }); + expect(await readGroup(served)).toEqual({ sequence: 0, firstObject: false, endOfGroup: false, objects: [] }); } finally { fx.close(); client.close(); diff --git a/js/net/src/ietf/publisher.ts b/js/net/src/ietf/publisher.ts index e8035c66f3b..6de9c27f590 100644 --- a/js/net/src/ietf/publisher.ts +++ b/js/net/src/ietf/publisher.ts @@ -677,7 +677,9 @@ export class Publisher { hasExtensions: timescale !== undefined, hasSubgroup: false, hasSubgroupObject: false, - hasEnd: true, + // A stream capped by the range stops before the group may end, so its FIN + // cannot claim END_OF_GROUP. + hasEnd: slice.until === undefined, hasPriority: true, // Only honest when the stream really starts at the group's first object; // a trimmed head starts partway through. diff --git a/quest/m0/README.md b/quest/m0/README.md index 1a36af68210..96748f361c2 100644 --- a/quest/m0/README.md +++ b/quest/m0/README.md @@ -64,7 +64,6 @@ remain and no release waits on them. - [Serve budget](/quest/m0/serve-budget.md) - a kio task that always has work ready yields after a budget, so a fast publisher can't starve its own QUIC driver - [Draft-22 LOCATION_FILTER](/quest/m0/ietf-location-filter-22.md) - moqt-22 LOCATION_FILTER carries its type instead of a Length in Rust and JS, so a draft-22 peer reads our Next Object correctly - [Draft-22 media on 0.17](/quest/m0/release-22/README.md) - a 0.17.x with the LOCATION_FILTER and FIRST_OBJECT fixes and moq-noq 1.3.4, before Seattle -- [Capped stream END_OF_GROUP](/quest/m0/ietf-end-of-track-location.md) - a stream capped by the subscription's end Location never claims END_OF_GROUP; moving End of Track's Location is deferred - [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 - [Demand lost wake](/quest/m0/demand-lost-wake.md) - a reader that comes and goes between a demand poll and its re-read never leaves a front or `broadcast::Demand` without a wake - [FFI publisher stall](/quest/m0/ffi-publisher-stall.md) - every Go and Python publisher cell passes reliably once the serve budget lands, and a cell fails when a connection idles out diff --git a/quest/m0/ietf-end-of-track-location.md b/quest/m0/ietf-end-of-track-location.md deleted file mode 100644 index d7517a40e59..00000000000 --- a/quest/m0/ietf-end-of-track-location.md +++ /dev/null @@ -1,29 +0,0 @@ -# [XS] A capped IETF stream never claims END_OF_GROUP - -## Goal - -A subgroup stream cut short by the subscription's end Location does not set -the END_OF_GROUP bit in its header, in `rs/moq-net` and `js/net`. Today it -does, so a subscriber infers the group ended at the cap when objects past it -exist. - -## Plan - -Triaged from Fastly's follow-up on #5020 (runs of 2026-10-07 on `0f310a5`, -d18 and d21, cells `status-end-of-track` and `publish-done`). - -Decided 2026-10-08: shrunk to this bug. Moving END_OF_TRACK onto the -upstream's Location (5/5 on group 5's stream rather than 6/0 on a new -stream) is conformance polish with no lost data; deferred to an m1 -follow-up. - -Rust: the subscription's group header in `rs/moq-net/src/ietf/publisher.rs` -takes `has_end` from `GroupFlags::default()`, which is true. Clear it when -`GroupSlice::until` cuts the group short. JS: the matching header in -`js/net/src/ietf/publisher.ts` hard-codes `hasEnd: true`. - -Test: a subscription whose end Location falls inside a group gets that -group's stream with a header without END_OF_GROUP, in both languages. - -Public API: none. Wire: none (a capped stream's header bit changes, not its -format). diff --git a/rs/moq-net/src/ietf/publisher.rs b/rs/moq-net/src/ietf/publisher.rs index b2ea00c2f8b..2c641e77b91 100644 --- a/rs/moq-net/src/ietf/publisher.rs +++ b/rs/moq-net/src/ietf/publisher.rs @@ -2697,6 +2697,9 @@ impl TrackServe { flags: ietf::GroupFlags { has_extensions: self.timescale.is_some(), first_object: slice.skip == 0, + // A stream capped by the range stops before the group may end, so its + // FIN cannot claim END_OF_GROUP. + has_end: slice.until.is_none(), ..Default::default() }, }; @@ -5441,6 +5444,39 @@ mod serve_tests { "the cap excludes cc" ); } + + /// A stream cut short by the range's end Location does not claim END_OF_GROUP, since + /// the group goes on past it. A range ending on a whole group still does. + #[moq_net_sim::test] + async fn capped_group_does_not_claim_its_end() { + async fn serve(object: Option) -> ietf::GroupHeader { + let log = crate::lite::test_transport::Log::default(); + let session = SinkSession::new(log.clone()); + + let track = track::Producer::new(std::sync::Arc::new(crate::broadcast::Info::default()), "test", None); + let subscriber = track.subscribe(None); + + let mut group = track.append_group().unwrap(); + for payload in [b"aa", b"bb", b"cc"] { + group.write_frame(crate::Timestamp::ZERO, payload.as_slice()).unwrap(); + } + group.finish().unwrap(); + track.finish().unwrap(); + + let range = ServeRange { + start: Some(Location { group: 0, object: 0 }), + end: Some(EndLocation { group: 0, object }), + }; + let mut serve = TrackServe::new(session, subscriber, RequestId(0), Version::Draft20, range, None); + kio::wait(|waiter| serve.poll(waiter)).await.unwrap(); + + let mut buf = bytes::Bytes::from(log.writes.lock().unwrap().clone()); + crate::coding::decode_buf(&mut buf, Version::Draft20, ietf::GroupHeader::decode).expect("a group header") + } + + assert!(!serve(Some(0)).await.flags.has_end, "capped at object 0 of 3"); + assert!(serve(None).await.flags.has_end, "the whole group"); + } } #[cfg(test)] From bd6f516214e8f534a2c7ee392d71cd4574ac400b Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Fri, 9 Oct 2026 09:46:46 -0700 Subject: [PATCH 3/3] test(net): note a cap past the group's end also clears END_OF_GROUP Co-Authored-By: Claude Opus 5.5 --- rs/moq-net/src/ietf/publisher.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rs/moq-net/src/ietf/publisher.rs b/rs/moq-net/src/ietf/publisher.rs index 3de3d6394e5..db8ea33d87b 100644 --- a/rs/moq-net/src/ietf/publisher.rs +++ b/rs/moq-net/src/ietf/publisher.rs @@ -6046,7 +6046,8 @@ mod serve_tests { } /// A stream cut short by the range's end Location does not claim END_OF_GROUP, since - /// the group goes on past it. A range ending on a whole group still does. + /// the group goes on past it. A range ending on a whole group still does. A cap at or past + /// the group's real end clears the bit too, since the header is written before we know. #[moq_net_sim::test] async fn capped_group_does_not_claim_its_end() { async fn serve(object: Option) -> ietf::GroupHeader {