feat(moq-ffi)!: expose Subscription and TrackInfo instead of hardcoding defaults#1763
Merged
kixelated merged 3 commits intoJun 16, 2026
Merged
Conversation
…ng defaults Like the previous accept(None), several spots hardcoded a None/default where the underlying moq-net API takes a caller-controllable value, so FFI consumers had no say over delivery or track properties. - subscribe_track / subscribe_media / TrackProducer.consume took subscribe(None), dropping the whole Subscription (priority, ordering, staleness, group range). - publish_track took create_track(name, None), dropping TrackInfo (priority, cache, compression, ordering, timescale). Add two uniffi records mirroring moq-net (MoqSubscription, MoqTrackInfo, each with per-field defaults) and pass them as optional args. uniffi 0.31 supports field defaults but not function-arg defaults, so the FFI args are required Option<_> and each language wrapper supplies the native default (None/nil/null). Wrappers updated to forward the new optional params (py kwargs, swift/`= nil`, go `*T`, kt typealiases) so end users aren't broken. Go has no constructor defaults, so a partially-built Subscription/TrackInfo gets Go zero values; pass nil for moq-net's real defaults. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to the
accept(None)cleanup: several moq-ffi spots hardcoded aNone/default where the underlying moq-net API takes a caller-controllable value, so FFI consumers had no say over delivery or track properties.subscribe_track/subscribe_media/TrackProducer.consumeusedsubscribe(None), dropping the wholeSubscription(priority, ordering, staleness, group range).publish_trackusedcreate_track(name, None), droppingTrackInfo(priority, cache, compression, ordering, timescale).This adds two
uniffi::Records mirroring moq-net —MoqSubscriptionandMoqTrackInfo, each with per-field defaults — and threads them as optional args through the four methods.Bindings
Each wrapper forwards the new optional param so end users aren't broken:
subscription=None/info=Nonekwargs;moq.Subscription/moq.TrackInfore-exported.subscription: Subscription? = nil/info: TrackInfo? = nil; typealiases added.*Subscription/*TrackInfoparams (nil = defaults); type aliases added.Subscription/TrackInfotypealiases (kt calls the FFI directly).writeFrame/abort.Caveat (go)
Go has no constructor defaults, so a partially-built
Subscription{Priority: 3}gets Go zero values (e.g.ordered=false) rather than the record defaults. Passingniluses moq-net's real defaults and is the documented path. Happy to addNewSubscription()/NewTrackInfo()helpers if you'd like construction to match the other languages.Test plan
moq-ffitests pass; clippy + fmt clean via nix.TrackInfo+Subscriptionend-to-end; ruff + pyright clean.gofmtclean on the go edits. swift/kt updated by inspection (no xcframework/gradle locally).Stacking
Stacked on #1761 (it reuses the
MoqTrackProducerPending/Active refactor from that PR), so the base isclaude/happy-jang-9553c6and the diff shows only this change. Retarget todevonce #1761 lands.🤖 Generated with Claude Code
(Written by Claude)