Skip to content

feat(moq-net): carry SUBSCRIBE_OK Largest Location to the consumer - #5369

Closed
kkroo wants to merge 1 commit into
moq-dev:mainfrom
Blockcast:blockcast/ietf-subscribe-ok-largest
Closed

kkroo wants to merge 1 commit into
moq-dev:mainfrom
Blockcast:blockcast/ietf-subscribe-ok-largest

Conversation

@kkroo

@kkroo kkroo commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Problem

SubscribeOk.largest is decoded from the wire and then dropped. Outside its codec and tests it has no readers, request.accept carries no location, and downstream code cannot observe it.

It is the only value that can answer where the publisher live edge is before the first group arrives, which is needed for a NEXT_GROUP_START anchor. Subscriber.largest reads groups buffered for this subscriber, so it is undefined before anything arrives and again after eviction.

Approach

Surface the value as Info.publisherLargest.

  • It is named publisherLargest to remain distinct from Subscriber.largest, which is the weaker buffered-edge value.
  • It is a snapshot fixed at accept time and never updated, alongside the other accept-time properties.
  • It is optional on the moq-lite path, which has no equivalent wire field.
  • Both wire fields are u62 and the API carries numbers, so values past 2^53 are dropped with a debug log rather than rounded.

Impact

  • Additive public API: Info.publisherLargest is an optional PublishedLocation.
  • No wire change; the field was already decoded.

Alternatives

Extending Subscriber.largest to fall back to SUBSCRIBE_OK was rejected because it would conflate two different questions behind one name.

Follow-ups

None.

Tests

One test asserts the value reaches the consumer before any group is handled and that largest remains undefined then. A second test pins that an omitted field stays distinguishable from a stated one. Dropping the accept-time assignment turns the first test red.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

SubscribeOk.largest is decoded off the wire and then dropped: outside its
own codec and tests it has no readers, and `request.accept(...)` carries no
location, so nothing downstream can observe it.

It is the only thing that can answer "where is the publisher's live edge"
before the first group arrives, which is what a NEXT_GROUP_START anchor
needs. `Subscriber.largest()` cannot: its own doc says it reads the groups
buffered for this subscriber, so it is undefined before anything arrives
and again after eviction -- exactly the window the anchor asks about.

Surface it as `Info.publisherLargest`. Three notes on the shape:

- Not named `largest`. `Subscriber.largest()` already exists and means the
  weaker buffered-edge value; a caller reaching for the wrong one would
  anchor against undefined and silently fall back, which never raises.
- A snapshot, not a live edge: fixed at accept time and never updated,
  which is what lets it sit beside the other accept-time properties. The
  "maps 1:1 onto TRACK_INFO" sentence on Info is amended to name it as the
  exception -- the moq-lite path has no equivalent wire field and leaves it
  unset, where every other Info field is defaulted.
- Not a Location. `PublishedLocation` is {group, object} because the second
  component is an Object ID, not a frame index; a publisher may number its
  objects with gaps, so this does not count what precedes it.

Both wire fields are u62 and the API carries numbers, so a value past 2^53
is dropped with a debug log rather than rounded: `undefined` already means
"the publisher did not say", which every caller handles, and a silently
wrong anchor does not.

Two tests. The first asserts the value reaches the consumer before any
group is handled AND that `largest()` is still undefined at that moment --
asserting both together is what pins the distinction. The second pins that
an omitted field stays distinguishable from a stated one. Dropping the
single line from accept() turns the first red and leaves the second green.
@kixelated

Copy link
Copy Markdown
Collaborator

Thanks for this, and for spelling out the motivation. We're closing it in favor of a different shape, planned in #5379 (quest/m1/largest.md):

  • Info is per-track and immutable, shared by every subscriber of a cached track, so a per-subscription snapshot there goes stale after the first subscriber, a resubscribe, or a resume.
  • moq-lite-07's SUBSCRIBE_START carries largest too, so the value shouldn't be IETF-only, and Rust needs the same API.
  • Instead, largest() will replace latest() on the track producer, consumer and subscriber in Rust and JS, as a live stream of the largest Location: known before the first group from SUBSCRIBE_OK / SUBSCRIBE_START, then advancing as groups and frames arrive.

That should cover the NEXT_GROUP_START anchor use case without a stale snapshot. Happy to hear if it misses something you need.

(Written by Claude Opus 5.5)

@kixelated kixelated closed this Oct 13, 2026
kixelated added a commit that referenced this pull request Oct 13, 2026
Split `order` out of the model-ranges quest so it can land now on the
contributor's #5370 commit, and plan `largest()` replacing `latest()` as a
live stream seeded by the publisher's reported largest, instead of #5369's
Info snapshot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants