Repository navigation
feat(net)!: lite-07 has no relative anchors, and Min Age places a live join - #9265
Conversation
Quest-Claim: 42d0fa22c60ce552
…e join The Relative anchor leaves the lite-07 wire, moq-net, @moq/net, moq-ffi, libmoq, and every binding. A range's start and end are times. A range with no start and a stated Min Age joins at the group containing the live edge minus the Min Age; with none it reaches back as Max Age allows. A relay copy that can't prove that group re-adds the range upstream under the larger Min Age and waits, so a join gets the same groups through a relay as from the origin. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ATION Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ld group, and after idling - An idle copy reopened for a live join keeps its no-start range, so the publisher places the join behind its own live edge. - A copy places a join inside a held group whose frames reach past the join's time, as JS already did. - A join answered empty starts past its range's end on the copy, so a bounded join ends as it does at the origin (Rust and JS). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An idle copy's cache measures no live edge: a join placed from it read the stale groups, then a hole the next feed never filled, which the full interop matrix showed as an audio gap once the reopen kept the join. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A copy recorded an empty answer as the group past the range's end and started every reader's join covered by it there, so an unbounded reader joining later read groups older than its join. Join::Past now settles only a range ending before it, and any other waits for an answer (Rust and JS). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two bounded wire ranges with the same Min Age answer apart, one with a group and one empty. The copy kept answers by Min Age alone, so the empty one could replace the real one and a third reader reaching past it waited forever. Answers now merge per Min Age: the earliest group wins, otherwise the furthest empty bound, and the oldest range's start beats an empty answer (Rust and JS). Per-reader join asks move to quest/m1/time-start-asks-upstream.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Important
libmoq's raw track consumer stops joining live once a caller widens delay.max. The zero Min Age it forces arrives as an update that changes nothing that's already placed. I reproduced this locally. There is also a traced (not run) relay case where a stated-Min-Age join can wait indefinitely. Both are inline.
Approach: Sound. Swapping the counted anchor for a Min Age that resolves like a time start, and having a copy ask upstream for anything it can't prove, fixes the sparse-copy divergence at its cause instead of patching each hop's count.
Reviewed changes. I reviewed the full diff at 79c22c5: the Rust model, lite and ietf sessions, and bindings directly, and the JS side through a separate parity pass against Rust.
- Wire (lite-07-wip):
RelativeandGroups Backare gone and Position is renumbered to 0x2. 0x3 and above are PROTOCOL_VIOLATION.origin/releaseleaves Lite07 out of its default versions, so the previous-release relays aren't affected. track::Range: now{ start: Option<u64>, end: Option<u64> }.Delay::default().minis unstated. A range with no start is a live join when a Min Age is stated, and otherwise reaches back as far as max allows.- Window placement:
Holdings::joinreturnsJoin::{Time, Group, Past, Unknown}. AWirecopy places a join only from groups it holds or from upstream answers (feed_start,join_starts), and otherwise waits inreaching. - Aggregate Min Age: only subscribers holding a no-start range count, and an unstated one counts as the largest and hides the rest of the union. This is applied in
demand.rs,demand/ranges.rs,Combined, and JSdemand.ts/ranges.ts. - Relay rejoin:
SubStream::edit(.., rejoin)retires and re-adds no-start ranges when the aggregate Min Age grows.minsreplacesedges, andreport_startsfeedsjoin_starts. - moq-transport:
Relative0 and 1 still map to a live join. Anything larger is refused with NOT_SUPPORTED across subscribe, joining FETCH, update, and fill. - Bindings:
MoqAnchor/moq_anchorare removed andmoq_rangetakes optional times.min_unstatedbecomesmin_statedat the same offset. GoDelay.Minbecomes a pointer. The Python, Swift, Kotlin, and Dart aliases are updated.
ℹ️ The Python and Dart docs still describe a zero default min
doc/lib/py/index.md:135 and doc/lib/dart/index.md:170 still say "whose zero delay…" and "Delay defaults both bounds to zero". This PR changed Delay() to min=None in Python and min: null in Dart. Kotlin, Swift, C++ (doc/lib/cpp/index.md, Subscription defaults), and doc/lib/js/net.md:63 ("An omitted delay field means the same zero") need the same pass.
Technical details
# Binding docs still describe Delay.min defaulting to zero
## Affected sites
- doc/lib/py/index.md:135 — "whose zero `delay` starts at the newest group"; "`min=None` to leave the target latency unstated" (it is now the default)
- doc/lib/dart/index.md:170 — "`Delay` defaults both bounds to zero"
- doc/lib/kt/index.md:120, doc/lib/swift/index.md:118 — "whose zero `delay`"
- doc/lib/cpp/index.md (## Subscription defaults) — "a zero `delay` that starts at the newest group"
- doc/lib/js/net.md:63 — "An omitted `delay` field means the same zero"
## Required outcome
- Each binding's "Subscription defaults" bullet says the default states no `min` and a zero `max`, and that a stated `min` (zero included) makes a range with no start a live join, matching doc/lib/go/index.md and doc/lib/c/index.md.ℹ️ Rust and JS relays differ in two places the PR body doesn't mention
The PR body names one known divergence, how a covering answer is chosen across Min Ages. A parity pass found two more relay behaviors that differ. Neither loses data, but they send different wire traffic.
The first is the rejoin trigger. Rust compares the old aggregate with the new one and re-adds every no-start range. JS keeps the Min Age each range was added under and re-adds only the ones placed under a smaller Min Age. With an aggregate going 10s → 5s → 10s, Rust retires and re-adds the range and JS doesn't.
The second is the union. With a stated aggregate Min Age, Rust sends [{end: 5}, {}] upstream and JS sends [{}]. The two also report "union changed" differently.
Technical details
# Rust/JS relay divergences beyond the cross-Min-Age covering choice
## Affected sites
- rs/moq-net/src/lite/subscriber.rs:10947-10951 (rejoin from `active.min_delay` vs aggregate) and `SubStream::edit` `stale` set (retires every non-fill no-start range)
- js/net/src/lite/subscriber.ts (`entry.joins`, renews only `age === undefined || age > added`)
- rs/moq-net/src/model/track/demand/ranges.rs:132-135 `fold` (`bounded` kept beside an open range) and `add`/`remove` Bounded arms returning `!hidden`
- js/net/src/ranges.ts `#fold` (drops bounded no-start ranges when an open one is held) and its add/remove change flags
- (minor) js/net/src/ietf/publisher.ts `fillRange`: no `countsBack` guard, so a fill's own `Relative(n>1)` at `largest.group == 0` saturates to group 0 and is served; Rust `fill_range` returns `FillServe::Unsupported`
## Required outcome
- Both languages send the same upstream ranges and the same rejoin edits for the same reader set, or the divergence is recorded alongside the one already tracked in quest/m2/time-addressing/range-table.md.claude-opus-5-5 | 𝕏
#9294's resume tests move to the Range without anchors: the Relative(3) edit becomes a live join with a 6 ms Min Age, and the two Oldest-end refusal tests go, since a range end can no longer be Oldest. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…reader subscribes live An idle copy reopened its upstream from just the newest group it kept whenever the aggregate Min Age was unstated, which one unstated reader makes it even while another states a join: that join then waited on an answer nobody asked for. The copy now asks the track whether any reader with no start states a Min Age. libmoq's raw consumer subscribed with the caller's preferences and forced the zero Min Age in a later update, which places no range that already resolved, so a reader with an unlimited max read from the oldest group. It now subscribes with them, and the C docs say a range with no start joins at the newest group. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lready delivers A copy's demand mixing a live join with a range that has a start widened the single wire span to group zero, so a reader adding a range at or after the joined group sent an Unfiltered update asking the publisher for every group from the oldest. Before relative anchors went, the live join resolved to the joined group and nothing changed. That update raced the run's end in moq-ffi's server_client_run_end, failing about one run in ten with a protocol violation or a lost next run. The copy now keeps the live join while it holds every start. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
✅ No new issues found. Each finding from the last review is fixed and covered by a regression test.
Reviewed changes
This pass covers the commits since 79c22c5.
- libmoq raw reader subscribes live from the start:
raw_tracknow subscribes withraw_subscription(..)up front.update_rawnow runs only for an update that arrived while the subscribe was pending.raw_track_joins_the_latest_group_without_a_stated_minchecks that the reader reads the latest group whenmax_unlimitedis set. - Idle re-ask respects a stated join:
wire_requestskips thewith_start(newest)re-ask whenever any no-start subscriber states a Min Age. It reads this fromProducer::joins_stated(Subscriptions::min_delay) rather than from the aggregate minimum. The new integration testa_join_on_an_idle_copy_opened_with_an_unstated_reader_reaches_backcovers the mixed-reader case on a quiet track. - moq-transport live join keeps its bounds:
Established::joinedrecords the SUBSCRIBE_OK Largest group for a start-less live plan.wire_boundssends no widening update when every added range starts at or after that group under a stated Min Age. Otherwise it still widens to group 0. - C docs:
doc/lib/c/index.mdand themin_stateddoc inapi.rsnow agree that a range with no start joins at the newest group, and that a time start reaches back.
claude-opus-5-5 | 𝕏
#9293's moq-transport live join moves to a range with no start and a zero Min Age, in Rust and JS. Its oldest ask on an empty track starts at time zero, since a range resolves once and an equal range would leave the live join where it resolved. The watch decoder keeps its explicit no-start range, and #9293's tests use Range::default(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ing/no-relative-anchors # Conflicts: # rs/moq-net/src/model/track.rs
There was a problem hiding this comment.
✅ No new issues found. The two merges from
maincarry the new features over to Min Age live joins correctly.
Reviewed changes
This pass covers cdb36d7..903ea46. That range is two merges of origin/main (#9293, #9298, #9259, #9299) plus the conflict resolutions needed to move what they added onto the no-relative-anchor model.
- moq-transport serve request:
ServeRange::requestand JSserveRequestnow ask for a live join asRange::default()with a zero Min Age, in place ofRange::live(). A request that is not live asks from an explicit start, or from group 0 when it has none, so a range that replaces a live join gets resolved again. Rust leaves the earlierdelay.minin place while JS clears it. Only ranges with no start count toward the aggregate Min Age, so that difference has no effect. - Watch media join (#9293):
js/watch/src/media.tsnow joins with[{}]. Every caller (the video and audio decoders and the text renderer) passes a statedminDuration, so the subscription is still a live join. - Answered largest before going live (#9298):
set_live/set_live_aheadtake the newfinishedargument, and the doc comments now speak of live joins where they used to say relative starts. The tests were updated to match. - Idle re-ask: only the comment in
lite/subscriber.rswas merged. Thejoins_statedguard from the previous pass is unchanged, anda_live_join_reopening_an_idle_copy_stays_a_live_joinnow asserts a range with no start plus a zero Min Age. - Tests:
min_age_join.rsandsubscribe_ranges.rsnow useRange::default()withwith_min(Duration::ZERO). Outside the IETF filter layer, nothing still refers toRange::live,Range::oldest, orrelative:.
claude-opus-5-5 | 𝕏
#9265 replaced range anchors with a plain time. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main dropped relative anchors (#9265), so a raised start's relative end, its raised_ends lookup and the JS servingWaiting hook go: a time end is placed from the range itself. Tests move to Option<u64> times. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Summary
lite-07's Relative anchor is gone from the wire,
moq-net,@moq/net, moq-ffi, libmoq, and every binding. A live join is now a range with no start plus a stated Min Age (Delay::min). The serving hop starts it at the group containing its live edge minus the Min Age, resolved as a time start there. A relay copy that can't prove that group from its cache asks upstream and waits for the answer: it retires its no-start range and adds it again under the larger Min Age. A join then gets the same groups through a relay as from the origin.Completes
quest/m2/time-addressing/no-relative-anchors.md, which owns the "sparse copies deliver different groups" problem #9258 names. A count of groups back resolved against whatever a hop held: with groups 0 to 9 at the origin, a copy holding only 2 and 9 counted one back to 2 while the origin counted to 8.Impact
API and wire, breaking.
Wire (lite-07-wip, unpublished)
Groups Backare gone. Any other type, 0x3 included, is a PROTOCOL_VIOLATION.Startof None with a statedSubscriber Min Ageis a live join at the group containing the live edge minus the Min Age. With no stated Min Age it reaches back as far as Max Age allows.Filter::Relativeof 0 or 1 still maps to a live join. A larger count is refused with NOT_SUPPORTED, whether it comes in a relative start filter, a relative joining FETCH, an update, or a fill.Migration
Rust
moq_net::track:Anchoris deleted.Range { start: Option<u64>, end: Option<u64> }takes times directly, soRange { start: Anchor::Time(t), end: Some(Anchor::Time(e)) }becomesRange { start: Some(t), end: Some(e) }.Anchor::OldestbecomesNone.Range::live()andRange::oldest()are deleted. ReplaceRange::oldest()withRange::default()and no Min Age. ReplaceRange::live()withRange::default()plusDelay::with_min(Duration::ZERO), or your playout delay.Delay::default().minisNone(wasSome(0)). A subscription that states no Min Age reaches back as far as Max Age allows instead of joining live.@moq/net:Track.AnchorandLIVEare deleted, andRangeis{ start?: bigint; end?: bigint }in times ({ time: t }becomest). The default subscription'sdelay.minis unstated (was zero); setdelay.minto join live.moq-ffi (
MoqRange,MoqSubscription):MoqAnchoris removed, andMoqRangeis{ start: Option<MoqTimestamp>, end: Option<MoqTimestamp> }, unscaled times in the track's timescale.MoqAnchor::Time { timestamp }with the timestamp. ReplaceRelative { groups: 0 }withstart: Noneanddelay.min: Some(0), andOldestwithstart: Noneanddelay.min: None.moq_subscription_defaults()leavesdelay.minnull.libmoq (C, ABI change):
moq_anchor,moq_anchor_kind, andMOQ_ANCHOR_*are removed.moq_rangeis{ moq_timestamp start; bool start_present; moq_timestamp end; bool end_present; }. A zeroed range has no start and follows the live edge.moq_delay.min_unstatedbecomesmin_statedat the same offset, so a zeroedmoq_delayleaves the minimum unstated. Setmin_statedwherever you setmin_us.Wrappers:
Anchor*types are gone andRangeis{Start, End *Timestamp}.Delay.Minis a*time.Duration, nil when unstated, andDelay.MinUnstatedis removed. WriteMin: &dwhere you wroteMin: d.Anchoris gone,Range(start=None, end=None)takesTimestamp.unscaledtimes, andDelay()defaultsmin=None.Anchoris gone,Rangetakes optional unscaled timestamps, and the default delay'sminis null.moq::Range) and the Cmoqpackage follow moq-ffi.Media consumers (moq-audio, moq-video, moq-mux, libmoq, moq-ffi) start an unstated minimum at zero, as before.
Start::Oldestnow subscribes with no Min Age so it still reaches back. A warmup widens only a stated Min Age.Decisions
An unstated Min Age with no start means oldest, and a stated zero means the latest group, as the quest recorded.
A relay's join waits on upstream only when it can't prove the group. It answers from the copy for a time it can place between held groups, or for a time before the start its own subscription was answered with.
When the aggregate Min Age grows, the copy retires and re-adds its no-start demand range, since a range resolves once. A range already resolved is pinned to the group it started at, so it stops counting toward the forwarded Min Age.
The copy's live edge is the newest of its newest frame, its newest held group start, and the upstream's answered Largest Group, so a copy that has only just subscribed doesn't measure a stale edge.
moq-transport
Filter::Relative(1), the current group, is still served as a live join; only counts of 2 or more are refused.A live join made before any group is placed when the hop first resolves it, against what it holds then, as
Relative(0)was.A copy places a join inside a held group whose frames reach past the join's time (groups never overlap), as JS already did.
An idle copy reopened for a live join keeps its no-start range, so the publisher places the join. Until the feed answers, the copy places no join from what the ended feed left.
An empty answer for a bounded join is kept as
Join::Past(end + 1). It settles only a reader's range that ends before that key as empty; any other waits for an answer.A copy merges the answers of ranges with the same Min Age: the earliest group wins, otherwise the furthest empty bound, and the start of a range reaching back to the oldest group beats an empty answer, so an empty answer for one bounded reader never hides a real one from another (Rust and JS).
An idle copy reopens from just its newest group only when no subscriber with no start states a Min Age. The aggregate Min Age can't say so: one unstated reader hides another's stated join, which then waited on an answer nobody asked for.
libmoq's raw consumer subscribes with its forced zero Min Age from the start; an update stating only the minimum places no range that already resolved. The C docs now say a range with no start joins at the newest group, and a time start reaches back.
A moq-transport copy keeps its live join while every other range starts at or after the group it joined, instead of widening the single wire span to group zero. That Unfiltered update, new in this PR, raced the run's end in moq-ffi's
server_client_run_endand failed about one run in ten.Main's test(moq-net): kill or exclude 26 of the resume and relay route mutant survivors #9294 resume tests move to the new Range: its
Relative(3)edit becomes a live join with a 6 ms Min Age, and its two Oldest-end refusal tests are dropped, since a range end can no longer be Oldest.A replacement or fallback joins live at the viewer's min delay #9293's moq-transport live join now uses a range with no start and a Min Age of zero, in Rust and JS. When its ask falls back to the oldest group on an empty track, the range starts at time zero. A range resolves once, so a no-start range equal to the live join's would have stayed where the live join resolved, losing older groups that arrived later (
history_groups,finite_relay,received_rewind).Unattended choices, for review
The maintainer was away. The orchestrator took the PR's recommendation on each, and a review can still undo any of them:
quest/m1/time-start-asks-upstream.mdplans, recorded there (rejected: rethinking join placement in this PR, which would replaceJoinStart,Past, andfeed_startwith one wire range per unprovable (Min Age, end) before merging).dial.rsandserver.rs, the moq-json snapshot, moq-clisubscribeandplay's video reader, and moq-mux's TS export. They start their Min Age behind the live edge instead of at the latest or oldest group, the quest's intent (rejected: keeping their old start with an explicit range).min_statedflag, so a zeroedmoq_subscriptionequals moq-net's default, and Go's pointerDelay.Min, so a forgotten flag can't drop a value, stay (rejected:min_unstated, and Go's value plus flag).Validation
just checkpassed: Rust nextest ran 10910 tests, plus the JS, Python, Go, C, C++, Kotlin, and Dart checks. Swift has no toolchain on this host, so its smoke test was not compiled.just test interop --allpassed after merging main. It failed twice, with the same audio gap forjs -> pythonandjs -> go, after the idle-reopen fix alone. It passed again once an idle copy stopped placing joins from its stale cache.just checkpassed, moq-net tests included, andbun testinjs/netpassed 3438.just checkandjust test interop --allpassed. The firstjust checkthere failedmoq-ffi test::server_client_run_end_draft22on its 10 s timeout; it passed alone and on the rerun.just checkpassed apart from a biome format fix to the new JS test (Rust nextest 10950 passed); biome andjs/nettrack.test.tspassed after it. The new tests fail without the fix.just checkpassed.just test interop --allpassed at the A replacement or fallback joins live at the viewer's min delay #9293 merge.server_client_run_end_draft{18,20,22}failed 36 of 300 stress runs at 79c22c5 plus the merge, and 0 of 450 on main. With the moq-transport fix it passed 300 of 300.min_age_join::a_join_past_what_a_relay_copy_holds_reads_as_the_origin_does: the copy asks upstream, and the join reads what the origin gives.min_age_join::an_oldest_and_a_live_reader_on_one_relay_each_get_their_own_start, in both subscribe orders.lite::subscribe::lite07_refuses_an_empty_list_and_unknown_anchors: anchor types 3 and 4 are refused as a start, and 2 to 4 as an end, each closing the session with a PROTOCOL_VIOLATION.Relative(2)withUnsupported.track::test::a_received_copy_prefers_a_join_answered_with_a_group_over_one_answered_emptyand JStrack: a received copy prefers a join answered with a group over one answered empty, in both answer orders.min_age_join::a_join_on_an_idle_copy_opened_with_an_unstated_reader_reaches_back, libmoqraw_track_joins_the_latest_group_without_a_stated_min, andietf::subscriber::filter_tests::a_live_join_keeps_its_bounds_for_a_range_it_already_delivers. The first two fail without their fixes.min_age_join::a_join_ending_before_its_start_ends_empty_through_a_relay(and JScopy fill: lite-07 ends a live join answered empty),a_join_on_an_idle_copy_reaches_back_by_its_min_age,a_join_on_an_idle_copy_waits_for_the_live_edge, andtrack::test::a_received_copy_places_a_live_join_inside_a_held_group.Follow-ups
quest/m1/time-start-asks-upstream.mdnow owns replacing that inference with per-reader asks, which removes the choice;quest/m2/time-addressing/range-table.md(quest: plan the main → release audit's gaps, and fix its small findings #9258) compares the two languages meanwhile.Models
Size: L
Implementer: Claude, claude-opus-5-5, high effort
Implementer: Claude Code, claude-opus-5-5 (iterate, L)
Implementer: Claude Code, claude-opus-5-5, medium effort (iterate, M)
🤖 Generated with Claude Code
Review
Rewritten by
quest reviewafter each round.Head: 903ea46
Base: origin/main at 4ce2fca
Risk: high,
Removing public Anchor types and changing range endpoints breaks applications using the JS, Go, and Python APIs; reverting restores the APIs, but consumers may need repairs if a release ships these changes.Classified: high by Codex, gpt-6.1-sol, low effort, session
01a1fe06-cea0-7a73-a9cf-c54f07e485b5Reviewer: Codex, gpt-6.1-sol, xhigh effort
Session:
01a1fc8a-706d-7bc3-a708-39d90a67a5eb, round 7Score: 9/10,
Code inspection found no new defects in the merge resolutions, though join inference remains complex; builds and tests were not run.Rounds: 7; first round 3 (high 2, medium 1); findings 5 (high 2, medium 3): fixed 5, refuted 0, open 0
Findings: none