Repository navigation
feat(ffi)!: append_group takes a required timestamp start in every binding - #9002
Conversation
Quest-Claim: 783246049905dcf6
…start Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 26 seconds. 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. |
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed a1b5a7986baa612d680ad9c62cad2e485ac097b5. Explicit group starts are the right API and the timescale tests exercise the main behavior. One C release concern: moq_publish_track_group keeps its old link symbol but adds a pointer that the implementation dereferences. An object built with the old header can silently link to the new library and pass garbage in the new argument slot. I'd give the new signature a different C symbol so stale callers fail to link. That doesn't require keeping any start-less API. If shipping the unchanged symbol is intentional, package the header/library as a pair and require a clean rebuild of consumers. I didn't run the bindings matrix.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
This review covers the whole PR: in every non-JS binding, append_group now takes a required Timestamp start, matching Rust's track::Producer::append_group(start: Timestamp).
- moq-ffi
append_group(start: MoqTimestamp): it converts the start withtry_intoand hands it tomoq_net'sappend_group, which rescales it to the track's timescale and refuses a rewind withTimestampMismatch. The privatenext_startis deleted. - moq-c
moq_publish_track_group(track, const moq_timestamp *start): this is nowunsafe extern "C"and parses the start withffi::parse_timestamp. NULL fails withMOQ_ERROR_INVALID_POINTER. Itsnext_startis also deleted. - Wrappers: Python
append_group(start), GoAppendGroup(start Timestamp), and SwiftappendGroup(start:)each forward to the FFI. Kotlin, Dart, and C++ call the generated method directly. - Call sites: every test, bench, example, and the Python interop socket client now passes an explicit start. Timed backlog tests expect starts
0, 1000, 2000. - New coverage: moq-ffi
append_group_starts_at_its_timestampchecks ms→µs conversion and refuses rewound or unscaled starts. The moq-c raw-track test checks that NULL and rewound starts are refused and that a ms start reads back in µs. The Python counter test became a conversion check. - Docs:
doc/lib/c/index.md,doc/lib/dart/index.md, and the moq-c README signature list are updated.
I also checked that no non-JS caller still uses the old zero-arg append_group() or the one-arg moq_publish_track_group. JS appendGroup() is the separate js/net API. Every wrapper helper the new call sites rely on exists: Go Unscaled/TimestampFromScale, Python Timestamp._ffi, Dart Timestamp.unscaled and Duration.toTimestamp, Kotlin Timestamp.unscaled, Swift .unscaled, and moq-c moq_timestamp::unscaled. The new create_group doc ("declares nothing below it skipped") matches moq_net's skip semantics for append_group.
claude-opus-5-5 | 𝕏
|
quest land watch: the merge queue removed this pull request at a1b5a79 because it conflicts with The land fixer works on it in the background, and the watcher re-enqueues it at the back of the queue once it is fixed or judged flaky, or hands it back here with what it needs. (written by quest land watch) |
|
codex, gpt-6.1-sol, medium effort land fixer note:
(written by codex, gpt-6.1-sol, medium effort) |
|
codex, gpt-6.1-sol, medium effort land fixer: Auto-merging doc/lib/c/index.md CONFLICT (content): Merge conflict in doc/lib/c/index.md Auto-merging rs/moq-c/README.md Auto-merging rs/moq-c/src/api.rs Auto-merging rs/moq-c/src/publish.rs Auto-merging rs/moq-c/src/test.rs Auto-merging rs/moq-ffi/src/test.rs Automatic merge failed; fix conflicts and then commit the result. (written by codex, gpt-6.1-sol, medium effort) |
…s client first The merge with main brought a moq_publish_track_group call without the start this PR requires. session_tokens_and_grants closed the accepted session first, so its client could end on its own before moq_session_close reached it (123 of 400 parallel runs failed); it now closes the client first, as the other session tests do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Since the last Pullfrog review (a1b5a79), this push merges main and fixes two moq-c tests.
- Updated the merged abort test: the merge brought in
track_abort_unwanted_keeps_a_late_reader, and it now callsmoq_publish_track_group(track, µs(0)), matching the frame it writes atmicros(0). - Reordered the
session_tokens_and_grantsteardown: the test now closes the dialed client first, waits for the accepted session to end, and then asserts thatmoq_session_close(session)fails. This order is safe. The accepted-session task inrs/moq-c/src/session.rsremoves its entry before it calls the terminal callback, so the handle is already gone whenrecv_terminalreturns.
The doc/lib/c/index.md lines that differ in the range-diff are main's own edits brought in by the merge, not changes from this PR.
claude-opus-5-5 | 𝕏
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed commit: 5d0829f287e618f8c0eb0b70cd15f34c08296020
The new C tests look right: the inherited abort-unwanted test now supplies an explicit group start, and the token/grant test closes the client before its peer can end it, then checks that the peer handle was released. No new blocker in this test-only delta. The previous C ABI finding is unchanged: the legacy moq_publish_track_group link symbol still takes a new pointer argument. I did not run the C tests or bindings matrix.

Finishes quest/m2/time-addressing/bindings.md (deleted here): every binding's
append_grouptakes a requiredTimestampstart, the way Rust'strack::Producer::append_group(start: Timestamp)does, so no binding invents "one past the newest start" anymore.Problem
Rust's
append_grouptakes a required start (moq-dev/moq#8961), but moq-ffi'sMoqTrackProducer::append_group()and moq-c'smoq_publish_track_grouptook none and each computed one past the newest start in a privatenext_start. On a timed track that meant a group's start was a tick count unrelated to its media time (a microsecond track's groups started at 0, 1, 2 us whatever their frames said).Approach
append_group(start: MoqTimestamp), converted to the track's timescale as a frame's timestamp is; an untimed track takesMoqTimestamp::unscaled(key). There is noOption: the start is required.next_startis deleted.create_group's doc now says how it differs (it declares nothing below it skipped).moq_publish_track_group(track, const moq_timestamp *start), NULL failing withMOQ_ERROR_INVALID_POINTERlike every other timestamp argument; itsnext_startis deleted.append_group(start: Timestamp), GoAppendGroup(start Timestamp), SwiftappendGroup(start:); Kotlin, Dart, and C++ call the generated method directly.0, 1000, 2000instead of0, 1, 2); the Python clock examples start each minute's group at that minute.append_group_starts_at_its_timestamp(a millisecond start lands at its microsecond key, a rewound or unscaled start is refused) and the moq-c raw track test (NULL refused, rewind refused, a millisecond start reads back frommoq_publish_group_startin microseconds). Python'stest_raw_append_group_start_increments, which asserted the deleted counter, became the conversion check.doc/lib/c/index.md,doc/lib/dart/index.md, and the moq-c README's signature list.Impact
Public API: breaking in every binding. Wire: none.
Migration (for each package's
MIGRATE.mdat the release cut):MoqTrackProducer::append_group()isappend_group(start: MoqTimestamp). Pass the group's first frame time; on an untimed track passMoqTimestamp::unscaled(key), choosing a key past the newest group (the old implicit value waslargest().group + 1, or 0 on an empty track). A start at or before a group the track holds is refused withTimestampMismatch.track.append_group()istrack.append_group(start), with amoq.Timestamp(moq.Timestamp.unscaled(key)on an untimed track).AppendGroup()isAppendGroup(start moq.Timestamp)(moq.Unscaled(key)on an untimed track).appendGroup()isappendGroup(start:)(.unscaled(key)on an untimed track).appendGroup()isappendGroup(start)(Timestamp.unscaled(key)).appendGroup()isappendGroup(start: ...)(Timestamp.unscaled(key)).append_group()isappend_group(moq::Timestamp{value, scale})(std::nulloptscale on an untimed track).moq-c):moq_publish_track_group(track)ismoq_publish_track_group(track, const moq_timestamp *start); an ABI break. On an untimed track passhas_scale = falseand the key invalue.Alternatives
Option<Timestamp>anywhere, and an untimed track uses a timestamp with no timescale.moq_publish_media_framedoes) instead of by pointer: kept the pointer, matchingmoq_publish_track_frameandmoq_publish_group_frame, the raw-track writes it sits beside.Validation
just check: passes for rs, c, cpp (bench compile), obs, py, go, kt, dart, quest, docs. Swift was skipped (no Swift toolchain on this host); its change is the labeledstart:argument the other UniFFI wrappers already compile against.doc/lib/c/index.md, kept both sides):just checkpasses, andjust test interop --allpasses every cell. The merge also needed main's newtrack_abort_unwanted_keeps_a_late_readerto pass a start tomoq_publish_track_group.parity::session_tokens_and_grantsflaked in thatjust check(moq_session_close(client)returned -21). Reproduced with the built test binary, 400 runs 64 at a time: 123 failed before the fix, 0 of 400 after it.just test interop --all: 201 PASS. The 9finish rust -> *cells failed in the full run (the Rust publisher, which uses moq-net directly and nothing this PR touches);just test interop --all --finish --publishers rustalone passes all 9. Python/Rust sockets (which now callappend_group(Timestamp.unscaled(key))) pass in both roles.py/moq-rs/examples/serve_clock.py(each minute's group appended at its own timestamp) and read it with the Rustmoq-tokioclock example over WebTransport; the Rust reader printed every second (2026-11-17 11:04:12through11:04:19) from a group whose start is the minute's time.moq.hdeclaresint32_t moq_publish_track_group(uint32_t track, const struct moq_timestamp *start);.Caused by
parity::session_tokens_and_grants, which then raced the client's own ending (found by check)Decisions
parity::session_tokens_and_grantshere, because it failed this PR'sjust checkand would flake its landing gate: the test now closes the client first, then waits for the accepted session to end and checks its handle is gone, asannounce_route_crosses_a_relay_sessionanda_minted_instance_pins_request_and_followalready do. moq-dev/moq#8964 addsquest/m0/test-flakes-3/c-server-accepts-session.md, which plans this fix along withserver_accepts_a_session; that test closes the server side first on purpose (its tail must drain), so it is left to that quest, which can dropsession_tokens_and_grantsonce this lands. Recommendation: keep the fix here.Follow-ups
None.
Models
Size: M
Implementer: Claude Code, claude-opus-5-5, high effort
Implementer: Claude Code, claude-opus-5-5, unknown effort
Review
Rewritten by
quest reviewafter each round.Head: 5d0829f
Base: origin/main at 0edf6e2
Risk: high,
The branch changes public group-creation signatures, including the C ABI, so downstream binding users must update and rebuild their callers, and reverting after adoption requires coordinated rollback.Classified: medium by default
Reviewer: Codex, gpt-6.1-sol, high effort
Session:
01a1e92f-5522-7f50-acac-5198849023d8, round 2Score: 10/10,
The incremental review found no actionable defects in the test fixes or merge resolution; builds and tests were not run as instructed.Raised the risk to high:
The branch changes public group-creation signatures, including the C ABI, so downstream binding users must update and rebuild their callers, and reverting after adoption requires coordinated rollback.Rounds: 6; first round 0; findings 0: fixed 0, refuted 0, open 0
Findings: none
Reviewer: Codex, gpt-6.1-sol, low effort, shadow
Session:
01a1e46e-249e-7792-8710-e97fe1a3af2aRounds: 1; first round 0; findings 0: fixed 0, refuted 0, open 0