Repository navigation
feat(net)!: Max Age is a Live range's staleness budget - #9409
Merged
Merged
Conversation
Quest-Claim: 1c4e6861985f5d8a
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…Age on lite-07 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>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ir max age Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…max delay Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ery group starts at 0 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… on SUBSCRIBE or FETCH Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ges its own budget Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…/live-max-age # Conflicts: # rs/moq-net/tests/integration/min_age_join.rs # rs/moq-net/tests/integration/range_anchors.rs # rs/moq-net/tests/integration/range_table.rs # rs/moq-net/tests/integration/subscribe_ranges.rs
…d a front's reader Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… deadlocks A fill's OLD rejection held the track's read guard through its match arms and deadlocked against the drop it records. A live join reaching back past every group a non-answering hop can measure (target time 0, or no arrival that old on an untimed track) now starts where a time start from 0 does, as Start::within (the legacy max-age mapping) needs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… as Oldest does Start::within(max), what a pre-07 max age and the test helpers ask, now places like Oldest: from group 0, waiting on neither the live edge, an upstream's answer, nor a front's copies. Resume tests that meant a never-stale reader read history; placement tests use joins with no max. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A copy asked from a failover boundary got a resolved live join as Time(boundary), which is history: its upstream and its own cursor judged none of the join's groups stale. Range::asked keeps a join with a max live, as Start::within(max), with the copy's local floor at the boundary. Known cost: upstream resends the non-stale groups below the boundary, and the boundary group whole, since a resume position applies only to a range starting at that group. route_audit and route_failover tests that assert no group crosses a link twice fail on this commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d under The publisher starts a live join past the groups its max expired, so an answer judged under a narrower max would skip groups a wider reader still wants: the copy asks again for that reader instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…thin it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…E and FETCH Checkpoint: js/net type-checks; tests not yet run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every Rust crate outside moq-net/src and moq-net/tests compiles for all targets, and clippy and rustdoc are clean. Library fix: the default subscription is now a live join (Start::LATEST), so a moq-mux Delay/Playout never placed its min on it. Every caller that relied on "the default range has no start" (moq-audio, moq-video, moq-cli play, moq-gst, libmoq media and raw tracks and NULL ranges, moq-ffi MoqSubscription without ranges and media without a subscription, moq-mux ExportSource) now passes Range::ALL for the range the delay places; Delay::subscription documents it. Delay's mapping itself is unchanged. Docs: hang track_info and moq-stats info no longer link to track::Delay::max. Benches: track_fill_unlimited dropped (identical to track_fill once fills carry no budget); fetch benches expire at the track's max age instead of a per-fetch budget; ranges.rs loses its unused BUDGET. Tests: subscription.delay.max assertions read the live join's max; tests whose groups start at their sequence and relied on "every group within X" use a moq-mux test_util::within(X) (a live join reaching past every group); Time-start plus budget cases are history now (moq-audio replay test keeps only its live joins, moq-mux hole test moves onto a live join); the moq-mux live-start export test starts at group 84 behind the relay too (the relay forwards the join); the refresh, relay metrics, e2ee, and raw receive-credit tests ask for the subscription their subject needs (deep join, join reaching the stale group, history). Still failing: moq-audio a_join_backlog_skipped_below_the_cursor_folds_nothing, moq-mux truncated_resumed_group_skips_to_the_next_clean_group, moq-relay drill lite_subscriber_max_age_skips_bufferbloat. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r reach A live join never delivers a group created below its start, so the backlog that test drove below the cursor never reaches the decoder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… the oldest group A lite-06 copy measured a within(max) join from the oldest group it held, so it named that group and a widened max never took back the lower groups its publisher re-offered. Such a join now starts as a range from the oldest group does. A pre-06 SUBSCRIBE with a max age is again the latest group under it, the first to arrive on an empty track. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ests follow retunes A pre-06 absent start is placed as the floor once the source's feed says where it starts, so it reads as every group within the max age, as lite-06 does. A widened lite-07 live join keeps where it started. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…me arrives A lite-05 copy measures a join's lag from the first frame each group presents. Groups whose frames are still on their way left a within join (every group still within the max age) unplaced, and once the track's end settled the reader ended having read nothing. A lag past every group needs no frame: it starts as the oldest group does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 23, 2026
kixelated
added a commit
that referenced
this pull request
Nov 23, 2026
Resolves the conflict with #9409 (Max Age is a Live range's budget): `Misses::chase` takes main's single `resolve`, kept-out widening judges by the per-group `Budget`, the JS kept-out asker drops `maxDelay` and the stale refusal budget, and the tests read history ranges without a `delay`. A resumed reader's copy now also asks for its own miss of a group no budget makes stale, which the resume tests answer. Also answers the review findings on a6f6e88: a kept-out fill is withdrawn when the feed ends the read, and two misplaced JS comments move back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kixelated
added a commit
that referenced
this pull request
Nov 23, 2026
Maintainer decision on #9468: a resumed reader ends a read when one cursor does, so a kept-out key the asked copy's fills refused, found unfillable, or gave up as stale is accounted for. A single forgotten key, which the session asks with FETCH, no longer keeps a resumed read pending when the upstream refuses it. Also records the keep decision on refresh-joins-coalesce and adds a follow-up quest for the resume model sweep #9409 broke on main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kixelated
added a commit
that referenced
this pull request
Nov 23, 2026
…debt Adapts the branch to #9409's per-range budgets: fills no longer carry the budget they were asked under, so the looser-rider retry goes, and refusals keep only the hole their source named. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 24, 2026
kixelated
added a commit
that referenced
this pull request
Nov 24, 2026
The Reader::sync exclusion stopped matching once #9409 added the live-join tick to its guard. The quest now lists the 33 survivors a rerun of its functions and Nightly's 2026-11-23 misses finds on main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Frando
added a commit
to n0-computer/iroh-live
that referenced
this pull request
Nov 24, 2026
Moves every moq git dependency from 1767f6d7f to 8d8195bda, the base of moq-dev/moq#9504. That is 27 upstream commits. The lock only swaps the moq source revs, with no other dependency churn. Two upstream API changes needed adapting: - moq-dev/moq#9409 folds the subscription-wide `track::Delay` into each range. `Start::Live` is now `{ min, max }`, and `Subscription::default()` joins at the latest group (`Start::LATEST`) instead of reaching back from the oldest under a zero max age. Only test code built subscriptions by hand: the node and relay tests now subscribe with a live join under their max age, the keyframe-cut test uses `Start::LATEST`, and the player's latency test reads the widest live-join `max` from the ranges. The player, recorder and JSON readers go through moq-mux, moq-video, moq-audio and moq-json, which carry the change internally. - moq-dev/moq#9467 puts `origin::Config::new` behind moq-net's `test-support` feature. iroh-live-node already enables it for `RouteInfo::entered_from`, so this only updates the manifest comment to name both hooks. Not wire-breaking for iroh peers. They negotiate moq-lite-06, whose encoding is unchanged in this range: the reworked max age, the per-range SUBSCRIBE_START (#9444) and the Relay ID change (#9467) are lite-07 only. A lite-06 live join still goes out as the oldest start under one max age. moq-dev/moq#9377 changes how a lite-06 copy asks for missed keys (one SUBSCRIBE per run instead of a FETCH per key), which stays compatible with older peers. Also picked up: #9468 (a bounded read re-asks a kept-out skip), #9460 (BBR3 paces by the probed max) and #9471 (MP4 chapters as Apple's players read them).
This was referenced Nov 24, 2026
kixelated
added a commit
that referenced
this pull request
Nov 26, 2026
…#9409 #9409 translated this fixture's subscription-wide max delay into a live join an hour behind the live edge, so the stale case joined at the 2h group and handed out 2 groups instead of walking the run. A join with no lag limit is the faithful translation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kixelated
added a commit
that referenced
this pull request
Nov 26, 2026
track_fill and track_range_filling panicked on main after #9409 and #9468 broke fills for readers with 14 or more ranges below the feed's start; #9422 fixed the library. These two unit tests reproduce both breaks at 85ab682 and pass on main, so the PR gate catches a repeat instead of Nightly's bench run. Finishes quest/m0/nightly/track-bench-fixtures.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kixelated
added a commit
that referenced
this pull request
Nov 26, 2026
This was referenced Nov 26, 2026
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/live-max-age.md, which this PR deletes. It builds on the live joins from moq-dev/moq#9316, whose decision 10 called for an in-place retune.
On moq-lite-07-wip, a live join's Start carries
Live(min, max). Only a group reached through a Live range can expire for staleness, measured from the live edge. A range starting at Time, at a Position, or at None/Oldest is a floor for history. Its groups are delivered in full, bounded only by Publisher Max Age.As a result, a relay serving one DVR reader and many live readers no longer stretches every live reader's upstream budget to the DVR reader's.
Subscriber Max Ageis gone from lite-07 SUBSCRIBE, SUBSCRIBE_UPDATE and FETCH.What changed
rs/moq-net):track::DelayandSubscription::delayare removed.Start::Live { min, max: Option<Duration> }replaces them, andStart::LATESTisLive { 0, Some(0) }.Subscription::default()is one LATEST range, which behaves the same as the old default of Oldest with a zero max.Window::budget()→Budget). A group several ranges cover takes the widest Live max, and gets no limit if any history range covers it.max. Joins are keyed by(min, end).[min ms, max ms + 1], where0means no limit.Subscriber Max Age. SUBSCRIBE_UPDATE gains a retune list of(Range ID, Max Age)pairs after the add list, which changes a live join's max without re-placing it.Subscriber Max Age.container::Delay { min, max }keeps its shape. It maps a range with no start toLive { min.or(max), max }, or to history when both are unset.Consumer::set_delayretunes each live join in place.Config::max_delay.MoqDelay { min, max }keeps its shape and maps one-to-one onto the join through moq-mux.js/net,js/hang, and the packages built on them):Track.Live { min, max }, soStartisbigint | { live: Live }. Per-range budgets, retunes, join answers kept per budget, the lite-07Joinedanchor, pre-07 restates, and stale verdicts kept per reader.Track.Delay,Subscription.delay,FetchGroupOptions.maxDelayandFillGroups.maxDelayare removed. Passing an old field throws aTypeError.Container.Delayand addsContainer.update(), which retunes each join's max as Rust'sset_delaydoes.doc/concept/moq-lite.md,archives.md,identity.md, and the lib docs.Choices for review
Each of these can be undone by a later review:
None/Oldest start. It stays and means "the oldest group the publisher holds", as history. I did not remove it in favour of Live: an archive or DVR reader needs a history floor with no time to name.
Several ranges covering one group. Each group takes the widest budget among the ranges that cover it: the largest Live max, or none if any history range covers it. A range not yet placed counts as covering every group up to its end. A group no range covers, such as one already handed out when the ranges moved off it, keeps the widest live max. Ordered reads, cache-miss expiry and gap forgetting judge each stretch of a gap under its own budget.
A join never starts at a group its
maxexpired. Amaxbelowmintherefore starts the join past the oldest groupsminreaches. A relay reuses an upstream join answer only for the same(min, end)asked under amaxat least as wide as the reader's; otherwise it asks again. SUBSCRIBE_STARTED for a join added by an update follows the same rule as SUBSCRIBE_START.Retune wire position. The retune list sits after the add list in SUBSCRIBE_UPDATE. It applies after the removals, and retuning a non-Live, retired, or repeated Range ID is a PROTOCOL_VIOLATION.
Stale drop records. A relay copy records OLD drops under the narrowest live max ever asked on that subscription.
Probe budgets. Join probes carry the widest waiting max. Time probes carry none.
Legacy wire mapping (publisher side):
Start::within(max), crate-private).Live { 0, max }.FETCH loses its subscriber budget everywhere. That covers Rust
group::Fetch::with_max_delay,FillGroups::max_delay, moq-ffiMoqFetchGroupOptions.max_delayandMoqFill.max_delay, plus the Go, Python and Swift wrappers.Downstream translation of the old "Oldest + max X". It becomes
Live { min: X, max: Some(X) }: the join reaches X back and expires at X, which approximates "every group still within X". moq-muxDelayuses the same rule whenminis unset.moq-archive records history (
Range::ALL, orTime(next)on resume) and dropsConfig::max_delay. A missing group now waits for the publisher's verdict (a drop or its max age) instead of a recorder-side 10 s cap. A resume reads everything the publisher still caches, so a gap appears only past its max age.Resuming a live join: a new
Joined (0x4)anchor (lite-07-wip, Start only): group start, frame (0= whole group), Max Age. A front switching routes resumes a placed live join with it, so the join keeps itsmaxand neither resends groups nor gets re-placed at the live edge. Option (b), resuming aswithin(max), resent groups and broke six route tests. In the model it is a crate-privateSubscription::placedmap rather than a publicStartvariant, so no public API grows for it. A pre-07 wire sends it as a position plus the widest max age.Widening a live join keeps its placement on lite-07. A retune to a wider
maxdoes not reach back to groups the narrowermaxskipped below the join's start; a history range is the way to ask for those. A pre-07 hop, whose join reaches back over everything within the max age, still re-offers them.A stale verdict outlives cache eviction. FETCH stays unbudgeted, as the quest asks. A reader therefore keeps each drop that settled one of its gaps as its own verdict, and a stale verdict keeps the budget it was judged under. A run the relay forgets under pool pressure reopens only for readers that never judged it. The verdicts are billed with the reader's record and folded into its floor under record pressure. Before, the publisher judged a refill under the FETCH's max delay.
A pre-07 subscribe carries the demand's widest live
max, read before the request narrows to one span, including on an idle reopen.A pre-07 SUBSCRIBE_UPDATE restates the subscription. A live join whose
maxalone changed is placed afresh as "every group within the max age", on the publisher and on a relay copy's pre-07 upstream, rather than kept where it was placed. That matches what an absent start means before lite-07.A relay copy that knows a finished track's end takes its upstream's join answer whenever it lands. Once every group has arrived or been given up, it places the join from what it holds, since nothing more can come.
Route-failover test readers ask
Order::Ascending. Their tests check every frame once and in order, and a live join's backlog now arrives newest first by default.A JS relay copy re-places joins over a pre-07 upstream. Rust's front does this by asking each copy for its readers' joins. On JS's plain path, a pre-07 restate of a startless join instead marks the old SUBSCRIBE_START restated. It then bounds neither join placement nor what the feed owes, and the gaps below it get a fresh grace while the publisher re-offers them. It still bounds fills, so lite-06 sends no FETCH below it. JS origins don't move onto a front: that is a much larger change.
A relay copy matches a reasked probe by its join
(min, end), not the whole range. A range now carries its join'smax, so a lite-06 viewer restating its max made the reask look unasked. The probe was then retuned in place, keeping an answer that places no reader that began after it.A pending range covers every group up to its end until its span is known, whether it is history or a live join. The groups it may reach can't go stale under a narrower budget while its start is unanswered.
A placed join's answer is a history proof only with no max age. A Joined range asked under a max age, even one retuned to none since, may start past groups the publisher still holds, so a relay copy doesn't use its SUBSCRIBE_START to place history readers. The join's own readers are already placed.
Impact (breaking)
track::DelayandSubscription::{delay, with_delay}are removed.Subscription::default().with_delay(Delay::default().with_max(x))..with_ranges([Range::from(Start::Live { min: x, max: Some(x) })]), orRange::ALLfor history with no limit.Start::Live(lag)becomesStart::Live { min: lag, max }.group::Fetch::with_max_delayandFillGroups::max_delayare removed.RangeandStartno longer implementDefault:Range::default()becomesRange::ALLfor history, orRange::from(Start::LATEST)for the old live default.producer::Config::{max_delay, with_max_delay}are removed.MoqFetchGroupOptions.max_delayandMoqFill.max_delay()are removed. This touches GoFetchGroupOptions.MaxDelayandFill.MaxDelay, PythonFill.max_delay, and SwiftFill.maxDelay.MoqDelayis unchanged.@moq/net):Track.Delay,Subscription.delay,FetchGroupOptions.maxDelayandFillGroups.maxDelayare removed.Startgains{ live: { min, max? } }, where an omittedmaxis 0 andnullmeans no limit.{ delay: { max: x } }.{ ranges: [{ start: { live: { min: x, max: x } } }] }, or{ ranges: [{}] }for history.@moq/hang):Container.Delaykeeps its shape.Container.update()is new.Validation
All of these ran through
quest gateon this machine.Suites at the head:
just checkpasses apart from four moq-relaycluster::tests::peer_*config-parsing tests, which hit the 60 s timeout under load. All 16peer_*tests pass in 0.02 s on their own.containerpasses (226), and the Python bindings pass (128).Model checks (TLA+): none found an error.
Real surface:
just test interop --allruns the builtmoq-relaywith every client (Rust, Python, Go, C++, JS, JS native on Node and Bun, C, GStreamer) on lite-07-wip, plus the lite-05/06 and moq-transport lanes. Every cell passed exceptjs -> cpp, which failed withaudio gap.quest/m0/interop-greentracks (moq-dev/moq#8611, moq-dev/moq#8633).--publishers js --subscribers cpp,go,python,rusthad cells fail with the sameaudio gapin 3 of 10 runs at the merge base and 3 of 6 runs at the head. Each failure was a different cell.Interop regressions this branch caused and then fixed: the rust → js lanes and the finish lanes caught them.
Codex review fixes (rounds 1 to 3), each with a Rust and JS test that fails without it:
After those fixes,
just checkpasses at the head (11268 tests), and a secondjust test interop --allpassed every cell (203).just checkbefore that failedmoq-rtmp server::tests::play_multitrack_to_capable_client: kio denied a 5 µs host timer that moq-mux's jitter engine fired under load. It passed 40 of 40 runs on its own and in the next full run. This branch doesn't touch the jitter engine or the rtmp server.A second merge of main brought in span-time anchors (moq-dev/moq#9406), the ordered-read rescan (moq-dev/moq#9426) and stale-skip
taking(moq-dev/moq#9389). The resolution:takingand the bound per group under the piecewise budget;Delayto Live ranges.After it,
just checkpassed (11323 tests),just test interop --allpassed all 203 cells, and Codex round 5 found nothing.Merging main exposed four regressions, each found by the full suite. Each fix has a test that fails without it:
a_pending_history_range_keeps_what_it_may_cover, plus a JS test). This wasroute_switch.an_unanswered_copy_places_a_join_past_every_group_at_once). This wascluster_unknown.Nonefor good. A placed join now waits on an unanswered one (a_placed_join_waits_on_an_unanswered_one_to_start). This wascatalog_churn_lite_07, which passes at the base.Merge notes:
answered_joinis adopted.A third merge of main brought in the lite-06 fill walk (moq-dev/moq#9377), lite-07 malformed-response closes (moq-dev/moq#9349) and
non_exhaustiveevents (moq-dev/moq#9362). The resolution:Subscriber Max Age, and main's pre-07 decode of 2^53−1 ms and up as no limit, which this branch already had; main's extra boundary assertions are kept in Rust and JS;GRACEcap is unchanged;Delayto ranges: "Oldest + max 30 s" becomeswith_max(30 s)(a Live join past every group), and "no max delay" becomes a history range.After it,
just checkpassed (11350 Rust tests), andjust test interop --allpassed all 203 cells.Follow-ups
None filed. Two suspicions couldn't be reproduced, so neither has a quest until one can:
Models
Size: L
Implementer: Claude Code, claude-opus-5-5, unknown effort
Implementer: Claude Code, claude-opus-5-5, unknown effort (iterate, L)
(Written by Claude Opus 5.5)
🤖 Generated with Claude Code
Review
Rewritten by
quest reviewafter each round.Head: c0cbebc
Base: origin/main at f1871e2
Risk: high,
This branch removes and reshapes public API (JS `Track.Delay`, `FetchGroupOptions.maxDelay`, `Subscription.delay`, `Fill.maxDelay` in Go and Swift, and `Start.live` changed from a Duration to a `Live` object) and changes lite wire handling (the lite-07 max-delay encoding helpers are removed and `fills_from_start` is altered), so consumers and peers that build against these break, and a revert would undo it only by restoring the removed surface across several packages.Classified: high by Claude Code, claude-haiku-5-5, low effort, session
61d95d44-4427-4fb5-8bd8-92d6283249a3Reviewer: Codex, gpt-6.1-sol, xhigh effort
Session:
01a2078c-a376-7e72-9aa7-b81d008902b3, round 6Score: 10/10,
Code inspection found no new branch-owned issues in the merge adaptations or follow-up edits.Rounds: 6; first round 5 (high 1, medium 4); findings 5 (high 1, medium 4): fixed 5, refuted 0, open 0
Findings: none