Repository navigation
Conversation
Quest-Claim: dcb7840a6eb8f10e
…ement A group a copy closes with a bare FIN (no GROUP_END) may hold more frames. When the front replaced that copy, or its route failed, the read now asks the replacement for the next frame, as a stall does, instead of ending the group where the old copy closed it. The group ends where it closed only once no route can supply more: the replacement refuses the rest, the group goes stale, or no front is left to replace the copy. Groups read to a GROUP_END end as before. Rust and @moq/net match. The resume models in both languages gain a Close op, and their oracle requires a short group to end only where a live route closed it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Finishes quest/m1/switch-partial-close.md and deletes it.
A group that a copy closes with a bare FIN (no GROUP_END) may hold more frames. Before this PR, a read that reached that FIN ended the group, even when the front had already replaced the copy and the replacement held the rest. Whether the reader got the rest depended on arrival order: it did only if it parked on the next frame before the FIN landed.
Now a read that reaches a short close on a copy the front replaced, or whose route failed, asks the replacement for the next frame, as a stall does. The group ends where it closed only once no route can supply more: the replacement refuses the rest, the group goes stale under the reader's budget, or no front is left to replace the copy. A group read to a GROUP_END is whole and ends as before. Rust and
@moq/netmatch.Changes
rs/moq-net/src/model/resume.rs:Recover::polltakes aCause(Stalled,Closed,Failed) instead of an optional error.Closedis settled like a failure, so a refusal concludes it, but where nothing replaces the copy, or the copy still serves with no front to replace it, its close stands (NotFound, which the group reads as a clean end).wantsalso looks past a copy that closed short on a route that failed since.rs/moq-net/src/model/group.rs:poll_resumedrecovers a short-closed read (closed_short) instead of ending it, ends it cleanly when the recovery says the close stands or the group expired, andpoll_finishedcounts a short close the same way.js/net/src/group.ts,js/net/src/resume.ts,js/net/src/internal.ts: the same in JS.Recover.replacetakes aRecoverCause. A front-handed group'sclosedandreadable()decide a short close only when a read or an awaitedclosedasks, so a wait for readability (such as a track mirror) does not end the group before a route move can continue it. Internal watchers use a new quiethooks.groupClosedthat never decides.resume_model.rs,resume.model.test.ts) gain aCloseop that closes a route's group short, optionally failing the route right after. Their oracle now requires that a group ends short only at a frame count some route closed it at, and, under an hour's budget with a route left and the group not expired, only where a live route closed it.finish()now usefinish_at(producer_replacedinroute_change.rs, two ingroup.test.ts, one inresume.rs).Public API: none. Wire: none.
Validation
model::resume::test):a_replaced_copys_short_group_continues_from_the_replacement,a_short_group_on_a_failed_route_waits_for_the_next,a_short_group_the_replacement_lacks_is_fetched,a_short_group_ends_where_it_closed_once_stale,a_short_group_ends_once_no_route_holds_more.resume.test.ts): a replaced copy's short group continues from the replacement (closing before and after the swap), reads on once the rest lands on the replacement, waits for the next route after its route failed, and ends once no route holds more, while its copy still serves, or once no route is left to ask.group N ended after 1 frames where a failed route closed it); with it, the Rust model passes 3000 cases at seeds 2026 and 777, and the JS model 3000 cases at seeds 1, 7, 2026, 99991, 31337, and 4242.cargo nextest run -p moq-net --all-features: 4133 passed after merging main.bun testinjs/net: 3445 passed.just check: passed.ResumeReaderspec models whole groups only (no frames, noRecover), so it does not cover this; its "Not covered" note already says so.Caused by
Recovery has ended a group at any end its copy reported since it landed: Rust in #4741, JS in #5836. Once a group's end could say it is whole (
finish_at, GROUP_END), a bare FIN stopped meaning the group is complete, but recovery kept reading it that way. Found by the 2026-11-20 audit of the subscription rules before the lite-07 cut.Models
Size: M
Implementer: Claude, claude-opus-5-5, high effort (arm B)
Follow-ups
None.
Waiting
finish()and whose route then fails before the reader sees the FIN now waits on the replacement like a mid-group failure: it continues if the replacement holds more, and otherwise ends when the replacement refuses the rest or the group goes stale. An encoder restart that starts the new producer at the next group leaves that group waiting until it goes stale, whichproducer_replacedhit until its groups usedfinish_at. A reader reading groups concurrently is unaffected; a strictly sequential one stalls. Recommended: accept, since a bare FIN says the group may hold more and media producers usefinish_at. The alternative is to reopen a short close only once the front has already moved to another route, which keeps the old ending when the copy fails right after its FIN but loses the rest whenever the failure lands first.closedandreadable()no longer settle at the FIN: a short close is decided when a read or an awaitedclosedasks, so a route move landing just after the FIN still continues the group. Rust reads lazily already. Recommended: accept, for parity with Rust.(Written by Claude Opus 5.5 with high)
🤖 Generated with Claude Code
Review
Rewritten by
quest reviewafter each round.Head: 9856e36, named in full once no reviewer reports a finding
Base: origin/main at b4496b1
Risk: medium,
The change alters Rust and JS group recovery and completion behavior during route changes, potentially causing consumers to miss frames or wait incorrectly, but preserves public APIs and wire formats and is fully undone by a revert.Classified: medium by Codex, gpt-6.1-sol, low effort, session
01a1fc45-d41a-73a0-a6de-15bf904376b7Reviewer: Codex, gpt-6.1-sol, high effort
Session:
01a1fc45-ea61-72b3-a17d-a66c92e027a4, round 1Score: 6/10,
The fix needs rework because cache release and close monitoring can still disable recovery prematurely and cause consumers to miss frames.Rounds: 1; first round 3 (medium 3); findings 3 (medium 3): fixed 0, refuted 0, open 3
Findings, open until the next round settles them:
rs/moq-net/src/model/group.rs:4638:Preserve short-close recovery after cache releasejs/net/src/group.ts:1080:Move publisher monitors onto the non-reading close viewjs/net/src/group.ts:980:Stop judging closes after their observers unsubscribe