Skip to content

fix(moq-net): accept END_OF_GROUP when the header also marks the group end - #5368

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

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

Conversation

@kkroo

@kkroo kkroo commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The End-of-Group header bit and an explicit END_OF_GROUP object (status 0x03) are two independent ways to state where a group ends, and draft-20 makes neither conditional on the other. A publisher may legally use both: the bit says this stream carries the group to its end, and the object says which object that end is at.

Frame.decode accepted status 0x03 only on the branch where the header did not mark the end. The combination matched no branch and fell through to Unsupported object status 3, which propagates out of the group read loop and closes the group with that error. A publisher that stated the end twice lost the whole group, including objects already delivered on that stream, rather than only the redundant marker.

Approach

Accept GROUP_END inside the hasEnd branch, returning the same payload-less Frame the other branch already returns. The subscriber breaks its read loop on an undefined payload. This stays distinct from status 0, which is an empty frame rather than a group end.

Impact

  • No public API or wire change. A packet combination that previously threw is now decoded.

Alternatives

Treating the header bit as authoritative and ignoring the object was rejected because it discards the only statement of which object the end is at.

Follow-ups

None.

Tests

The codec test pins both header shapes plus the status-0 case. The subscriber test pins that the group closes cleanly rather than merely stopping. Both tests fail with the fix reverted.


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

…p end

The End-of-Group header bit and an explicit END_OF_GROUP object (status
0x03) are two independent ways to state where a group ends, and draft-20
makes neither conditional on the other. A publisher may legally use both:
the bit says this stream carries the group to its end, the object says
which object that end is at.

Frame.decode accepted status 0x03 only on the branch where the header did
NOT mark the end. The combination matched no branch and fell through to
`Unsupported object status: 3`, which propagates out of handleGroup's read
loop; the catch then closes the group with that error. So a publisher that
stated the end twice -- correctly, both times -- lost the whole group,
including the objects already delivered on that stream, not just the one
redundant marker.

Accept GROUP_END inside the hasEnd branch, returning the same payload-less
Frame the other branch already returns: the subscriber breaks its read loop
on `payload === undefined`. This stays distinct from the `status === 0`
case, which is an empty frame rather than a group end; the two are
different objects and are not merged.

Tested at both levels, because they make different claims. The codec test
pins both header shapes plus the status-0 case. The subscriber test pins
that the group closes cleanly rather than merely stopping -- a torn-down
group also stops producing frames, so asserting "nothing more arrives"
would pass on the bug. Both go red with the fix reverted.
@kixelated

Copy link
Copy Markdown
Collaborator

Thanks @kkroo! #5081 landed the same decoder fix shortly after this was opened, so the remaining non-redundant piece is your codec-level test. I couldn't push the conflict resolution here because the head is on an organization-owned fork, so it continues in #5378 with your commit preserved and a co-author credit on the squash.

(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