Repository navigation
fix(net)!: a local session close cancels received tracks like a remote close - #7081
Conversation
|
Design change: this PR now implements the alternative instead of keeping the clean local close. The maintainer's rule: "I don't like stuff working differently locally and remotely." A deliberate local session close now ends received tracks, their unfinished groups, and pending lite fetches the way the peer's clean close does, in Rust and JS. Measured, that is the session-cancel error ( (Written by Claude Opus 5.5) |
|
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 47 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. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed commit: 137291761d93a4149b7c86c18abcd19752186363.
No actionable bugs found. Using the session-cancel cause for both deliberate local and peer clean closure implements the stated parity decision without inventing a content end. Draining buffered streams before aborting preserves an already-arrived FIN and pending FETCH cleanup; resume still treats the cancellation as a failed route eligible for replacement. The subscription-update stop promise now handles stream rejection without overriding the response path's terminal cause.
Direction: consolidating teardown is simpler than preserving a local-only clean-end exception. The added local/remote track/group and pending-FETCH regressions, plus the local FIN-drain check, target the important boundaries. This is an intentional observable API change, not a wire change.
Verification limits: GitHub-only static review of Rust/JS teardown, fill/resume behavior and tests, with an independent Rust pass. I did not run builds, tests or live transport/browser checks; author-reported results were not reproduced.
|
Merge summary for head
Queuing for the merge queue. (Written by Claude Opus 5.5) |
* chore(quest): claim quest/m1/resume-model-test.md Quest-Claim: 7bff411939571787 * test(net): check resume against a model of one logical track A seeded proptest drives an origin's fronts through route flips, route failures, give-ups, ranges, cache expiry, a newer epoch, and reader joins and leaves on the simulated clock, and checks every reader's groups, frames, drops, and end against a plain cursor on the logical track. Fixes what it found: - An ordered reader never ended once a finished track left nothing in its range, or the rest of the range was given up. - A drop poll with local bounds below the subscription's floor built a reversed span and panicked. - A resumed reader held a drop back for a replaced copy kept only to back a group still read, and was not woken once that read finished. * test(net): check JS resume against the logical-track model Mirror rs/moq-net's resume model as a fast-check property over the same ops, constants and checks, seeded by MOQ_RESUME_SEED and sized by MOQ_RESUME_CASES (default 64). It found three bugs, each fixed with a regression case: - A replacement copy's refusal ended a group the serving route still delivered; it is a verdict only once that route won't land it either. - A failed copy's cache eviction released a group recovering from another copy; only the copy a mirror reads from reclaims it. - A reported drop was final, so a group a later copy delivered was never handed out; the report is now once and not final. * ci: sweep the resume model nightly from a fresh seed * test(net): answer route fetches in the resume model A real route forwards a fetch for a group it lacks to the publisher. The model's routes refused every fetch, so a group continued across a failover read NotFound although the instance carried it. * test(net): let model routes hold a tail fill beside the live copy A frame-bounded fetch caches a partial copy of a group, so a later whole-group fetch must still be answered. A group a reader stitched from two copies is complete once any copy wrote its last frame. * fix(net): keep a recovered group when its old copy is let go Releasing a copy's subscription released every mirror it cached, including a group recovery had already moved to another copy, which then ended cleanly short of its frames. The JS model's routes now answer fetches, which exposed it. * quest: finish resume-model-test, plan delivering late groups below the resume point The maintainer kept the resume point policy on #6947; delivering the late lower groups is a nice-to-have follow-up in m2. * test(net): request the model's broadcast through the renamed origin API * test(net): resume readers only on a route Up or Down actually changes * test(net): restore Recover's refusal wait, and resume Rust readers only when the cheapest route changes The main merge took main's whole resume.ts and dropped the PR's Recover hunk. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* chore(quest): claim quest/m1/quic-api/streams.md
Quest-Claim: 3067217ff870abc5
* wip(quic): namespace moq-quic streams as send, recv, and stream
send::{Stream, Offset, End, Options, Group, Groups, Error}, recv::{Stream,
Lease, Chunks, Error}, and stream::{Id, Dir}. Writes take Buf, a lease moves
its chunks out and holds no borrow, send ends stay queryable until released,
and datagrams chain chunks without copying.
* wip(qmux): use moq-quic send ends and Buf writes
* wip(tokio): namespace the QUIC driver as send, recv, and stream
send::{Stream, Finished, Group, Options, Offset, Error} with finish(self)
typestate and consuming resets, recv::{Stream, Lease, Error} with a lease
that owns its bytes and holds no lock, Buf writes and BufMut reads, and
datagrams that chain a header. quic::web collapses onto one error per
direction. moq-quic only reruns the stuck pass on restore when an out lease
held it off.
* wip(uring): namespace the QUIC driver as send, recv, and stream
* wip(uring): port tests and moq-relay to the namespaced driver
* wip(uring): format
* wip(quic): name the namespaced stream API in the fork notes
* wip(quic): fix a stale doc link
* chore(quest): finish quic-api/streams
* fix(quic): keep terminal stream state across the review's lifecycle gaps
- moq-tokio and moq-uring cache a reset `received_reset` reports, since
moq-quic frees the stream then, so later reads and leases fail with it
instead of panicking.
- moq-uring's web `poll_closed` observes a clean FIN again through an empty
read, instead of a reset-only query that waits forever.
- moq-uring's web `finish` keeps a finished stream's handle when called again.
- qmux resets an unfinished stream on drop before releasing its ID, which
refused the reset.
* fix(quic): size a datagram before taking its payload
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
… on moq-dev pairs (#7073) * chore(quest): claim quest/m0/smoke-released.md Quest-Claim: 1a9318c095d636e0 * fix(smoke): hold the Cloudflare probe's track reader The probe dropped its TrackReader, so when the relay rejected an early SUBSCRIBE with DoesNotExist, cloudflare/moq-rs failed to close the track and resolved the subscription as done. The harness then failed the cell instead of retrying the readiness race. Also rewrite the smoke-released quest to the classified runner failures. * fix(smoke): gate the upstream runner on moq-dev pairs only Only moq-dev-rs and moq-dev-js against this checkout's relay fail the Upstream Docker interoperability job; every other pair is reported, as relays.sh treats non-moq-dev relays. A required pair the registry stops pairing fails too. With the Cloudflare probe fix this finishes the quest, so delete it. * fix(smoke): annotate optional runner failures; record the moq-rs close bug Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* chore(quest): claim quest/m0/nightly/quic-rustdoc.md Quest-Claim: 0a0d799823f82f7f * fix(quic): unbreak moq-quic's all-features rustdoc The fuzz-gated bench map linked to the private SentPackets type, which fails rustdoc under -D warnings. Nightly's features lane already builds workspace rustdoc with --all-features, so no new lane is needed. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* chore(quest): claim quest/m0/ci/tracing-filter.md Quest-Claim: a26a0b73687228f9 * wip: stop forcing tracing-test's no-env-filter * chore(quest): finish quest/m0/ci/tracing-filter.md * test: keep captured spans enabled beside parallel tests With one dispatcher registered, tracing-core caches a callsite's interest from the thread that first hits it. A parallel test without a subscriber then disabled the `srt` ingest span for the capturing test, so `publisher_reports_a_silent_pid` failed about two runs in three under `cargo test`. A second, no-op dispatcher makes every callsite ask the current thread's subscriber. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* chore: point quest and rust2 references at moq-dev Both repositories moved from the kixelated account to the moq-dev organization. The flake input keeps the same revision and hash. Generated quest skills refresh with the next quest bump. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* chore(quest): claim quest/m0/ci/mbx-r2-verify.md Quest-Claim: 9a556a77ba203b39 * quest(m0/ci): record the first mbx 1.28 Nightly in the R2 verify quest The bump's checks passed: every hosted Nightly job writes, macOS refused only an already oversized manifest, and the merge queue shows no E0463. Reuse is still absent on every platform; record the lockfile-identity evidence and narrow the quest to what remains. * ci(platform): install uniffi-bindgen-cpp after the Rust build The Nightly Windows build loaded the install's 124-prediction mbx manifest under its own identity on 2026-10-27 and 2026-10-28, which blocked inheriting the previous lockfile's manifest. Installing after the build lets the build inherit first. Reported upstream as jdx/mr-boxington#869. * quest(m0/ci): record upstream's CRLF cause for the Windows cache miss jdx/mr-boxington#870 traced the Windows miss to CRLF lockfile digests, not the uniffi-bindgen-cpp install, and the macOS build did inherit. * quest(m0/ci): revert the uniffi-bindgen-cpp step move, record settled decisions #870 showed the Windows miss comes from CRLF lockfile digests, not the install order, so platform.yml keeps main's order. Windows now waits on an mbx release with #870 and a pin bump; Linux full history waits on Windows hitting; lockfile churn past 8 states counts under the rebuild item. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…pshot before parsing (#7072) * chore(quest): claim quest/m0/ci/stats-oversize.md Quest-Claim: 4a6d2df5874a8c48 * perf(json): refuse an oversized snapshot before parsing or compressing it * chore(quest): finish quest/m0/ci/stats-oversize.md * feat(json): a public snapshot group budget, refusing a snapshot past it before parsing snapshot::Config gains max_group_bytes (JS maxGroupBytes, no longer internal), clamped to moq-net's cache limit. The encoder refuses a snapshot past it before the baseline parse, so moq-stats' oversize tests lower it to 64 KiB under test instead of building 32 MiB of stats. * chore(json): regenerate the API report for maxGroupBytes Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…e close (#7081) * chore(quest): claim quest/m1/cut-audit/js-close-cause.md Quest-Claim: a1a64f23c30db61e * quest: keep a locally closed session's received tracks ending cleanly The received track's local-close outcome already mirrors Rust and is pinned by tests, so the quest has nothing left to implement. * fix(net)!: a local session close cancels received tracks like a remote close A deliberate local close now ends received tracks, their open groups, and pending lite fetches with the session-cancel error a peer's clean close produces, in Rust and JS. moq-net's AGENTS.md (and a new js/net/AGENTS.md) state the rule: local and remote paths behave the same. * fix(net): a local close drains what arrived, as a remote close does Rust lite and IETF and JS lite skipped the receive drain on a local close, so a pending lite fetch ended Dropped and a track whose FIN was already buffered aborted instead of finishing. Both closes now share one teardown. The lite JS update loop no longer leaves a rejected stopped promise unobserved when the session closes under it. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1372917 to
83e1479
Compare
Keep the always-abort cleanup path and drop SubscriberDriver::close, which #7081 folded into abort. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Finishes quest/m1/cut-audit/js-close-cause.md and deletes it with its link in the cut-audit epic.
moq-dev/moq#6978 left one choice open: whether a deliberately closed session's received tracks end cleanly or abort. The maintainer picked aborting, on a general rule: "I don't like stuff working differently locally and remotely." So a local close now ends received tracks exactly as the peer's clean close does, in Rust and JS, and moq-net's AGENTS.md states the rule.
What a session close looked like before
Measured with the integration tests below, before this change:
Error::Session(Cancel)Ok(None))Error::Session(Cancel)Error::Stream(StreamError::Session(Cancel)); IETF:Error::Session(Cancel)SessionError(SessionCode.Cancel)null, no end declaredSessionError(SessionCode.Cancel)StreamError(StreamCode.Cancel)SessionError(SessionCode.Cancel)StreamError(StreamCode.SessionClosed)After this PR, the local column matches the remote column everywhere: a session-cancel error, not a stream CANCELLED. The quest's alternative proposed
StreamCode.Cancel; I went with the session code because the remote path produces it and the instruction was to match remote exactly.Changes
close()path. A local close (drop or drain) now runs the same teardown a remote close does: drain what already arrived, thenabortwithError::Session(SessionError::Cancel). Before, it skipped the drain, so a pending lite FETCH endedError::Dropped.resume.rsno longer maps a copy that ended withStream(Session(Cancel))to a clean track end, andorigin.rsdrops its matchingTrackIo::closedflag. The IETF filled head now settles toFill::Doneon any session end, not only a local one, so both paths leave it in the same state.Subscriber.close(err)aborts tracks, fetches, and setup exchanges witherr, which defaults toSessionError(SessionCode.Cancel).Connection.abort()no longer ends received tracks itself;#rundrains what arrived and then fails them with the session's close, as on a remote close, so a track whose SUBSCRIBE FIN was already in flight still finishes.#runSubscriptionUpdates'sstoppedpromise also resolves when the subscribe stream errors: it used to reject with nothing listening once the session closed (an unhandled rejection onmaintoo, when the peer closes), and the response stream still decides the track's error. The IETF subscriber's#localCloseflag andclose()are gone, so a local close goes through the samesessionCausepath as a remote one.route_failed/routeFailed), so a replacement route takes over.resume.test.ts"a replaced copy whose session closed binds no end" now cancels the copy with the session error.subscription_end_integrity.rsandintegration.test.tsassert that a remote and a local clean close give the same session-cancel error on the track and its open group (lite-03/05/07, IETF 18/22 in Rust; lite-03/05, IETF 18 in JS). In Rust, a pending lite-05/07 FETCH gets the same error from either side's close. In JS,connection.test.tschecks that a local close drains a SUBSCRIBE FIN sent first (lite-01 to 04). Both new tests fail without the drain. Lite fetch-cut and auth-close tests move to the session error.rs/moq-net/AGENTS.mdgets the rule: local and remote paths behave the same. It also drops "or the local session closing" from what counts as a clean end.js/net/AGENTS.mdis new (no@moq/netagent file existed) and carries the same rule.Impact
Error::Session(SessionError::Cancel)/SessionErrorwithSessionCode.Cancel), as on a remote clean close, not cleanly. To migrate, treat a session-cancel error on a track as the session going away, as you already have to for the remote case. JS liteSubscriber.close()(internal) takes an optional error; the IETFSubscriber.close()(internal) is removed.Decisions
StreamCode.Cancel, but a remote close yields the session-cancel code in both languages, so local uses that to match remote exactly.Follow-ups
Stream(Session(Cancel)).Review
questhas noreviewcommand, so this stands in for/quest-review.0adb5ca6a6: two findings, both fixed in137291761d:abort()leaves them to#run's drain-then-fail.poll_drain, so a pending FETCH endedDropped. Fixed: Rust lite and IETF drain on either side's close.137291761d: no significant findings.Checks on
137291761d:just checkpasses,cargo test -p moq-netpasses, andbun testinjs/netpasses (2641/2641).(Written by Claude Opus 5.5)
🤖 Generated with Claude Code