Repository navigation
fix(net): the JS resume model's routes are received copies, and a finished group buffered at abort reads on - #9396
Conversation
Quest-Claim: dc48e07fd2eaaa93
Checkpoint: the sweep still fails; see the PR. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…odel routes mirror Rust's Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… ended-reader and short-continuation cases Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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 5 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. |
There was a problem hiding this comment.
✅ No new issues found.
Approach: sound. The fix targets the cause: #continues refuses a #released reader, so a finished group still buffered in a sink lost its recovery when the track closed. The fix stops releasing those groups. It does not special-case the front.
Reviewed changes
Reviewed the track.ts close-path change, traced against group.ts (#release, #continues, Producer.#end, #failHeld, mirror), plus the model and unit test changes.
Producer.#closekeeps finished buffered mirrors readable. At this point, open cache entries have already been unlinked from every sink by#unlink.#detachedand cached groups have been aborted withgroupError. So thegroupFate(...)() !== undefinedcheck releases exactly the failed mirrors and leaves theclosed === nullones alone. A plain consumer without#recoverstill drains a kept mirror and then ends cleanly. Only a front's recovery gains the ability to continue it.- JS resume model routes are received copies. Routes now use
poolTrackwith an inertcache.Pool, plusreceiveTrackanddropAnchors. This matches Rust's never-swept route pools andAnchors::Refused. The two local-track regressions keep their old shape behindlocal: true. - New regressions and the before/after unit case. Four model regressions are added, and "a short group on a failed route waits for the next one" now runs with the group taken both before and after the abort.
- Rust model comment. Reworded to say that a received route waits below a later group instead of passing it. There is no code change.
- Follow-up quests. Two gaps are split out into their own quests: ended-reader routing (seeds 4, 7, 10) and short continuation onto a failed copy (seed 9).
claude-opus-5-5 | 𝕏

Completes quest/m1/js-resume-model-received.md.
Summary
The JS resume model (
js/net/src/resume.model.test.ts) now builds each route as a received copy, matching the Rustmodel::resume_model. Before, every route was a local publisher. Doing this exposed a real JS bug intrack.ts: a short, finished group that was still buffered when its copy aborted could not be continued from another copy.Changes
js/net/src/track.ts: when a track closes, it now releases only the unfinished buffered groups. A finished group stays readable, so if a front takes it after the abort, recovery can continue it from another copy. Previously such a group was released (#released), and#continuesrefused to continue it.js/net/src/resume.model.test.ts: changes to how each route is built (up):receiveTrack+dropAnchors: a received copy whose wire reports no start for a range. This is the JS counterpart of Rust's barereceived()(Anchors::Refused).cache.Pool: Rust's route pools are never swept, so idle groups there never expire.local: trueflag.dropAnchors.track.tsfix.js/net/src/resume.test.ts: "a short group on a failed route waits for the next one" now covers the group being taken both before and after the abort. The "after" case fails without thetrack.tsfix.rs/moq-net/src/model/resume_model.rs: rewords one comment. A received route waits below a group that lands past its range; the old comment said it passes it.Decisions
Each of these was my call while the user was away. All can be undone in review.
receiveTrack+dropAnchors, not the Plan's barereceiveTrack. In JS, barereceiveTrackis the lite-07 Wire mode (Rustreceived().anchored()), and it broke time-start placement in seeds 3, 10 and 11. AddingdropAnchorsgives Rust'sAnchors::Refused, which is what the Rust model's barereceived()uses.BroadcastProducerpool expires idle groups after 30s on its own timer. Nothing drives a standalone Rust pool, so the two models disagreed on seed 12 and regression 27. Giving each route anew cache.Pool()without that timer makes them agree. Production code is unchanged.track.tsfix keeps finished buffered groups readable after an abort. An unfinished group still ends with the track. A finished one is complete: it can't be truncated, and a recovering front can continue it from another copy.local: true. I did not port them to unit tests, because JS has no test hook to force drop forgetting.resume.ts, which moq-dev/moq#9316 and moq-dev/moq#9289 are also changing:maintoo).Validation
MOQ_RESUME_SEED=1..24at 4096 cases each, run on this branch and onorigin/main:mainfails seeds 2, 7, 14.resume-model-route-closequest owns them.just checkpassed on the branch (Rust workspace tests and JS checks). The fulljs/netsuite passes.Public API and wire
Public API: none. Wire: none.
track.tschanges behavior only: a finished group buffered at track abort stays readable.Caused by
No single PR. Releasing every buffered sink group at track close predates recovery; it has been there since the JS core. moq-dev/moq#9277 made a short group on a failed route read on, but only for a group taken before the abort (found by check: the JS resume sweep with received routes).
Follow-ups
Phase::Finished { routed }does (seeds 4, 7, 10).Models
Size: L
Implementer: Claude Code, claude-opus-5-5, unknown effort
(Written by Claude Opus 5.5)
🤖 Generated with Claude Code
Review
Rewritten by
quest reviewafter each round.Head: 8d204c3
Base: origin/main at 75b1af5
Risk: medium,
The only shipped-code change is `js/net/src/track.ts`, where a closed producer now keeps finished groups readable instead of releasing them, a behavior fix for JS consumers that keeps the API and wire format, so a revert fully undoes it; the Rust change and the JS test edits are test-only and the quest plan files are docs, so nothing published breaks.Classified: medium by Claude Code, claude-haiku-5-5, low effort, session
b9625fe8-19bb-4c52-8cfd-ec668f0dbf22Reviewer: Codex, gpt-6.1-sol, xhigh effort
Session:
01a20313-1d0a-7412-9238-7e8c57cdfc12, round 1Score: 8/10,
Source review found no actionable defects and coherent regression coverage, but builds and tests were not run.Rounds: 1; first round 0; findings 0: fixed 0, refuted 0, open 0
Findings: none