Repository navigation
Conversation
There was a problem hiding this comment.
ℹ️ Minor suggestions only.
Reviewed changes
announce::Eventaccessors: addsannounce(),into_announce(), andis_end()toAnnounceEvent, each an exhaustive match, so a new variant fails to compile rather than silently falling through.- Adoption in moq-net:
lite/replay.rsderives the active flag and the update from the accessors, andFollow::foldreplaces its five-variant or-pattern withannounce(). - Changelog: the additive API is listed under
## Unreleased.
ℹ️ The adoption claim stops short of the rest of moq-net
The body says the accessors are used "where moq-net's own source spelled out the pattern", but three production sites still spell it out, two of them in the origin.rs this PR edits. That leaves the claim slightly overstated; converting them here or rewording the body would keep it accurate.
Technical details
# Remaining or-patterns in moq-net production code
## Affected sites
- `rs/moq-net/src/model/origin.rs:6236` — `Requesting::poll_ok` splits `AnnounceEvent::End(_)` from the other four variants and only reads `announce.route.instance`, so it can branch on `event.is_end()` and then take `event.announce()`.
- `rs/moq-net/src/model/origin.rs:7353` — `AnnounceConsumer::hand_out` splits `End` from the rest and only reads `announce.prefix`, same shape.
- `rs/moq-net/src/model/follow.rs:97` — `self.idle = matches!(event, AnnounceEvent::End(_))` is exactly `event.is_end()`.
## Required outcome
- Either migrate these three sites to the new accessors in this PR, or name them in the body's Follow-ups so "where moq-net's own source spelled out the pattern" matches what landed.deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏
|
No actionable comments were generated in the recent review. WalkthroughAnnounceEvent adds methods to borrow or consume its Announce and to check whether an event is End. Replay initialization, Follow::fold, and take_prefix use these methods instead of matching event variants. The Unreleased changelog documents the helpers. Merge Risk:
|
Every variant carries an `Announce`, so readers that only want the route spell out a five-way or-pattern. `announce()`, `into_announce()`, and `is_end()` replace those patterns across moq-net's production code and are available to downstream relays reading `origin::Routes`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1789b5c to
83b0d89
Compare
|
Rebased onto main. #7678 turned the five-variant event into |
|
On scope: I looked at adding Every reader of If a real 🤖 Generated with Claude Code |
Switch the remaining five-way or-patterns that treat every live variant alike, in
moq-net, moq-relay, moq-stats, moq-gst, tests, and benches, to
RouteEvent::{announce, into_announce, is_end}. Matches that tell Start, Update,
Restart, or Takeover apart stay as they are.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@Frando: an API review of the open PRs and quests (moq-dev/moq#8214) proposes a different shape that removes the need for these accessors. Once moq-dev/moq#8063 deletes pub struct RouteEvent { pub kind: RouteKind, pub announce: Announce }
pub enum RouteKind { Start, Update, Restart, End }This mirrors JS's (Written by Claude Opus 5.5 with high) |
|
@Frando I took this over at the maintainer's request and settled the API (recorded under
(Written by Claude Opus 5.5 with medium) |
# Conflicts: # rs/moq-relay/tests/integration/goaway_cluster.rs
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed head 91aba4a.
No actionable findings. The borrowed and consuming accessors preserve every variant's Announce, including End's last advertised route, while is_end preserves the existing live/retracted split. The migrated snapshot, discovery, request and egress-accounting paths retain their previous behavior. This also addresses the earlier review's incomplete adoption concern without replacing matches that need variant-specific semantics.
Direction is sound for this additive API: centralize payload extraction and avoid cloning when the event can be consumed. Verification limits: GitHub-only static review of the full 34-file diff and surrounding RouteEvent definitions; no tests, builds or benchmarks run. GitHub currently reports merge conflicts, so this is not a claim that the branch is ready to merge. Rechecked open/non-draft state, full head/base and published reviews immediately before posting.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
origin::RouteEventaccessors: addsannounce(&self) -> &Announce,into_announce(self) -> Announce, andis_end(&self) -> bool, each an exhaustive match, so a new variant fails to compile instead of silently falling through.- Production adoption:
Follow::fold,OriginConsumerState::take_prefix,Routes::hand_out,Requesting::poll_ok,OwnClaims::local,lite/replay.rs, and both publishers now read the route and the ended state through the accessors, with the per-variant behavior unchanged. - Test and benchmark adoption: converts the repeated
next_update/await_eventhelpers and assertions across moq-net, moq-net-tests, moq-relay, moq-stats, moq-gst, and moq-tokio, including the End-first short-circuits that must not readrouteon a retraction. - Changelog: the additive API is listed under
## Unreleased/### Added, and the body's Impact section covers it.
deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏
|
@Frando quick update: (Written by Claude Opus 5.5 with medium) |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
This incremental review covers the delta since the prior pullfrog review at 91aba4a: head 81dffbc merges main (3ce26d1e4) into the branch and resolves the resulting test conflicts.
- Merge conflict in
goaway_cluster.rs: adopted the accessors in main's rewritten loop (!event.is_end() && event.announce().route.cost() != Cost::DRAIN) and dropped thenext_updatehelper main deleted, with no dangling callers left behind. memory::recordadoption: converted main's newly added helper's explicit five-variant match tolet active = !event.is_end(); let update = event.into_announce();, keeping the same active flag and prefix recorded.
Both conversions are behavior-identical to the code they replace, no conflict markers remain, and the only prior review thread (Follow::fold) is resolved.
deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏
|
Thanks for this, @Frando. Closing it for now. The final API audit is reshaping (Written by Claude Opus 5.5 with high) |

Problem
Every
origin::RouteEventvariant carries anAnnounce, but there is no way to get it without matching all five variants. Code that only wants the prefix or route, or only whether the route ended, repeats the or-pattern across moq-net, moq-relay, moq-stats, tests, benches, and downstream relays readingorigin::Routes.Approach
Add
RouteEvent::announce(&self) -> &Announce,RouteEvent::into_announce(self) -> Announce, andRouteEvent::is_end(&self) -> bool, and use them wherever a match only read the route or split onEnd: moq-net's production code (follow.rs,origin.rs,lite/replay.rs, both publishers), moq-relay'sweb.rslisting, and the tests, benches, and test helpers in moq-net, moq-net-tests, moq-relay, moq-stats, moq-gst, and moq-tokio. The secondmainmerge also converts the newmemory.rsrelay test helper and drops thenext_updatehelpermaindeleted fromgoaway_cluster.rs.Matches that tell
Start,Update,Restart, orTakeoverapart, or bindTakeover'spredecessor, stay as they are.This PR originally targeted
announce::Event. After moq-dev/moq#7678 that name is the two-variantPresent/Absentlisting, and the five-variant route event lives on asorigin::RouteEvent, so the accessors moved with it.Decisions
Decided 2026-11-07 by the iterate; the maintainer delegated the API choice to it.
announce,into_announce, andis_end, onorigin::RouteEvent(rejected: droppingis_endformatches!, droppinginto_announceforannounce().clone(), a combined(Announce, bool)accessor). Each has production callers:announceinFollow::fold,take_prefix,Requesting, andRoutes::hand_out;into_announceandis_endin both publishers' snapshots,replay::initial,Discovery::local, and moq-relay'sweb.rs.into_announceavoids cloning the route's captures;is_endpairs with it, since the event is consumed after.main'sRouteEventis unchanged since the PR was opened, and the final API audit (moq-dev/moq#8088) does not touch it. The nameannouncematches the payload type andTakeover's field;route()was rejected sinceAnnouncealready has aroutefield.announce::Event(rejected: addingannounce()/into_announce()), confirming Frando's comment. Every reader in the repo branches on the variant: hang's subscribe example, moq-bench, moq-c, moq-cli (announced.rs,archive.rs,report.rs,publish.rs), moq-ffi, moq-room, moq-tokio (origin.rs,server.rs,client.rs,clock.rs), and moq-webrtc. Most build(announce, present)straight from a two-arm match, which an accessor would not shorten.Impact
origin::RouteEvent::{announce, into_announce, is_end}. Additive, no migration. No wire change.Alternatives
Leaving the pattern to callers. The match is easy to get wrong when a variant is added, and
Takeover's struct form makes it noisy.Caused by
None: an API addition, not a fix.
Validation
just civiaquest gate: passed on 91aba4a, and again on 81dffbc after mergingmainModels
Size: S
Implementer: Claude Code, claude-opus-5-5, unknown effort
Implementer: Claude Code, claude-opus-5-5, medium effort
Review
quest review)Record written by hand:
quest reviewprintedrecord skippedfor this fork branch.🤖 Generated with Claude Code
(Written by Claude Opus 5.5 with medium)