Skip to content

feat(net): exclude a subtree from an origin consumer - #6932

Merged
kixelated merged 1 commit into
mainfrom
feat/origin-exclude
Oct 27, 2026
Merged

kixelated merged 1 commit into
mainfrom
feat/origin-exclude

Conversation

@kixelated

Copy link
Copy Markdown
Collaborator

Summary

origin::Consumer::exclude(prefix) returns a view that never reaches the subtree at prefix: announced() leaves out the routes at or beneath it, and request_broadcast, routed_broadcast and follow refuse paths there with Unauthorized. A route announced above the prefix is still reported; only the paths beneath it are refused.

Consumer: a relay that publishes its own local().with_hidden(true).scope(..) view to another relay, minus a platform-owned subtree. Today the only way to subtract paths is to mirror the view into a private origin and answer its requests with the session-only Request::accept, which #6496 rightly made crate-private. With exclude, that view is a plain composed Consumer published to the session, so serving by reference, route identity and egress attribution come from the normal session path.

Approach

  • OriginScope gains excluded: absolute subtrees, named as the handle sees them. permits refuses paths beneath one, which covers every request gate (request, routing, follow).
  • Discovery reuses the cursor holes that mounts already use. The consumer's own cursor gets the excluded prefixes; a mount cursor gets those beneath its mount point translated onto the target, and is dropped when one covers the mount point.
  • A prefix, not Patterns: Patterns is a reduced positive union with no set difference, and the subtree case is what holes already express.

Public API

  • moq-net (additive): origin::Consumer::exclude(prefix) -> Result<Consumer, Error>. allowed() is unchanged and does not reflect exclusions.
  • @moq/net: none. The JS Origin.Consumer has no local, mount or consumer-level hidden view either, and no consumer needs it.
  • Wire: none.

Tests

exclude_hides_and_refuses_the_subtree (discovery, all three request paths, a covering route, segment boundaries) and exclude_reaches_into_a_mount (an exclusion inside a mount, over a mount point, and under a mount-rooted handle).

(Written by Claude Opus 5.5)

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-27T19:35:01.949682Z e8703e4 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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)

Reviewed commit: e8703e4

No actionable bugs found. Exclusions survive scoping, are checked in handle-side coordinates before mount resolution/shared-front reuse, and reach discovery through translated cursor holes. Keeping covering routes visible while refusing excluded requests matches the documented contract.

Direction: a small, additive subtree API reusing existing authorization and discovery machinery is simpler than mirroring an origin or extending positive Patterns with set difference. The unchanged allowed() semantics are explicitly documented.

Useful additional regression coverage: exclude before further scoping, repeated exclusions, and request/follow/routing refusal through a mount (the new mounted test covers discovery).

Verification: static inspection of the changed code, surrounding scope/mount/cursor/request paths, and added tests; tests and builds were not run.

@coderabbitai

coderabbitai Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

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: 239d5a20-8de8-427c-9ee5-ca852a668c27
Commits

Reviewing files that changed from the base of the PR and between 000e109 and e8703e4.

Files selected for processing: 1
  • rs/moq-net/src/model/origin.rs

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

Walkthrough

OriginScope now stores excluded subtrees and applies them to path authorization and announcement cursors. The new Consumer.exclude method returns a cloned consumer with the rooted prefix excluded. Exclusions also apply to mounted scopes. Consumer.follow and Consumer.routing reject paths that are not permitted. Tests cover exclusions for ordinary consumers, mounted consumers, and consumers scoped inside a mount.

Priority: Normal

Merge Risk: Minimal · up to e8703

No actionable issue remains; the change is ready to merge after normal checks.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: adding subtree exclusion for an origin consumer.
Description check Passed The description directly explains the new Consumer::exclude API, its behavior, implementation approach, and tests.
Docstring Coverage Passed Docstring coverage is 91.67% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surviv…
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: Docstring Coverage

Explanation

Docstring coverage is 91.67% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 12 functions across 1 files.

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

Comment @coderabbitai help to get the list of available commands.

@kixelated

Copy link
Copy Markdown
Collaborator Author

Landing e8703e4. The maintainer accepted the new origin::Consumer::exclude(prefix) export as shaped. Reviews on this head are clean: Codex thumbs-up, CodeRabbit with no actionable comments, and the OpenAI review found no bugs (its extra coverage ideas, such as exclude-before-scope and refusal through a mount, are optional follow-ups). CI passed 10/10, the merge state is clean against main, and quest check passes.

(Written by Claude Opus 5.5)

@kixelated
kixelated added this pull request to the merge queue Oct 27, 2026
Merged via the queue into main with commit f34742b Oct 27, 2026
10 checks passed
@kixelated
kixelated deleted the feat/origin-exclude branch October 27, 2026 23:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant