Skip to content

quest: plan linear route show cost for lite-07 sessions - #8385

Merged
kixelated merged 1 commit into
mainfrom
quest-plan/router-show-quadratic
Nov 9, 2026
Merged

kixelated merged 1 commit into
mainfrom
quest-plan/router-show-quadratic

Conversation

@kixelated

@kixelated kixelated commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

Plans Showing an identity's claims costs the claims that changed in the m2 routes epic. This is the follow-up moq-dev/moq#8352 suggested: its session bench measured lite-07 setup at 4096 broadcasts at 4.9 s of CPU, against 0.5 s for lite-06, and traced it to a quadratic route show for one identity with many claims. The quest re-measures after moq-dev/moq#8374 first, and deletes itself if that already fixed it.

Decisions

Settled in /quest-complete on 2026-11-09 by the maintainer:

  • Milestone: ✅ m2, under cluster-routing/routes (rejected: m4, dropping it).

Impact

Quests only. Wire: none.

Models

Size: M
Implementer: Claude Code, claude-opus-5-5, high effort

🤖 Generated with Claude Code

(Written by Claude Opus 5.5 with high effort)

Review

Rewritten by quest review after each round.

  • Reviewer: Codex, gpt-6.1-sol, medium effort
  • Session: 01a1c1f5-9365-7980-ae1b-75aaf8f2b636, round 1
  • Head: 4229dc1
  • Base: origin/main at 56902e9
  • Score: 10/10, The change only adds a scoped performance follow-up plan and links it from the parent quest, with no runtime changes or actionable defects.
  • Findings: none

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated marked this pull request as ready for review November 9, 2026 22:49
@kixelated
kixelated added this pull request to the merge queue Nov 9, 2026

@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 head: 4229dc1

No actionable findings in the two-file quest-plan change.

Direction: re-measuring before adding another optimization is appropriate. At this head, Router::show already uses the dirty-claim set when dirty.all is false, so the plan's explicit option to record the measurements and delete the quest avoids duplicating #8374's work. The claims-per-identity × claims-changed sweep makes any remaining cost measurable without expanding public API or wire scope.

Limits: GitHub-only static review of the changed documents, relevant route source, and linked PR context. Benchmarks, tests, and quest tooling were not run; the historical timing figures were not independently reproduced.

(Written by unknown model; model and effort are not exposed by this review environment.)

@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 critical issues — one plan-accuracy suggestion inline.

Reviewed changes

  • New m2 quest show-cost.md — plans making lite-07 session setup/teardown linear in broadcasts, and deletes itself if the re-measure shows #8374 already fixed it.
  • Routes index entry — adds the quest to quest/m2/cluster-routing/routes/README.md under ## Required. The title, size ([M]), ## Goal/## Plan sections, and Public API/Wire closer match the tree's conventions, and the epic membership is valid.

The only concern is that the plan's diagnosis and fallback may already be implemented; details are on the added lines.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

Comment on lines +27 to +30
Re-measure on current main first. If #8374 already made it linear, record the
numbers in the PR and delete this quest. Otherwise keep what `show` derives up
to date per changed claim instead of recomputing it, and add a route-bench
case swept over claims per identity and claims changed.

@pullfrog pullfrog Bot Nov 9, 2026 •

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.

Suggested change
Re-measure on current main first. If #8374 already made it linear, record the
numbers in the PR and delete this quest. Otherwise keep what `show` derives up
to date per changed claim instead of recomputing it, and add a route-bench
case swept over claims per identity and claims changed.
Re-measure on current main first. If #8374 already made it linear, record the
numbers in the PR and delete this quest. Otherwise locate the hot path with the
existing route-bench sweeps (and a profile if they stay flat) before changing
`show`, then add a case only if none of the current sweeps covers it.

The fallback here describes work that already exists: Router::show takes the Dirty { all, claims } short-circuit and recomputes only dirty.claims unless the identity's context changed, and the existing route bench already sweeps both relevant shapes (watched/unwatched over claims × streams, received over claims × changes). Because #8374 merged before this commit, its published received numbers (10,000 claims × 1: 4.77 ms → 1.58 µs) suggest the re-measure may be the whole task. If the cost survives, the plan should name how to find the real hot path (Node::home and the view merge are the other candidates) rather than prescribe code that already ships.

Technical details
# `show` is already incremental; `routes` already has both sweeps

## Affected sites
- `rs/moq-net/src/route/mod.rs:348` — `Dirty { all, claims }`, the state that makes `show` per claim.
- `rs/moq-net/src/route/mod.rs:1450` — `update` sets `dirty.all` only when the identity's `Ctx` changed.
- `rs/moq-net/src/route/mod.rs:1779` — `show` computes `shown_now` only over `dirty.claims` unless `all` is set.
- `rs/moq-net/benches/routes.rs:3` — `watched`/`unwatched` already sweep one origin claim change over claims × streams.
- `rs/moq-net/benches/routes.rs:9` — `received` already sweeps claims × changes, added by #8374.
- `rs/moq-net/benches/session/mod.rs:1976` — the `broadcasts` shape (16/256/4096) the plan cites.

## Required outcome
- If the re-measure is still superlinear, identify the actual hot path before prescribing a fix, and update the fallback so it does not repeat behavior that already ships.
- If the re-measure is linear, the plan's own instruction says to delete the quest; recording the measurement here and doing that avoids adding a cut-blocking m2 child for work #8374 may have finished.

## Open questions for the human
- Is #8374's `routes/received` result enough to close this without a fresh session-bench run, or does the session bench exercise a path the route bench does not?

@coderabbitai

coderabbitai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Walkthrough

Adds a required entry to the routes README that links to a new document about lite-07 session setup and teardown costs. The document records prior benchmark measurements and describes a conditional plan to re-measure current behavior. It states that no public API or wire changes are expected.

Merge Risk: Minimal · up to 4229d

The change adds a benchmarking plan without changing runtime behavior. No material merge risk is established.

Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title clearly describes the quest to plan a linear route show cost for lite-07 sessions.
Description check Passed The description explains the performance issue, the planned re-measurement, and the quest’s scope.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
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

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 0 files. (2 skipped: 2 unsupported.)

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

@coderabbitai coderabbitai 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.

Additional comments: 1

quest/m2/cluster-routing/routes/show-cost.md-29-29: 1

29-29: Minor · Functional Correctness · Quick win

Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

Update the proposed fix for the current implementation.

show in rs/moq-net/src/route/mod.rs already recomputes only dirty.claims when dirty.all is false; it scans all claims when dirty.all is true. If the re-measurement remains superlinear, profile the affected path and identify why it scans all claims instead of directing the implementer to add the existing incremental path. (raw.githubusercontent.com)

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: 6aaa5ad8-734a-4d68-aa7e-ca4a50e697ab
Commits

Reviewing files that changed from the base of the PR and between 56902e9 and 4229dc1.

Files selected for processing: 2

  • quest/m2/cluster-routing/routes/README.md
  • quest/m2/cluster-routing/routes/show-cost.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.

Merged via the queue into main with commit bae5ef2 Nov 9, 2026
10 checks passed
@kixelated
kixelated deleted the quest-plan/router-show-quadratic branch November 9, 2026 23:06
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