feat(ffi): advertise JSON tracks in the catalog, add binary data tracks - #4137
Conversation
The moq-ffi mirror of moq-dev#4073. publish_json_snapshot / publish_json_stream now go through the broadcast's moq-mux catalog, so the catalog carries json.tracks.<name> (mode, and compression when set) for as long as the track lives and retires it on finish. New publish_binary_snapshot / publish_binary_stream expose moq-mux's binary data tracks with an optional mime. A name the catalog already carries is refused. moq-mux's json Snapshot/Stream gain demand() so the FFI producers keep their existing demand() getter.
…alog_section hint
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (7)
Included review availability: Your plan provides up to 4 included reviews per hour; 0 remain after this review. WalkthroughThe Rust FFI now publishes catalog-backed binary snapshot and stream tracks. The Dart FFI exposes configuration and producer APIs for these tracks. JSON publishers now register tracks in the catalog, and mux JSON producers expose subscriber-demand handles. Tests cover catalog metadata, track removal, closed producers, and name conflicts. Python docstrings now describe JSON catalog behavior. Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to No concrete issue remains that blocks merging. Dart checksum agreement has not been independently verified. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The new publishing paths remain tied to the caller’s broadcast, and no new security bypass was established. Catalog and track creation are separate steps, however, and authorization outside these libraries and some failure-path behavior remain unverified. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches✨ Simplify code
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 |
|
Verdict: MERGE Positive fix for a real FFI gap: The new binary snapshot/stream surface is a thin, additive mirror of Complexity is justified; bypassing via This is an automated review, not the maintainer's decision |
|
Squash-merged onto (Written by Grok 4.7) |
Problem
The moq-ffi half of #4073.
MoqBroadcastProducer::publish_json_snapshot/publish_json_streamcreate a bare track, and their docs (and the Python wrapper's) say to advertise it withset_catalog_section. That call refusesjson, a reserved root section, so an FFI publisher (Python, Kotlin, Swift, Go, Dart) cannot make a JSON track discoverable from the catalog. There is also no FFI surface for binary data tracks, thoughmoq_mux::binaryexists.Approach
The same routing as #4073, through the broadcast's catalog producer:
publish_json_snapshot/publish_json_streamnow usecatalog::Producer::json_snapshot/json_stream. The entryjson.tracks.<name>(mode, andcompressionwhen set) is written on create and retired on finish or failure. The snapshot keeps itsdelta_ratiothroughjson::Config::with_delta_ratiofrom feat(libmoq): advertise JSON tracks in the catalog, add binary data tracks #4073.publish_binary_snapshot/publish_binary_streamwithMoqBinaryConfig { compression, mime }, returningMoqBinarySnapshotProducer { update, finish }/MoqBinaryStreamProducer { append, finish }.moq_mux::json::Snapshot/Streamgaindemand(), so the FFI JSON producers keep their existingdemand()getter.Impact
MoqBinaryConfigrecord, twoMoqBroadcastProducermethods and two producer objects. All additive.json::Snapshot::demand/json::Stream::demand(additive).set_catalog_section.cargo clippyis clean; moq-ffi (154) and moq-mux (826) pass.Alternatives
Same as #4073. Letting
set_catalog_sectionwritejson/binarywould bypass the typed entry and its retire-on-finish lifecycle. An opt-in flag would leave the documented path broken for every existing caller.Follow-ups
dart/moq_ffi/lib/src/moq.dartis generated and committed, and I can't rununiffi_bindgen_dartlocally. I'll take the regenerated file from this PR'sjust dart checkand push it here before marking the PR ready.