Repository navigation
fix(net): a minted source enforces its own request validity - #6748
Conversation
Quest-Claim: e1e56c8aa0a778eb
The session that mints a source for a dynamic request now hands its RequestValidity to the source itself. Once the route is replaced or the selection period retires, the source's request stream ends: queued and later track requests answer Unroutable, and tracks it already accepted run to their own end. Sessions read per-operation validity from the source instead of threading their own copy. Also drops the unread `OriginConsumer.broadcasts` wire getter in @moq/net and the uncalled group::Producer::poll_unused, and finishes the quest. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou'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 42 minutes. View limit details
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. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed commit: 76a5fdd
No actionable bugs found. Enforcing source validity at track-request admission is the right direction: stale sources close and reject queued/new requests while accepted tracks can drain. Checking validity outside the broadcast lock avoids reversing the origin/broadcast lock order, and retaining per-operation checks protects requests already handed to a session. The internal JS registry cleanup does not change the advertised routing table.
Verification: static review of the changes and surrounding selection-period, wakeup, source-close and session-draining code. I did not run tests or interoperability checks. The new regression directly covers route-token expiry; broader selection-period behavior was inspected rather than executed.
Problem
A source minted for a dynamic request only stopped serving a stale instance if its session remembered to compute a
RequestValidityand check it on each operation. Until a track request reached such a check, a stale source stayed open and cached, so later requesters were handed a broadcast whose every new track failed.Approach
origin::Producer::create_source(path, validity)stores the validity on the source's producer side (broadcast::Alive).broadcast::Dynamic::poll_requested_trackchecks it. Once the route is replaced or the selection period retires, the source closes. Queued and later track requests getUnroutable, the request stream ends, and tracks already accepted keep running to their own end. The poll registers on the validity, so the source closes promptly even when nothing is requested. Its front then reselects instead of keeping a dead source.MintedSource/SourceServelose theirvalidityfield, and per-operation checks (TRACK info, SUBSCRIBE, FETCH, TRACKS) readdynamic.validity()from the source. Those checks stay because a request handed out before the lapse can still go upstream after it.wire.tsOriginConsumer.broadcasts, which was registered but never read. Its tests now useadvertised(the table a session announces from) or were dropped.group::Producer::poll_unused, which had no callers.group::Producer::abort_unusedis called only by tests, so itsallowreason now says so and the dead-code audit quest (quest/m2/audit-dead-code.md) owns it.Choices made unattended:
answer_source, the unused-race family,empty,withdrawn, JSfallback/requested).Impact
pub(crate)or behind the internalwireregistry in@moq/net.Unroutableon every new track.Validation
model::broadcast::test::a_lapsed_source_refuses_new_tracks. It fails without the check inpoll_requested_trackand passes with it.a_listing_of_a_retired_instance_never_reaches_the_wire: the serve task now ends with the source.just rs test -p moq-net: 3201 passed.bun test src/origin.test.ts: 94 passed.just check: passed (8869 tests). One SLOW test,moq-cli report::export_echo_reports_where_the_import_solicits, is unrelated to this change.quest check --base origin/main: ok.just test interop(no wire change).Finishes and deletes
quest/m1/api-audit/answer.md.(Written by Claude Opus 5.5)
🤖 Generated with Claude Code