Repository navigation
fix(net): kill resume route mutants; keep expired and draining copies' groups owed - #9750
Merged
Merged
Conversation
Quest-Claim: 6f2a8e4781dd55b8
… mutants Exclude Router::closest_of's tie with the rest of the pick keys, whose claimant ends every key. Drop the logical record's rescan flag, which no drop scan reads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A backfill flagged only for a time start at the serving copy's resume point would hand out a group under its floor from the route's cache instead of asking the route for it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An expired replaced copy's late groups, fresh by their own successors there, stay unread; a replaced copy refusing a time start leaves the read to the serving copy. Drops the stale poll_first exclusion whose proof claimed an expired copy's groups were always past the budget: the new test shows otherwise, and the mutant moved into Reader::reads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ckfill Kill two resume.rs mutants: Copy::asked_for's end bound (a finished backfill ending at the kept-out key goes, so the route is asked from that key) and Reader::backfill's flag merge (a raised backfill widened by a plain ask still reads the group holding its time under its floor). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A backfill flagged only for a time start at the serving copy's resume point would hand out a group under its floor from the route's cache instead of asking the route for it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…er budget Subscriber::forget_past judged replaced copies under the reader's current budget, so a hand-out while a copy was expired forgot the gaps its unread late groups fill. A later widened budget then read the copy again but found those groups already written off, where one track keeps a skipped group owed to a wider budget. Judge the copy under any budget instead. The copy.replaced check is dropped: only the last copy, the serving route's own, is ever unreplaced, and the newest is skipped first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A replaced copy a switch left a group to drain could be let go without handing it out, once its own read gave the group up, and nothing asked the serving route for it, though that route still offered it. Had the copy's cache evicted the group instead, the walk re-armed and the reader got it. Letting such a copy go now re-arms the walk too, and poll_first walks at once. ResumeReader.tla mirrors it in LetGo; all three configs pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A replaced copy a switch left a group to drain could be let go without handing it out, once its own read gave the group up, and nothing asked the serving route for it, though that route still offered it. Had the copy's cache evicted the group instead, the walk re-armed and the reader got it. Letting such a copy go now re-arms the walk too, and poll_first walks at once. ResumeReader.tla mirrors it in LetGo; all three configs pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…y late groups and JS parity Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Since a copy let go with a group to drain re-arms the walk, losing the backfill flag no longer loses the group: the serving route is asked for it again. Pin that the backfill holding it hands it out without that ask. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-agent-a3fec2d9e383fe36d
The backfill walk now records, per replaced copy, the groups it left that copy to drain (each one the copy held then, so a peer can't grow the set past the copy's cache). Every poll rechecks the drain predicate for them (`Copy::may_drain`, `Reader::rescan_drains`) and re-arms the whole-route walk once one stops draining: evicted, given up as stale, or the copy failed or spent its budget, even while a read of another of its groups still leases the copy. Letting a copy go with such a group also re-arms. This replaces the track eviction count (`Consumer::evicted`, JS `hooks.evictions`) and the `partial` guard on it, which missed a copy kept by a lease whose left group went stale. The JS reader gets the same tracking (`#rescanDrains`, `#mayDrain`, `#letGo`). ResumeReader.tla models the per-copy set (`Rescan`, `DrainsBy`) in place of `Evicted`; all three configs pass and ReArm = FALSE still fails CleanEndIsComplete. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A poll of the read's drops judges replaced copies without the group poll's rescan, so it can let one go while it still holds a group left to drain that no longer drains. Covers that case, which is the only path reaching the re-arm in `Reader::let_go` (cargo-mutants left three survivors there). The JS test closes the serving group it reads, as the Rust one drops it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… wider budget Mirrors the Rust forget_past fix: forgetPast now passes over only a copy whose channel ran out, not one merely past the reader's budget, since a widened budget reads it again. A spent copy needs no check: lowestBuffered stops at the copy's cap and skips delivered keys. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…c929e966a03 # Conflicts: # js/net/src/resume.ts # rs/moq-net/src/model/resume.rs
A lease on a replaced copy kept its unread groups pinning the fold under any budget, so a reader's record of the serving route's later gaps grew one run per gap for as long as the lease lasted. No budget reads past the track's max age bound, so a copy expired under it no longer holds the fold back. Rust and JS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…c929e966a03 # Conflicts: # .claude/skills/verify-resume/SKILL.md
No targeted resume or relay route mutant survives: the drain restructure removed the partial guard, and every other targeted mutant is caught. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s max age; backfill before a clean end forget_past judged a whole replaced copy past the track's max age bound, but a group landing late there can stay fresh by its own successor past that point, and a wider budget still reads the copy. Each unread group is now judged by its own freshness at the max age instead, so the fold stays bounded without losing it. Rust and JS. The JS reader could also end cleanly right after letting go of a copy with a group left to drain, before asking the serving route for it: tryGroup now asks before judging the end, as the Rust poll_first does, and a clean end that lets such a copy go waits for the next read to ask. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rescan drains only when idle forget_past now asks each replaced copy for its lowest unread group some budget still reads (track::Subscriber::lowest_owed): the read holding it judges it at its track's max age within its own window and cap, so a group outside a capped copy's window never convicts one inside it, and a nested front asks the route that holds the group. JS judges with the copy's own drift too. Drains are rescanned only on a pass with nothing to hand out, as a cursor asks a fill only once it holds nothing to read, so draining a backlog of N groups costs no rescan per group. ResumeReader.tla follows. The JS clean end rescans drains first, so a leased copy that stopped draining is asked of the serving route before the track ends. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… age Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he ordered-read gap The serving copy's close callback re-armed the walk on a lost drain but left the backfill to a read, so a later callback pass could end the track first. It now asks the backfill itself, as the Rust end path does. An ordered read passing a group a replaced copy lost is the same on main, so it moves to its own quest. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…JS clean end asks any queued walk An ordered hand-out passes every key below it, so a group a replaced copy was left to drain and lost there is asked of the serving route before it goes out, read first when that route's cache holds it. Rust and JS recheck only the drains under the candidate, which costs the groups handed out since. JS's clean end asks a walk an earlier pass queued, not only one this pass re-armed, and judges again after a backfill a cache answers at once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The JS take gives up a group its copy holds without its head, so a candidate a replaced copy lost and got again headless was passed with the group above. The ordered recheck now includes the candidate. Rust hands out the reserved group as it is, which a parity test pins. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kixelated
marked this pull request as ready for review
November 28, 2026 07:17
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 17 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 was referenced Nov 28, 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.
Problem
Nightly's mutants shards still reported survivors in
rs/moq-net/src/model/resume.rsandrs/moq-net/src/route/relay.rs. That covered the three #9619 left, plus the ones from Nightly 45867457463. Rerun againstmain(83e10f008a), 13 still survived, and two of them pointed at real bugs.Approach
Each survivor gets a unit test that kills it, an exclusion with a proof, or a rewrite that removes it. Each new test fails with its mutant (or the old code) applied by hand.
Bug fixes, in Rust and JS:
Subscriber::forget_past(JSforgetPast) judged replaced copies under the reader's current budget, so a hand-out while a replaced copy was expired forgot the gaps that copy's late groups fill, and a widened budget then found them written off, while a plain track keeps them owed. Each unread group a replaced copy holds is now judged fresh or stale on the read that holds it (track::Subscriber::lowest_owed, JSlowestBuffered(.., fresh)), at its track's max age, within that read's own window and cap, and through an inner front down to the leaf read. Tests:a_widened_budget_reads_an_expired_copys_groups_past_a_hand_out(plain and routed, both languages).an_expired_copy_past_its_max_age_bound_holds_back_no_gap(18 runs without the bound, 3 with it, in both languages) anda_widened_budget_reads_an_expired_copys_group_fresh_at_its_max_age, both also with the copy behind an inner front in Rust.Copy::drains),Reader::rescan_drainsrechecks them withCopy::may_drainon a pass with nothing to hand out (so draining a backlog costs no rescan per group) and before any clean end, an ordered read rechecks those under the group it is about to hand out, and in JS that group too, since the JS take gives up a group held without its head (each copy's keys are ascending, so this costs the groups handed out since), andlet_gore-arms the walk for a copy it lets go with one undelivered. JS's clean end from the serving copy's close callback asks any queued walk itself and judges again, as the Rust end path does. This removestrack::Consumer::evictedandevicted_groups(JShooks.evictions).ResumeReader.tlamirrors it (Rescan,LetGo). Tests:a_group_a_draining_copy_gives_up_is_backfilled(Rust: evicted, leased, and let go by a drop poll; JS: with and without a lease)an_ordered_read_asks_for_a_lost_drain_before_passing_it(both languages), andan_ordered_read_reads_a_drain_its_copy_got_again_without_its_head(both languages).Killed:
Subscriber::key_after->Some(0)/Some(1):a_fronts_held_groups_successor_bounds_it_by_key.Reader::rescan_dropsandSubscriber::rescan_drops->():an_untold_run_is_reported_again_after_a_rescan(plain and routed).Subscriber::lowest_unreaddelete !:a_fronts_delivery_starts_at_a_group_any_copy_serves_whole.Reader::reads||->&&:an_expired_copys_late_groups_stay_unread.Reader::poll_firstreplaced-refusal guard ->true:a_replaced_copys_refusal_leaves_the_read_to_the_serving_copy.Copy::asked_for<-><=:a_kept_out_key_above_a_finished_backfill_is_asked_from_itself.Reader::backfill|=->&=:a_backfill_widened_past_its_time_start_still_reads_the_group_holding_it.Reader::backfill_gapstime < resumed-><=:a_lost_drain_under_a_backfill_is_asked_with_a_time_start_at_the_resume_point.Removed:
Reader::backfill_gapsmatch guardpartial->true. The per-copy drain keys replace the eviction count that guard refreshed, so the guard is gone.Excluded:
Router::closest_of<-><=: the existing(reselect|closest)exclusion predates theclosest_ofsplit. Every key ends in its claimant, andclaimantsholds those in aBTreeSet, so no two keys tie.Copy::may_drainkey < end-><=: the oldbackfill_gapsexclusion, moved with the code.may_takealready confines a drained key to the copy's ranges, which end at its cap.Reader::rescan_drainsordered boundkey < below-><=: that also checks the candidate itself. In Rust the candidate is the reserved group and is handed out as it is (the headless parity test pins this), so a re-arm there asks at most a walk whose gap the hand-out fills.Cleanups:
:\d+:13: replace || with && in Reader::poll_firstexclusion. That condition moved intoReader::reads, where it is now killed.track::Subscriber::rescan_dropsno longer sets the logical record'srescanflag. No drop scan reads that flag: each copy scans its own drops.Reader::backfill_gaps' doc comment back onto it fromreopen_folded, whichmainhad slipped between them.quest/m0/nightly/resume-route-mutants.mdis deleted and its links point here.Impact
Caused by
forget_past's judgment of replaced copies under the reader's current budget (found by check: mutants).Decisions
partialguard survivor in the quest. It is the fix that quest recommended, and it also answers the review finding that a leased copy could stop draining without a re-arm.rescan_drainsruns only on a pass with nothing to hand out and before a clean end, not on every poll, as a plain cursor asks a fill only once it holds nothing buffered. Rejected: rescanning every poll (costs O(backlog) per group handed out).#letGore-arm (thecopy.drainscheck before#drop) as the mirror of Rust'slet_gore-arm. No JS test reaches it, but#concludeand#judgingcall#letGoon paths no test or model rules out. Rejected: deleting it (simpler, but leaves those paths relying on an unchecked argument).mainat065a4c1843with or without a drain, moved to its own quest: it needs a new hold on ordered candidates above an outstanding backfill. Rejected: the full hold here (outside this quest's scope) or deferring the recheck too (leaves the JS regression).quest reviewasked for a maintainer pick. I took fix-as-recommended:#concludeasks any queued walk, not just one re-armed this pass, and judges again after letting go, so a backfill a cache answers synchronously leaves nothing to wait on. Rejected: accepting the findings (a reader awaiting only the close could end short of a group) or dropping the PR.c53243d095with the branch's modeled changes listed beside it. Moving it to the base means auditing everymainchange to the covered functions since, which is the next coverage change's job.route/node.rsandroute/reader.rsmutants, so it doesn't overlap this PR.Follow-ups
main.Validation
cargo mutantsthroughquest gate just rs mutants:resume.rsand the route code (--in-diff), at6c5d9dea72: 79 mutants, 54 caught, 25 unviable, 0 missed.asked_for,backfill,backfill_gaps, thepoll_firstguards, bothrescan_drops,forget_past,lowest_unread,key_after,reads,Router::named): 44 mutants, 44 caught.Router::closest_ofis excluded above, and thepartialguard no longer exists.resume.rsfromcc3065a1c7to6960a22a1d,--in-diff): 12 mutants; the 3 missed were all onresume::Subscriber::lowest_owed. The nested-front test variants inf1f94640ebcatch them: a rerun over everylowest_owed(Rusttrack.rsandresume.rs) gave 29 mutants, 29 caught.--in-diffof its commit): 18 mutants, 11 caught, 6 unviable, 1 missed, which is the boundary excluded above.verify-resume, all three configs pass after the idle-only rescan: default (20.1M states),ThreeRoutes(5.0M),Evict(14.4M).mainat065a4c1843(see the new quest).js/netbun testpasses (4010 tests) andmoq-netnextest passes (4663 tests) at9ad8675dca.quest gate just checkpasses at9ad8675dca.quest gate just cipasses at9ad8675dca. One earlier run on the same head failed only injs/publish(three drift tests timed out anda backlog encode refusal aborts its rendition when demand arrivesfailed at load average 40), and that package passes on rerun. This branch does not touch it.Models
Size: M
Implementer: Claude Code, claude-opus-5-5, unknown (arm A)
Implementer: Claude Code, claude-opus-5-5, unknown (arm A)
Review
Rewritten by
quest reviewafter each round.Head: 9ad8675
Base: origin/main at 0275260
Risk: medium,
A mistake in the resume reader's drain and backfill logic (rs/moq-net/src/model/resume.rs, track.rs, js/net/src/resume.ts) could hand a reader a wrong, missing, or reordered group for resumed subscriptions, reaching relay and client users only through the next release cut; it is easy to undo by reverting the commits, and the change keeps the public API, the wire format, and the release and auth paths intact, so it is a shipped fix rather than a break.Classified: medium by Claude Code, claude-haiku-5-5, low effort, session
00c38fd0-54b2-4438-804b-dd9561a5fb55Risk file: bb7b1c0de60b
Reviewer: Codex, gpt-6.2-sol, high effort
Session:
01a21f13-3a5d-78b0-b74e-61c558faac99, round 6Score: 10/10,
The inclusive JavaScript rescan fixes the reported ordered-read loss, and the head is ready to land.Rounds: 11; first round 1 (medium 1); findings 10 (medium 10): fixed 10, refuted 0, open 0
Findings: none
Notes, the author's to take or leave:
rs/moq-net/src/model/resume.rs:10863:Assert which copy supplied the reserved groupThe last round's findings, at dc24e03:
js/net/src/resume.ts:1482:Limit an ordered take to the group checked for backfill;The JavaScript rescan now includes the peeked key, so a headless drain re-arms backfill and retries selection before the take can skip it (`js/net/src/resume.ts:1849`, `js/net/src/resume.ts:1874`, `js/net/src/resume.ts:1477`).