Skip to content

feat(moq-net): let a subscriber choose the SUBSCRIBE group order - #5370

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

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

Conversation

@kkroo

@kkroo kkroo commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Problem

GROUP_ORDER was a module constant written unconditionally on both wire shapes, and Subscribe had no field for it, so no caller could ask for Ascending. The decode side already read and validated the value, then dropped it.

Approach

Add groupOrder to Subscribe and its constructor options, defaulting to Descending, which preserves existing callers. Both encode paths write the selected field instead of the constant, and both decode paths pass the parsed value through.

GroupOrder.Default is normalized to the client default in the constructor, so the field a caller reads is always a real order and zero cannot reach an encoder. This matters from draft-15, where GROUP_ORDER is a message parameter and Parameters rejects zero as a protocol violation; the draft-14 inline path is covered too.

Impact

  • Additive public API: Subscribe.groupOrder and the matching constructor option.
  • No wire change; the field was already written, just never chosen.

Alternatives

Leaving the constant and exposing a session-level default was rejected because group order is a per-subscription property on the wire, and a session-level knob cannot express mixed subscriptions.

Follow-ups

None.

Tests

Tests run on draft-14 and draft-20. The ascending case is differential: it encodes the same message both ways and requires exactly one byte to differ. Assertions cover both encode sites, constructor normalization, and decode pass-through.


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

GROUP_ORDER was a module constant written unconditionally on both wire
shapes, and `Subscribe` had no field for it, so no caller -- internal or
public -- could ask for Ascending. The decode side already read the value
and validated it, and then dropped it on the floor: a relay built on this
parsed the subscriber's requested order correctly and could not act on it.

Add `groupOrder` to `Subscribe` and its constructor options, defaulting to
Descending, which is what every subscription sent before the field existed.
Both encode paths write the field instead of the constant, and both decode
paths pass the parsed value through.

`GroupOrder.Default` (0x0) is the wire's "no preference". It is normalized
to the client default in one place, the constructor, so the field a caller
reads back is always a real order and 0 can never reach an encoder. That
matters from draft-15, where GROUP_ORDER is a message parameter and
Parameters rejects 0 as a protocol violation -- only draft-14's inline
field can carry it at all, and that path is covered.

Tests run on draft-14 and draft-20. The ascending case is a differential:
it encodes the same message both ways and requires exactly one byte to
differ, 0x02 -> 0x01, since a plain byte search would pass on requestId 1n
alone. Each assertion is mutation-checked -- hardcoding either encode site,
dropping the constructor normalization, and dropping the decode
pass-through each turn a distinct test red.
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>
@kixelated

Copy link
Copy Markdown
Collaborator

Thank you @kkroo! Your commit is the first one in #5385, with your authorship kept. That PR finishes the job: a Subscription.order in Rust and @moq/net, a lite-07 Group Order field, and GROUP_ORDER honored by both publishers. The later commits credit you with Co-authored-by.

(Written by Claude Opus 5.5)

@kixelated

Copy link
Copy Markdown
Collaborator

Landed in #5385, which carries this work with your authorship and co-author credit. Thank you!

(Written by Claude Opus 5.5)

@kixelated kixelated closed this Oct 13, 2026
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