From bb1e2d2a74234e49b40e21608948e49ac278f239 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Tue, 13 Oct 2026 20:33:19 -0700 Subject: [PATCH 1/2] quest(m2): plan sending a JS group's fill ahead of its live rest Co-Authored-By: Claude Opus 5.5 --- quest/m2/README.md | 1 + quest/m2/js-fill-first.md | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 quest/m2/js-fill-first.md diff --git a/quest/m2/README.md b/quest/m2/README.md index 6cbe21faea2..83568d40a54 100644 --- a/quest/m2/README.md +++ b/quest/m2/README.md @@ -175,3 +175,4 @@ ranked just below deterministic TS legs, which it requires. - [IETF driver double poll](/quest/m2/ietf-driver-double-poll.md) - a fired deadline costs a moq-transport session's driver one poll, as #5393 makes moq-lite's - [Play resume](/quest/m2/play-resume.md) - `moq-cli play` plays out pictures buffered before a declared end when new media arrives quickly - [Task supervision](/quest/m2/task-supervision.md) - the auth decider loop, stats publisher, and moq-tokio's token and WebSocket internals are supervised like #5447's tasks +- [JS fill first](/quest/m2/js-fill-first.md) - the JS publisher sends a group's fill ahead of its live rest, matching Rust diff --git a/quest/m2/js-fill-first.md b/quest/m2/js-fill-first.md new file mode 100644 index 00000000000..5c6d91ab659 --- /dev/null +++ b/quest/m2/js-fill-first.md @@ -0,0 +1,30 @@ +# [S] JS sends a group's fill ahead of its live rest + +## Goal + +When a draft-20 fill and the live stream of the same group are both in +flight, the JS publisher sends the fill (the earlier start object) first, +so a joining subscriber gets the group's start before its tail. Track +priority and group order still dominate. moq-lite ordering is unchanged. +This mirrors Rust's start-object tie-break from +[#5470](https://github.com/moq-dev/moq/pull/5470). + +## Plan + +Today `Priority#position` (`js/net/src/priority.ts`) assumes sequences are +unique within a subscription, but `#runFill` (`js/net/src/ietf/publisher.ts`) +registers a second stream for the live group's sequence, so the two tie. + +Decided 2026-10-13 (maintainer): rank streams, not groups. +`Priority.add` takes the stream's start object, and `#position` also counts a +same-group stream with an earlier start as ahead. `sendOrder`'s packing is +unchanged, which avoids bounding the start object. Group streams pass their +first object, a fill its start. Lite always starts at 0, so it keeps its +order. + +Add a regression in `js/net/src/priority.test.ts` like Rust's +`a_fill_outranks_the_rest_of_its_group`: register the live rest first, then +the fill of the same group, and expect the fill to rank higher, in both group +orders, without the start ever overriding group order. + +Public API: none (`Priority` is `@internal`). Wire: none. From 0eeb9d17fd0bd6fe4bcb67efa361032ffe45ef83 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Tue, 13 Oct 2026 20:38:09 -0700 Subject: [PATCH 2/2] quest(m2): pass Lite's real frame start to Priority.add Lite can start a group mid-way via draft-06+ startFrame, so the plan no longer claims it always starts at 0. Co-Authored-By: Claude Opus 5.5 --- quest/m2/js-fill-first.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/quest/m2/js-fill-first.md b/quest/m2/js-fill-first.md index 5c6d91ab659..8190940d44f 100644 --- a/quest/m2/js-fill-first.md +++ b/quest/m2/js-fill-first.md @@ -18,9 +18,11 @@ registers a second stream for the live group's sequence, so the two tie. Decided 2026-10-13 (maintainer): rank streams, not groups. `Priority.add` takes the stream's start object, and `#position` also counts a same-group stream with an earlier start as ahead. `sendOrder`'s packing is -unchanged, which avoids bounding the start object. Group streams pass their -first object, a fill its start. Lite always starts at 0, so it keeps its -order. +unchanged, which avoids bounding the start object. Every stream passes the +object it starts at: an IETF group stream its first object, a fill its start, +and a Lite group its `frameRange` start (nonzero for a draft-06+ +`startFrame`). Lite never registers two streams for one sequence, so its +order is unchanged. Add a regression in `js/net/src/priority.test.ts` like Rust's `a_fill_outranks_the_rest_of_its_group`: register the live rest first, then