Skip to content

fix(net): a finished bounded copy leaves the largest group open - #7053

Merged
kixelated merged 3 commits into
mainfrom
quest/m1/settled-copies
Oct 28, 2026
Merged

kixelated merged 3 commits into
mainfrom
quest/m1/settled-copies

Conversation

@kixelated

@kixelated kixelated commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Every moq-net check that asks whether a group is done must mean one of two things. Either a copy whose writer finished (Handle::is_settled), or the whole group reaching its end (is_finished). Three review rounds on moq-dev/moq#6922 each fixed one wrong site. quest/m1/settled-copies.md asks for an audit of every caller at once.

One related check was wrong. group::Producer::finish calls finish_largest for every copy. When a bounded fetch copy of the largest group finished, the largest was marked final even though the group could still grow. On a track whose end was already reached, the largest stream then ended early.

Approach

  • finish calls finish_largest only for a copy no transport bound cut short. This reuses the original_fin the compressor already computes. A new test, a_finished_bounded_copy_keeps_the_largest_open, failed before the fix.
  • The comments on cache::Largest::open and finish_largest now say "whole copy".
  • tear_down gets a comment saying its whole-group open/retain checks are deliberate.

Audit of rs/moq-net/src/model/. Every caller other than finish_largest already uses the meaning it needs:

Caller Check Needs Verdict
TrackState::tear_down, the copies it aborts !is_settled copy right: aborting a finished bounded copy would fail its reader
tear_down open (dropped) !any(is_finished) whole right: a bounded copy serves no group reader, so the slot is given up
tear_down lookup.retain any(is_finished) whole right, deliberate: a slot holding only a bounded copy leaves the cache, but a reader holding that copy keeps it (it is not aborted)
TrackState::set_idle (displaced) !any(is_finished) whole right: the next feed has to send the group whole again
TrackState::is_settled slot.group.is_settled copy right (the fix from #6922)
Consumer::parked_whole is_finished with frame 0 whole right
Detached::writing !is_settled copy right
Handle::abort_open, resume_frame (inline fin) copy / whole as written right
group::Producer::finish → cache::finish_largest any fin whole wrong, fixed here
Slot::serves_end/is_walked/cut/is_read/is_expired/is_spent, arrival/ordered walks, holds, landing, peek_*, fill cached, miss.rs (filled, settle, refusals, holes), insert_group_request's kept not aborted, not back-cut whole-group reader right

The is_finished in broadcast.rs, Window::is_settled, and kio::Pending::is_finished belong to other types and are out of scope.

Impact

  • Public API: none.
  • Wire: none.

Alternatives

  • Keep a cached slot that holds only a finished bounded copy past a track abort, so a later fetch of that range still hits the cache. I did not do this. On a live slot it would read as a cut carrying the abort error, and the slot is already reported as dropped.

Follow-ups

  • DropCursor::cut reports a cut that a fetched head covers. It records slot.group.cut_error() for any visible slot. A live group the publisher cut, while a fetched whole head still serves its end, is both handed out by the walk (serves_end) and reported as dropped. It could use Slot::cut(), which is None while a copy serves the end. First confirm what a wire subscriber should see. Not changed here: it is about cuts, not settled versus whole.
  • TrackState::is_settled checks only slot.group. A visible slot whose live group was aborted (cut or evicted), while a fetched head kept serving it, keeps the end unsettled. A later abort then turns the clean end into an error. Decide whether an aborted copy counts as "nothing in flight".

Validation

  • cargo test -p moq-net --all-features --lib: 2627 passed. The new test failed before the fix.
  • just check: pass at 1b2a6566c0 (8962 Rust tests and the rest), after merging main.
  • quest check: pass. The finished quest and its link in quest/m1/README.md are removed.

🤖 Generated with Claude Code

(Written by Claude Opus 5.5)

kixelated and others added 3 commits October 28, 2026 00:02
Quest-Claim: 4161d7a8908df5cc
A copy a transport bound cut short finished only its own range, so it
no longer marks the track's largest group final. Audits every
whole-group versus settled-copy check in the model; the rest already
use the meaning they need.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title Settled copies versus whole groups fix(net): a finished bounded copy leaves the largest group open Oct 28, 2026
@kixelated
kixelated marked this pull request as ready for review October 28, 2026 09:04
@coderabbitai

coderabbitai Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 7 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f29c40d9-f79a-4081-ace8-644d8fcc1fc3
Commits

Reviewing files that changed from the base of the PR and between 8aab135 and 1b2a656.

Files selected for processing: 5
  • quest/m1/README.md
  • quest/m1/settled-copies.md
  • rs/moq-net/src/model/cache.rs
  • rs/moq-net/src/model/group.rs
  • rs/moq-net/src/model/track.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-28T09:05:59.315792Z 1b2a656 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@kixelated kixelated left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review by review (OpenAI)

Reviewed commit: 1b2a6566c0e9908017d2b2ef5fefc840641b0242.

No actionable bugs found in the changed areas. Gating finish_largest on the existing original_fin preserves the distinction between a settled bounded copy and a known group end without adding another state flag. The regression test exercises the premature-largest-stream termination, and the existing recreated/fetched-whole-copy tests cover the complementary completion path. The teardown change is documentation-only; keeping the separate cut/aborted-copy questions out of this focused fix is reasonable.

Verification: static inspection of the diff and surrounding bound, finish, teardown, largest-stream, and test code via GitHub. I did not run tests or independently verify the reported test results.

@kixelated

Copy link
Copy Markdown
Collaborator Author

Merge summary: group::Producer::finish now calls finish_largest only for a copy no transport bound cut short, so a finished bounded fetch copy no longer marks the largest group final. Comments now say "whole copy", and the audit table in the body covers every settled/whole check in rs/moq-net/src/model/. This PR finishes quest/m1/settled-copies.md and removes it.

Review: Codex reviewed head 1b2a656 with no findings, and an automated OpenAI review found nothing actionable. CI is green, and quest check --base origin/main passes. Entering the merge queue at 1b2a656.

Not done here (follow-ups from the body): DropCursor::cut reports a cut that a fetched head covers, and TrackState::is_settled checks only slot.group.

(Written by Claude Opus 5.5)

@kixelated
kixelated added this pull request to the merge queue Oct 28, 2026
Merged via the queue into main with commit d6e175f Oct 28, 2026
12 checks passed
@kixelated
kixelated deleted the quest/m1/settled-copies branch October 28, 2026 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant