Repository navigation
Conversation
A failure that belongs to one group is that group's error: readers of a track read on past it, and a track read's error means only that the track ended. libmoq's raw and metadata reads become typed (frame or gap). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tocol error Also recover from a failed group while the JS snapshot reader drains its backlog, and correct the gap docs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kixelated
marked this pull request as ready for review
November 28, 2026 10:27
Contributor
|
Warning Review limit reachedYou'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 4 minutes. View limit details
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. |
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.
Supersedes moq-dev/moq#9808. Finishes and deletes
quest/m2/typed-superseded-group-end.md, whose goal it rewrites to the maintainer's rule: a failure that belongs to one group is that group's error, and the subscription and track read on. A track read'sErrmeans only "the track ended"; a failed group is a gap the reader continues past. No reader matches on error variants.Problem
Readers ended a whole track on one group's failure unless the error matched an allowlist. libmoq's C raw reader and moq-ffi's ordered
read_framepassed onlyOld, so over moq-transport, where a group an on-demand producer's drop left open arrives as a cancelled stream that recovers toNotFound, the C raw reader ended the track with-2instead of reading on (reproduced byraw_track_reads_past_a_group_a_drop_left_open). JSOrdered.readFramerethrewTooFarBehind,GroupTooLarge, andEvicted, and the moq-json snapshot and window consumers (Rust and JS) ended on anything outside theirGAPSallowlists. Every one of these matched on error variants, which AGENTS.md forbids.Approach
moq-net: already reads this way (Item::Gap, andpoll_next_grouppasses gaps). The rule is now written ongroup::Consumerand indoc/lib/rs/moq-net.md.@moq/net:Ordered.readFramepasses any failed group and resyncs from the next; only the track's own error throws. Callers who need the reason usenextItem()and the group'sreadFrame(). Rule added todoc/lib/js/net.md.MoqTrackConsumer.read_framepasses any failed group without matching. The Python, Kotlin, Swift, and Go wrappers forward that call unchanged, so none ends a stream on a group failure; their docs say so. Dart uses the generated binding directly.moq_media_read:moq_raw_read { kind: FRAME|GAP, frame, gap: { start, end, code, reason, protocol, has_protocol } }.run_rawreads withpoll_next_item, so a skipped group and a group that failed partway both arrive asMOQ_RAW_READ_GAP;codeis the failure's negative libmoq codereasonstays valid until the read is freed, andprotocolcarries the stream reset or session close behind it, asmoq_error_protocolreports one. The metadata callback gets amoq_meta_readthe same way, with a gap for a group that failed partway. A callback<= 0stays terminal and means only that the track ended.GAPSallowlists are gone.publish.rstest: any group error is "move on".superseded_group.rsasrs/moq-net/tests/integration/failed_group.rs(a group a drop left open, and one its publisher aborted, both read past on moq-lite-03/06/07-wip and moq-transport-18/22/23) and libmoq'sraw_track_reads_past_a_group_a_drop_left_open(now expecting a gap, then the next producer's frame, on moq-lite-06 and moq-transport-22).Impact
moq_consume_track_frame(frame, moq_frame *)andmoq_consume_track_frame_freeare replaced bymoq_consume_track_read(read, moq_raw_read *)andmoq_consume_track_read_free.moq_raw_read,moq_raw_read_kind(MOQ_RAW_READ_FRAME,MOQ_RAW_READ_GAP), andmoq_raw_gap.moq_consume_metatakes amoq_meta_callback(void *user_data, const moq_meta_read *read, int32_t code)in place ofmoq_header_callback, andmoq_meta_readwraps themoq_header.moq_consume_track_read, branch onkind, read the payload fromread.frame(same fields as before), and treatMOQ_RAW_READ_GAPas groups[gap.start, gap.end)lost, withgap.code,gap.reason, and (whengap.has_protocol)gap.protocolsaying why; then keep reading. Free withmoq_consume_track_read_free. For metadata, takeread->headerwhereheaderwas, and handleMOQ_RAW_READ_GAP. A terminal callback (<= 0) still ends the track. Recompile against the regeneratedmoq.h.MoqTrackConsumer.read_frame(and every wrapper over it), JSOrdered.readFrame, and the moq-json snapshot and window consumers read past a group that failed for any reason, a publisher's group abort included, where they used to end the track with that error.superseded()API.Decisions
Taken while the maintainer was away, each with the option I recommended:
run_metaswitch topoll_next_item, but a metadata subscription has no ordered reader in moq-net (meta::Subscriberoffers onlyrecv_group, in Rust and JS). It now reports a group that failed partway as a gap and reads on; groups it never received are not reported, as arrival order never did.meta::Subscriber::ordered()and its item type to moq-net in Rust and JS. New public API in two languages, and a change from arrival to key order for every C metadata reader, for skipped-group reports no caller asked for.test/stream-creditkeeps itsOldcheck. The brief had it treat any group error as "move on", but the harness exists to check that a group the relay reset to make room (TOO_FAR_BEHIND) comes back whole when fetched. Skipping every errored group drops that check (the driver then fails "no group stopped early"), and fetching every one adds a fetch per stale live-edge group, thousands per run. It asserts the relay's wire behavior rather than reading a track, so it stays as it is.quest/m3/error-matches.md.Alternatives
Error::superseded()and remap moq-transportDELIVERY_TIMEOUTto carry it. Superseded by the maintainer's rule: a group's failure stays with that group, so no reader needs to tell kinds apart and no wire code changes.Caused by
Error::Old | StreamError::Old, which a moq-transport reader never sees, so the C raw reader ended the track there (found by person).Follow-ups
quest/m3/error-matches.md(edited): moq-hls's export (unservable, 404 versus 500) and moq-relay's HTTP fetch (web.rs) still tell a single-group miss from a failure by matchingNotFound,Old, andEvicted. Left as they are per the brief; the quest now lists them, and drops the libmoq and moq-ffiOldmatches this PR removed.Validation
origin/main:raw_track_reads_past_a_group_a_drop_left_open: moq-transport-22 ended the track with-2.a read skips a group whose front was shed, as it does any failed group: threwEvicted.snapshot consumer reads past any failed group and ends only with the trackandconsumer resumes at a checkpoint after losing a group(now withInternaland a plainError): both rethrew.a_lost_group_waits_for_its_replacement(now withApp(7)) andconsumer_resumes_at_a_checkpoint_after_losing_a_group(now withInternalandApp(7)): both failed.track_read_frame_passes_an_aborted_group:read_framereturned the abort. It replacesraw_read_frame_drops_aborted_pending_group, which asserted the old behavior.raw_track_reads_past_an_aborted_groupandmeta_reads_past_an_aborted_groupreplaceraw_track_ends_on_an_aborted_group, which asserted the old behavior.rs/moq-net/tests/integration/failed_group.rspasses onorigin/maintoo: moq-net already reads this way, so it guards the rule rather than reproducing a bug.quest gate just check: passed.quest gate just ci: passed.quest gate just test interop --all: all checks passed, including the C client over libmoq.just rs c-tests: the C fixtures (on-demand-free.c,timestamps.c) pass against the new header.Models
Size: M
Implementer: Claude Code, claude-opus-5-5, unknown (arm A)
🤖 Generated with Claude Code
(Written by Claude Opus 5.5)
Review
Rewritten by
quest reviewafter each round.Head: 964b6b5
Base: origin/main at e1dd5f6
Risk: high,
It breaks published consumers: libmoq's C API removes `moq_consume_track_frame` and `moq_consume_track_frame_free` in favor of `moq_consume_track_read` and `moq_consume_track_read_free`, changes the `moq_consume_track` and `moq_consume_meta` callback types, and the CHANGELOG marks it Breaking. A failed group that used to end a track now reads on, a behavior change for Rust, JS, Python, Go, Swift, and Kotlin readers. Reverting is a code revert, but a C caller built against the new header, or a release that ships it, is already affected.Classified: high by Claude Code, claude-haiku-5-5, low effort, session
ec74125a-6b32-470d-b14d-ac2f28c303fbRisk file: bb7b1c0de60b
Reviewer: Codex, gpt-6.2-sol, high effort
Session:
01a2218f-6a19-7ef3-bf59-dac03bcb97a3, round 3Score: 10/10,
The failure handlers now release their group handles before advancing, and the new changes introduce no findings.Rounds: 3; first round 3 (high 1, medium 2); findings 4 (high 1, medium 3): fixed 4, refuted 0, open 0
Findings: none
The last round's findings, at 8ff718a:
js/json/src/snapshot/consumer.ts:148:Close the failed group before discarding its handle;Both snapshot failure handlers (`js/json/src/snapshot/consumer.ts:128` and `:149`) and the window failure handler (`js/json/src/window/consumer.ts:73`) close the failed group before clearing its handle.Reviewer: Claude Code, claude-opus-5-5, high effort, second
Session:
362a8e5b-08eb-49a1-82b9-07c6855cc4a2, round 3Score: 9/10,
The only change since the last round has the JSON snapshot and window consumers close a failed group's reader before moving on to the next group. `close()` just releases that reader and doesn't touch the producer, so the change frees resources and adds no new bug, and no findings are open.Rounds: 3; first round 0; findings 0: fixed 0, refuted 0, open 0
Findings: none