Skip to content

fix(net): the router ranks one claim prefix's filings as one tier - #9610

Merged
kixelated merged 6 commits into
mainfrom
quest/m2/router-claim-tier
Nov 25, 2026
Merged

kixelated merged 6 commits into
mainfrom
quest/m2/router-claim-tier

Conversation

@kixelated

@kixelated kixelated commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

The lite-07 router now ranks every claim of one prefix as one tier, wherever each is filed, as model::origin and the moq-lite-07 draft's Resolution and Above text already do (moq-dev/moq#9371). A reachable claim is no longer shadowed by an unreachable copy of the same claim filed deeper, and a relay no longer refuses a request naming its own claim because a peer's copy of it is filed below.

Changes

  • Router::tier (rs/moq-net/src/route/relay.rs) gathers the claim the reader shows at the request path and at each filing above it. Each is lowered to the path (its Above counted from there) and only those of the best precedence are kept. Lowered, a claim's Above is the same at every filing of one prefix, so the existing precedence order is the tier rule: longest prefix first, then the newest epoch, reachable or not.
  • pick, step (own and named), and awaits resolve against the tier instead of stopping at the deepest filing. resolve takes the best claim_order across the tier's filings.
  • Router::filed gives the filing a request naming a node follows. That is the deepest filing of the tier where the node's claim is available (eligible). Otherwise it falls back to named: the node's best-lowered filing, preferring one whose claim this node knows available and some next hop other than the asker holds (lead), as ways gives a lane, then one where its claim is the one the reader shows there, which ways gives a lane. Node::forward (route/node.rs) now confirms the lane at that filing instead of the deepest lane of the claimant.
  • An endpoint or scoped neighbour asking at a prefix is told the claim a request there takes, from any filing in the tier. Below that prefix it is still told the claim filed at each path, as the origin's cursor presents it. A filing moving between rows is an in-place Live update, never a withdrawal. ways/primary stay per filing: the origin ranks primary lanes across filings by rank, which gives the same tier pick.
  • The route proof's README and Claim.agda header (comments only) now say that a claim filed above the destination reaches it lowered, so one prefix's filings rank as one tier. The algebra itself already ranked lowered claims by precedence, so no definition changed.
  • Removes the finished quest and its links (quest/m2/README.md, quest/m2/lite07-finalize.md's Required).

Public API and wire impact

None. Crate-private router only. No wire change; the router now conforms to the draft text, so the draft needs no edit. JS has no router (js/net is endpoint-only and already ranks tiers via bestOfTier), so there is no JS counterpart.

Caused by

  • moq-dev/moq#9371 - the origin began ranking a prefix's filings as one tier while the router kept the deepest filing. Relay R refused a request a downstream origin named it for when a peer's copy of R's claim was filed deeper (found by reviewer). The router's deepest-filing rule itself is older than that PR.

Decisions

Taken without the maintainer (afk). Each one is my recommendation:

  • No fall-through past a tier the asker sourced. At an asked prefix, if the tier's pick is the claim the asking peer itself gave, the peer is told nothing there. Before, the router fell through to the next broader filing. Per the draft, the winning tier is the whole answer, and the peer already holds a more specific claim of its own.
  • Inside an asked prefix, each filing still stands for itself. This matches TableCursor::best (routes.at). The receiver ranks the tier itself.
  • No change to the Agda definitions. The claim algebra already leads with lowered precedence, which is the tier rule. Only the comments and README changed, and just test route-proof passes.
  • A named request outside its tier prefers a copy a next hop holds (the local review's last finding, at next decide). ✅ Fix it as the reviewer suggested: among a node's equal-precedence filings, named ranks one some neighbour other than the asker holds available ahead of the one that wins where it is filed (rejected: accept the finding, since it needs a lane handover with an unavailable broader filing and a marked exact claim at once; drop the PR). Taken by the coordinator while the maintainer was afk.
  • Equal-precedence tie between two filings of one node's claim goes to the deeper filing. This applies in tier and named. It can only happen when one claimant holds two filings of the same prefix.

Validation

  • Reproduced first. Both new tests failed on the unfixed router:
    • a_claim_prefix_ranks_as_one_tier_wherever_filed (single router): step(me, src/a/b) returned None while node 5's deeper copy lived, and pick returned None after its route died.
    • a_request_named_by_the_tier_downstream_is_served_upstream (three routers P–R–D over the shared settle mesh): D picked P's deeper copy over R's cheaper claim, and R refused a request naming itself.
    • Both pass with the fix. The single-router test also covers: the narrow asker being told the reachable claim after the copy's route dies; a newer epoch filed deeper superseding the tier; and an exact narrower claim shadowing it.
    • a_named_request_outside_its_tier_follows_a_copy_a_next_hop_holds (added for the review's last finding): filed returned src, the node's unavailable broader filing, while a neighbour held its src/a copy. It passes with the fix.
    • a_named_request_outside_its_tier_follows_a_copy_known_available (from the next review session's round 2): with an exact claim at src/a/b and src/a revised unavailable while a lagging neighbour still held it, filed returned src/a, which has no lane. It passes with the fix.
  • cargo test -p moq-net --lib: 1697 passed.
  • Nightly-only exhaustive delivery-order searches, --include-ignored route::tests::multicast_search: 10 passed.
  • just test route-proof (Agda, through quest gate): passed.
  • just check: passed.
  • Not run:
    • The real surface: no lite-07 relay cluster with a narrow scoped grant (filing a claim with Above) was started. The shipped Router was exercised through unit and mesh tests only.
    • /verify-warm and /verify-failover: they abstract routing to one broadcast and to any live upstream winning, so neither models a filing (per the quest).
    • just test interop --all: no wire, moq-ffi, or gateway change.

Overlap

  • moq-dev/moq#9575 (superseded-epoch-front): touches model/origin.rs and js/net, not route/relay.rs. No conflict.
  • moq-dev/moq#9550 (on-demand drop): touches broadcast/track model code and bindings. No conflict.

For quest/m0/nightly/resume-route-mutants.md

New mutable code in route/relay.rs: tier, resolve, named, closest_of (now with an optional fixed precedence), and precedence_at. Likely equivalent mutants:

  • named's lowered < *best to <=: only flips which of one claimant's two equal-precedence filings is followed.
  • precedence_at's saturating_add to +: Above and depth are bounded by the 32-segment path.

The rest are killed by the two new tests and the existing request tests.

Follow-ups

None.

Models

  • Size: L
  • Implementer: Claude Code, claude-opus-5-5, unknown
  • Implementer: Claude Code, claude-opus-5-5, unknown (iterate, S)

🤖 Generated with Claude Code

(Written by Claude Opus 5.5)

Review

Rewritten by quest review after each round.

  • Head: 4a136a6

  • Base: origin/main at 4fab6f0

  • Risk: medium, A mistake in the rewritten lite-07 router tier logic in rs/moq-net/src/route/relay.rs and node.rs could make relays pick the wrong or no upstream for a request, failing requests for relay operators and their viewers who opt in to moq-lite-07-wip. It keeps the public API and wire format (the plan states no wire changes), and a revert fully undoes it, since it only changes shipped behavior before the next cut, so it is shipped-code behavior rather than a high-tier break.

  • Classified: medium by Claude Code, claude-haiku-5-5, low effort, session b801d996-d259-4197-a1fa-aa0e3d957a3a

  • Reviewer: Codex, gpt-6.2-sol, xhigh effort

  • Session: 01a21384-00a2-7301-b74c-ae8973a7ec42, round 3

  • Score: 10/10, Named requests now use the available filing when a lagging neighbor still advertises an unavailable deeper copy at the same precedence.

  • Rounds: 6; first round 2 (medium 2); findings 5 (medium 5): fixed 3, refuted 2, open 0

  • Findings: none

  • The last round's findings, at b1e071b:

    • Fixed: medium, rs/moq-net/src/route/node.rs:1040: Select the named filing and its serving lane together; `named()` now ranks the locally unavailable `src/a` below the live `src` filing at equal precedence (`rs/moq-net/src/route/relay.rs:2665`), and the regression test checks the selected filing, next hop, and serving lanes.

kixelated and others added 2 commits November 25, 2026 04:50
The lite-07 router resolved a request against the deepest filing its reader
showed, so a reachable claim was shadowed by an unreachable copy of the same
claim filed deeper (Above), and a relay refused a request naming its own
claim when a peer's copy of that claim was filed below it, though the origin
and the draft already rank every filing of one prefix as one tier.

`Router::tier` lowers each covering filing's shown claim to the request path
and keeps those of the best precedence, so pick, step, awaits, and what an
endpoint or scoped neighbour asking at a prefix is told all follow the claim
the draft's Resolution picks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title The router ranks one claim prefix's filings as one tier fix(net): the router ranks one claim prefix's filings as one tier Nov 25, 2026
kixelated and others added 2 commits November 25, 2026 06:58
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…holds

Among a named node's equal-precedence filings, `Router::named` now ranks
one some neighbour other than the asker holds available ahead of one that
wins where it is filed, so a request is not refused when a broader filing
is unavailable while a deeper copy of the same claim has a lane.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated

Copy link
Copy Markdown
Collaborator Author

Design change: taking the local reviewer's recommendation for the last finding (next decide, picked by the coordinator while the maintainer is afk). Among a named node's equal-precedence filings, Router::named now ranks one a next hop other than the asker holds available (lead) ahead of the one that wins where it is filed. filed takes the asker so Node::forward confirms the same filing's lane. Regression test a_named_request_outside_its_tier_follows_a_copy_a_next_hop_holds failed before the fix. Head b1e071b.

(Written by Claude Opus 5.5)

…able

`Router::named` now counts a filing as served only where this node knows
the claim available and a next hop holds it, as `ways` gives a lane, so a
lagging neighbour still holding a copy this node learned unavailable no
longer pulls a named request to a filing with no lane.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated marked this pull request as ready for review November 25, 2026 17:09
@coderabbitai

coderabbitai Bot commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You'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 13 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

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: 7c765812-12dd-44c1-be6d-61d7816427d2
Commits

Reviewing files that changed from the base of the PR and between 9ad7001 and 4a136a6.

Files selected for processing: 7

  • quest/m2/README.md
  • quest/m2/lite07-finalize.md
  • quest/m2/router-claim-tier.md
  • rs/moq-net/src/route/node.rs
  • rs/moq-net/src/route/relay.rs
  • rs/moq-net/verify/route-algebra/Claim.agda
  • rs/moq-net/verify/route-algebra/README.md
  • 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

@kixelated
kixelated added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit 769673d Nov 25, 2026
9 checks passed
@kixelated
kixelated deleted the quest/m2/router-claim-tier branch November 25, 2026 17:28
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