Skip to content

fix(net): a mount closes under its session's scope - #8983

Merged
kixelated merged 2 commits into
mainfrom
quest/m2/cluster-routes/mount-scope
Nov 17, 2026
Merged

kixelated merged 2 commits into
mainfrom
quest/m2/cluster-routes/mount-scope

Conversation

@kixelated

@kixelated kixelated commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Finishes quest/m2/cluster-routes/mount-scope.md (deleted here).

Summary

Stream::mount files a mount's key with scope: None, since a mount hears nothing. When a scoped lite-07 session closed with a mount open, Router::disconnect took the mount's key for an unscoped session's and doubted the Node ID the scoped peer declared. A scoped peer names itself as it likes, so it must not be trusted to speak for that node.

Router::disconnect now reads each closing key's scope from the session it answers (listen), before any key goes, instead of from the key's own link. That covers both cases from the quest's Plan: the mount needs no copy of the scope, and a permit that changes the session's scope after a mount opened (relink) still applies at close. A copy on the mount's link would have gone stale on such a relink.

Decisions

  • Picked the quest's second option (the close reads the session's scope) over filing the scope on the mount's key: the scope can change mid-session through relink, and the mount's link is never relinked.

Validation

  • New test a_session_closing_with_its_mounts_doubts_only_if_unscoped (rs/moq-net/src/route/node/tests.rs) sweeps scoped and unscoped sessions, with and without a mount, setting the scope after the mount opened. Before the fix it failed on scoped true, mounted true (1 doubt, expected 0); after, it passes, and an unscoped session still doubts its declared ID.
  • cargo test -p moq-net: 1607 passed. just check: passed.
  • The verify-route TLA+ model has no mounts or scoped grants (its Scoped set narrows interest), and the rule a scoped close follows is unchanged, so it was not re-run.
  • Not exercised over a live lite-07 session: there is no harness exposing a relay's doubts at that level. The node test covers the node plus router, where the bug lived.

Public API / Wire

None.

Caused by

  • moq-dev/moq#8835 - filed a mount's key with scope: None, so a scoped session's close through it doubted the declared Node ID (found by reviewer).

Follow-ups

None.

Models

Size: S
Implementer: Claude, claude-opus-5-5, unknown effort (arm A)

(Written by Opus 5.5)

Review

Rewritten by quest review after each round.

  • Head: d65ca7c

  • Base: origin/main at c7da5e2

  • Risk: medium, the base has no RISK.md to name what is always high or customer-facing, so every change is medium

  • Classified: medium by default

  • Reviewer: Codex, gpt-6.1-sol, medium effort

  • Session: 01a1e6ce-9dd0-7de0-b0f5-303957aed78f, round 1

  • Score: 9/10, The fix preserves scoped isolation and unscoped disconnect behavior, with no actionable defects found through source review; builds and tests were intentionally not run.

  • Rounds: 1; first round 0; findings 0: fixed 0, refuted 0, open 0

  • Findings: none

kixelated and others added 2 commits November 16, 2026 15:41
A scoped session's mount filed its key with no scope, so the session closing
through it doubted the Node ID the scoped peer declared. The router now reads
each closing key's scope from the session it answers, as it stands at close.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title A mount files under its session's scope fix(net): a mount closes under its session's scope Nov 17, 2026
@kixelated
kixelated marked this pull request as ready for review November 17, 2026 00:02

@kixelated kixelated left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review by review (OpenAI)
Head: d65ca7cbcdedeb4347ccc6ce58fccd31e09f9baa

No blocker found. Snapshotting the listener's current scope before removing any keys makes close order irrelevant and respects a permit relink after the mount opened. Scoped closes still withdraw the individual routes without casting node-wide doubt; unscoped closes retain that signal. Dropping a mount by itself still goes through retire, so it does not report a closed session. The new test covers the original false doubt. Static review only; I did not rerun the reported tests.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

Reviewed how a lite-07 session's close decides whether to doubt its declared Node ID when mounts of that session are open.

  • Scope read from the session, not the key — Router::disconnect looks up each closing key's scope through listen before removing any key. A mount filed with scope: None now follows its scoped session and casts no doubt.
  • Ordering holds — Stream::drop for a main key passes the main key and every mount to close(keys, true) in one call. Because the scope is read up front, it doesn't matter whether the main key or a mount is removed first. A relink that changes scope after the mount opened is also picked up at close.
  • Test — a_session_closing_with_its_mounts_doubts_only_if_unscoped sweeps scoped/unscoped against mounted/unmounted, with the scope set after the mount opened, and checks the doubt count.

Pullfrog  | View workflow run | Using claude-opus-5-5 | 𝕏

@coderabbitai

coderabbitai Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Router.disconnect now determines closure behavior from the scope of the session returned by listen(neighbor). It records suspicion and reports Closed for unscoped sessions, but not for scoped sessions. A new test covers scoped and unscoped sessions, with and without mounts. The Stream::mount comment now describes the mount’s session scope, and the related quest document was removed.

Merge Risk: Minimal · up to d65ca

This change fixes how a closing mount is treated when its session is scoped, so scoped sessions no longer cause spurious doubts. It has no public API or wire changes and is covered by a new test. Merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: a mount now closes under its session's scope. The changeset makes Router::disconnect read each closing key's scope from the session it answers, which matches this ti…
Description check Passed The description matches the changeset. It explains the cause (Stream::mount files keys with scope: None), the fix (Router::disconnect reads scope from the session via listen), the new test `a_…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: a mount now closes under its session's scope. The changeset makes Router::disconnect read each closing key's scope from the session it answers, which matches this title. The title is short, specific, and in the conventional-commit form the repository uses.

Full details: Description check

Explanation

The description matches the changeset. It explains the cause (Stream::mount files keys with scope: None), the fix (Router::disconnect reads scope from the session via listen), the new test a_session_closing_with_its_mounts_doubts_only_if_unscoped, and the deleted quest document. It also covers validation and public API impact.

Finishing Touches

Simplify code

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 778772b6-543f-4ec2-a69d-975618627272
Commits

Reviewing files that changed from the base of the PR and between ba9c4c6 and d65ca7c.

Files selected for processing: 4

  • quest/m2/cluster-routes/mount-scope.md
  • rs/moq-net/src/route/node.rs
  • rs/moq-net/src/route/node/tests.rs
  • rs/moq-net/src/route/path.rs
Files with no reviewable changes: 1

  • quest/m2/cluster-routes/mount-scope.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.

@kixelated
kixelated added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit 54bb59d Nov 17, 2026
10 checks passed
@kixelated
kixelated deleted the quest/m2/cluster-routes/mount-scope branch November 17, 2026 00:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant