Skip to content

feat(net)!: an ordered track's next_group yields groups - #9130

Merged
kixelated merged 4 commits into
mainfrom
quest/m2/outcome-enums/ordered-gaps
Nov 20, 2026
Merged

kixelated merged 4 commits into
mainfrom
quest/m2/outcome-enums/ordered-gaps

Conversation

@kixelated

@kixelated kixelated commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Finishes quest/m2/outcome-enums/ordered-gaps.md.

Problem

track::Ordered::next_group returned track::Item, and every production caller (libmoq, moq-ffi, moq-json snapshot and window, moq-hls, moq-mux TS export and MSF catalog, moq-archive, moq-stats, moq-net benches) wrote the same Item::Gap => continue arm. Tests that wrote .and_then(Item::group) treated a gap as the end of the track.

Approach

  • Ordered::next_group / poll_next_group return group::Consumer and pass over gaps.
  • The old behavior moves to Ordered::next_item / poll_next_item, still returning Item for a reader that needs each gap's range in order.
  • Item::group is gone: nothing needs it once callers read groups directly.
  • Every caller that only skipped gaps now calls next_group; tests that check gaps call next_item. moq-ffi's private poll_group helper is inlined away.
  • New unit test next_group_passes_the_gaps_next_item_reports checks both readers on one track with leading, middle, and trailing gaps.
  • quest/m2/unused-api/net.md now says the container reader uses next_item. It still reads in arrival order on main, so that quest makes the switch.

Already on main: the JS side (moq-dev/moq#9068) has Ordered.nextGroup and nextItem. The Rust names now match it. Nothing on main had started the Rust change.

Impact

  • moq-net (breaking): track::Ordered::next_group / poll_next_group now return Result<Option<group::Consumer>> and pass over gaps. Migration: drop the Item::Group(group) / Item::Gap { .. } => continue match and use the group directly. A reader that needs gaps calls next_item / poll_next_item, which return Item exactly as next_group did before.
  • moq-net (breaking): track::Item::group removed. Migration: call next_group instead of next_item().and_then(Item::group). Note that a gap no longer reads as None.
  • No JS, moq-ffi, or binding API change (the bindings already hid gaps). Wire: none.

Alternatives

Decided in the quest's plan (maintainer, 2026-11-18): two methods, rejecting Item as the only return and a gap counter.

Decisions

Taken while the maintainer was away. A later review can undo each one:

  • Kept the existing doc text on poll_next_item (range, end, and abort semantics). poll_next_group points to it instead of repeating it.
  • Tests that asserted "a group, not a gap" with .group().expect(..) moved to next_group. Each still asserts the group's start, so a skipped gap would fail on the key. Tests that read gaps on purpose moved to next_item.
  • moq-archive's ordered read keeps its "a group the track gave up on is stored as the hole it leaves" behavior. It just no longer loops over Gap itself.
  • Merging main (2026-11-19): moq-transcode's drop_gap conflict keeps main's logic (sequence, Some(group.start)) and reads it through the gap-free next_group. Main's new live-rung test in moq-transcode/src/lib.rs looped over next_group().group() to skip gaps; it now takes next_group() directly. moq-dev/moq#9196 still calls next_group for gap-aware reads; whichever of the two lands second renames those calls to next_item.

Validation

  • After merging main: cargo check --workspace --all-targets --all-features and just check pass.
  • just check and just ci pass locally (clippy and tests for every changed crate and its dependents, plus bindings).
  • just test interop --all: all checks pass, including the drop moq-lite-0{5,6,7-wip} cases, where the Rust ordered reader skips a cut group to a clean end over a real relay, and hls grid, which uses the reworked test/interop/clients/rust/hls.rs.
  • New unit test: on one track, next_item gives gap 0..2, group 2, gap 3..4, group 4, gap 5..7 and next_group gives [2, 4], both ending at the same point.

Follow-ups

None.

Models

Size: S
Implementer: Claude Code, claude-opus-5-5, high effort
Implementer: Claude Code, claude-opus-5-5, high effort (iterate: merge main)

🤖 Generated with Claude Code

(Written by Claude Opus 5.5 with high)

Review

Rewritten by quest review after each round.

  • Head: 6d2705b

  • Base: origin/main at 4d9190a

  • Risk: high, Changing Ordered::next_group and poll_next_group to return groups instead of Item and removing Item::group breaks the public Rust API for downstream consumers, requiring caller migrations or a revert.

  • Classified: high by Codex, gpt-6.1-sol, low effort, session 01a1f721-e9b0-75d2-99ae-7eff5afc17f1

  • Reviewer: Codex, gpt-6.1-sol, medium effort

  • Session: 01a1f721-f96f-7b93-b9b2-29b0053f6135, round 1

  • Score: 9/10, The group-only wrapper preserves gap-skipping behavior and gap-aware readers retain next_item, with no actionable regressions found in source review; builds and tests were not run as instructed.

  • Rounds: 2; first round 0; findings 0: fixed 0, refuted 0, open 0

  • Findings: none

kixelated and others added 3 commits November 18, 2026 15:52
…elds gaps too

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title An ordered track's next_group yields groups feat(net)!: an ordered track's next_group yields groups Nov 19, 2026
@kixelated
kixelated marked this pull request as ready for review November 19, 2026 00:45
@coderabbitai

coderabbitai Bot commented Nov 19, 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 1 minute.

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: ed454252-929a-4340-90f4-f24494fe57d8
Commits

Reviewing files that changed from the base of the PR and between 1a34abe and 6d2705b.

Files selected for processing: 40

  • quest/m2/outcome-enums/ordered-gaps.md
  • quest/m2/unused-api/net.md
  • rs/libmoq/src/consume.rs
  • rs/moq-archive/src/consumer/tests.rs
  • rs/moq-archive/src/producer/track.rs
  • rs/moq-bench/src/connection.rs
  • rs/moq-cli/src/main.rs
  • rs/moq-ffi/src/consumer.rs
  • rs/moq-ffi/src/media.rs
  • rs/moq-gst/src/sink/imp.rs
  • rs/moq-gst/src/sink/pad.rs
  • rs/moq-hls/src/export/rendition.rs
  • rs/moq-hls/src/import.rs
  • rs/moq-hls/tests/integration/import.rs
  • rs/moq-json/examples/telemetry.rs
  • rs/moq-json/src/snapshot/consumer.rs
  • rs/moq-json/src/snapshot/mod.rs
  • rs/moq-json/src/window/consumer.rs
  • rs/moq-json/src/window/mod.rs
  • rs/moq-mux/src/catalog/msf/consumer.rs
  • rs/moq-mux/src/catalog/producer.rs
  • rs/moq-mux/src/container/fmp4/import_test.rs
  • rs/moq-mux/src/container/fmp4/muxer.rs
  • rs/moq-mux/src/container/ts/export.rs
  • rs/moq-mux/src/container/ts/si.rs
  • rs/moq-net/benches/group.rs
  • rs/moq-net/benches/origin.rs
  • rs/moq-net/src/ietf/subscriber.rs
  • rs/moq-net/src/lite/subscriber/fills.rs
  • rs/moq-net/src/model/resume.rs
  • rs/moq-net/src/model/resume_model.rs
  • rs/moq-net/src/model/track.rs
  • rs/moq-net/tests/integration/drop_record.rs
  • rs/moq-net/tests/integration/settled_end_survives_abort.rs
  • rs/moq-relay/tests/integration/quic_sim.rs
  • rs/moq-rtmp/src/dial.rs
  • rs/moq-stats/src/produce.rs
  • rs/moq-transcode/src/lib.rs
  • rs/moq-transcode/src/rung.rs
  • test/interop/clients/rust/hls.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

pullfrog[bot]
pullfrog Bot previously approved these changes Nov 19, 2026

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Approach: sound. Moving the gap skip into Ordered::poll_next_group removes a Gap => continue arm that a dozen callers each repeated, and poll_next_item keeps gap ranges for the one reader that needs them. The names now match js/net's nextGroup / nextItem.

Reviewed changes

This review covers the whole PR: the Ordered API split and the callers and tests moved onto it.

  • Ordered split — the old poll_next_group is now poll_next_item (unchanged), and the new poll_next_group loops over it, passing gaps. Each gap moves the cursor forward, so the loop is bounded and costs the same as the caller loops it replaces.
  • Item::group removed — no callers remain. Its doc comments now point at poll_next_item.
  • Production callers — libmoq, moq-ffi (its private poll_group is inlined), moq-json snapshot and window, moq-hls rendition export, moq-mux's MSF catalog and TS SI export, moq-archive's producer track, and moq-net's origin bench all call poll_next_group directly. They behave the same as before.
  • Tests — tests that check gaps now call next_item / poll_next_item, and the rest drop the .group().unwrap() unwrapping. A new test, next_group_passes_the_gaps_next_item_reports, checks both readers on one track with leading, middle, and trailing gaps.
  • Quest docs — the finished ordered-gaps quest is deleted, and unused-api/net now points at next_item.

Pullfrog  | View workflow run | Using claude-opus-5-5 | 𝕏

@kixelated

Copy link
Copy Markdown
Collaborator Author

Merge pick (maintainer away, granted the coordinator merges it confidently recommends): ✅ /quest-merge, accepting the decisions listed in the PR body.

(Written by Claude Opus 5.5 with high)

@kixelated
kixelated added this pull request to the merge queue Nov 19, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 19, 2026
@moq-bot

moq-bot Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

quest land watch: the merge queue removed this pull request at dfb38f8 because it conflicts with main (merge_conflict).

The land fixer works on it in the background, and the watcher re-enqueues it at the back of the queue once it is fixed or judged flaky, or hands it back here with what it needs.

(written by quest land watch)

@moq-bot

moq-bot Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

codex, gpt-6.1-sol, medium effort land fixer note:

The landing log, lines 3–6, reports:

Auto-merging rs/moq-transcode/src/lib.rs
Auto-merging rs/moq-transcode/src/rung.rs
CONFLICT (content): Merge conflict in rs/moq-transcode/src/rung.rs
Automatic merge failed; fix conflicts and then commit the result.

Merged base while preserving its source group keys and the PR's direct ordered group reads. Adapted a test added on base to the same API. The mechanical fixes are retained at 2ee4e62c06dec25f38b05cab7c9125bcee24a79c on pr-9130. No protected paths were edited.

Ran nix develop --command just ci base. Rust lint, formatting, docs, metadata and downstream checks passed, but the test build exposed the stale caller, now fixed. nix develop --command just rs test -p moq-transcode subsequently passed all 91 tests.

The full gate also failed in the unchanged JavaScript test a widened range's SUBSCRIBE_STARTED resolves the feed's start at js/net/src/lite/subscriber.test.ts:2868: Expected: "pending", Received: 0n. Ran bun test ./js/net/src/lite/subscriber.test.ts --test-name-pattern "a widened range's SUBSCRIBE_STARTED resolves the feed's start" in each tree's Nix dev shell on the merged branch and on base alone; both fail identically. Resolving that existing assertion or behavior needs review outside this mechanical fix. The complete Rust suite still needs rerunning after the caller adaptation, together with the full gate after the base failure is resolved.

(written by codex, gpt-6.1-sol, medium effort)

@moq-bot

moq-bot Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

codex, gpt-6.1-sol, medium effort land fixer: Re·solved the merge conflict mechanically, but nix develop --command just ci base fails in [at]moq/net: a widened range's SUBSCRIBE_STARTED re·solves the feed's start: Expected: "pending"; Received: 0n; th. Recommendation: Fi·x the existing base JavaScript assertion or behavior with maintainer review, retain the mechanical fi·xes at pr-9130 tip 2ee4e62c06dec25f38b05cab7c9125bcee24a79c, then rerun nix develop --command jus

Auto-merging rs/moq-transcode/src/lib.rs
Auto-merging rs/moq-transcode/src/rung.rs
CONFLICT (content): Merge conflict in rs/moq-transcode/src/rung.rs
Automatic merge failed; fix conflicts and then commit the result.

(written by codex, gpt-6.1-sol, medium effort)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found. The merge of main resolves its conflict correctly.

Reviewed changes

Since the last review, the only new commit merges origin/main. I checked the conflict resolution and the new main code that calls the changed API.

  • drop_gap conflict in moq-transcode/src/rung.rs: the resolution keeps main's comparison (group.start >= sequence, returning Some(group.start)). It reads through the gap-free next_group instead of matching track::Item::Group, so it behaves the same as main.
  • Main's new live-rung test in moq-transcode/src/lib.rs: the test used to loop over next_group().group() to skip gaps. It now takes next_group() directly, which also skips gaps, so the test checks the same thing.
  • No stale callers: nothing in rs/ still calls .group() on an ordered read or matches track::Item on a next_group result. The Item::* arms in rung.rs and feed.rs use transcode's own local enum.

Pullfrog  | View workflow run | Using claude-opus-5-5 | 𝕏

@kixelated
kixelated added this pull request to the merge queue Nov 20, 2026
Merged via the queue into main with commit 8a20d9c Nov 20, 2026
8 checks passed
@kixelated
kixelated deleted the quest/m2/outcome-enums/ordered-gaps branch November 20, 2026 04:28
kixelated added a commit that referenced this pull request Nov 20, 2026
#9202, #9217 and #9130 change no covered behavior the model represents:
announce scope, subscriber scalars the first sync mirrors, and ordered reads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kixelated added a commit that referenced this pull request Nov 20, 2026
Resolves js/net/src/ordered.test.ts (keeps both the time-start and #9227's
time-end tests) and moves this PR's item-matching tests to next_item after #9130.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant