Repository navigation
Conversation
…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.
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
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.
Need help on this PR? Tag
@codesmith-botwith what you need.