Repository navigation
feat(c)!: announce through moq_announce_route - #7151
Conversation
Quest-Claim: 1417eb6910044f43
moq_publication_announce takes a cost and an optional UUIDv7 epoch, matching moq-ffi's MoqAnnounceRoute, so a C publisher can announce a restart and can no longer claim relay hops. moq_mint_epoch mints the epoch, and moq_route now describes the received route each moq_announce_event carries. 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 34 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: a64b5a5.
No actionable bugs found in the changed code. Separating publish inputs from observed routes is the right direction: callers can supply cost/epoch without forging relay hops, matching the existing moq-ffi conversion. The fixed-length mint API reuses Epoch validation/generation, and received route pointers borrow allocations owned by the announcement record until it is freed. Keeping the received-route struct is justified by exposing restart identity and routing information. The C signature/layout break is explicitly documented.
Verification: static review of the diff, announcement ownership/lifetime, FFI string parsing, Epoch implementation, header-generation setup, and moq-ffi counterpart. I did not build the generated C header, run tests, or verify received relay-hop behavior; that integration coverage remains a documented gap.
|
Merging at head
(Written by Claude Opus 5.5) |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#7151 landed on main and already fills moq_route's epoch for every received announcement, so the planned receiving-side quest has no work left. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Problem
Since moq-dev/moq#7044, a C publisher announces with
moq_publication_announce, which took the sharedmoq_route. That struct had no epoch, so a C publisher could not announce a restart, and it accepted any caller-supplied hops, so a local publisher could claim relay hops it never took. moq-ffi'sMoqAnnounceRoutealready carries only a cost and an epoch. C also had no way to mint an epoch, somoq_broadcast_request_prepareneeded one generated by hand.Approach
Quest:
quest/m1/c/announce-route.md(deleted here, finished).moq_announce_route { cost, epoch, epoch_len }mirrorsMoqAnnounceRoute.moq_publication_announcetakes it; NULL or zeroed is still the default route. An epoch that is not canonical UUIDv7 text fails withMOQ_ERROR_INVALID_CONFIG.moq_mint_epoch(char *dst, size_t dst_len)writesMOQ_EPOCH_LEN(36) bytes of fresh UUIDv7 text, like moq-ffi'smoq_mint_epoch.moq_routenow describes a received route:moq_announce_eventgains a trailingroutefield (hops,cost,epoch), borrowed from the announcement likeprefixandcaptures. Before this, no call returned amoq_route, so it had nothing to describe once announcing moved off it.MOQ_ANNOUNCE_KIND_RESTARTcarrying the new epoch. The anonymous-hop announce test is gone along with announced hops.doc/lib/cgains a short Publish sample (compiled byjust rs c-tests), and thers/moq-cREADME lists the new signature.Unchanged:
c/moq's probe, the C++ package, and the OBS plugin already announce through moq-ffi's generatedAnnounceRouteandmint_epoch.Choices made without asking (open to review):
moq_routeintomoq_announce_eventinstead of deleting it. This keeps the planned "stays for received routes" role and matchesMoqAnnounce.route. Deleting it would be smaller, but C subscribers would then have no way to see an epoch or hops.moq_routeleaves out moq-ffi'sanonymousflag, since a C caller can find it by scanninghopsfor a 0.moq_mint_epochwrites into a caller buffer sized byMOQ_EPOCH_LENand returns the length, rather than returning a struct by value. This matches how other C inputs takeconst char *plus a length.MOQ_ERROR_INVALID_CONFIG. I did not add a dedicated code like moq-ffi'sInvalidEpoch.MIGRATE.mdedit, since the rootAGENTS.mdsays only the release cut writes those sections. The Impact bullet below is the migration note.Impact
moq_publication_announce(uint32_t, const moq_announce_route *)replacesconst moq_route *. Migrate&(moq_route){.cost = c}to&(moq_announce_route){.cost = c}and drop anyhops, which the origin now builds. To announce a restart, mint a fresh epoch per run withchar e[MOQ_EPOCH_LEN]; moq_mint_epoch(e, sizeof e);and set.epoch = e, .epoch_len = sizeof e. Viewers then seeMOQ_ANNOUNCE_KIND_RESTARTinstead of a stalled broadcast.moq_routeloses its role as an input and gainsmoq_string epoch.moq_announce_eventgains a trailingmoq_route route. Rebuild against the new header.moq_mint_epoch,MOQ_EPOCH_LEN,moq_announce_route.Alternatives
moq_route, or validate hop values. The maintainer rejected both on 2026-10-28 in favor of a separate struct that mirrors moq-ffi.moq_routeoutright, as described above.Follow-ups
moq_broadcast_request_preparereports a malformed epoch asMOQ_ERROR_INVALID_CODE, which reads as wrong.MOQ_ERROR_INVALID_CONFIGwould matchmoq_publication_announce. This is a small break, so I left it out of this PR.Checks:
just cipassed locally. So didjust rs c-tests(C fixtures plus doc samples against the generatedmoq.h),cargo test -p moq-c(149 passed),cargo clippy -p moq-c --all-targets --all-features -D warnings, andquest check --base origin/main.(Written by Claude Opus 5.5)
🤖 Generated with Claude Code