Skip to content

feat(ffi): expose demand before accepting a track - #5264

Merged
kixelated merged 5 commits into
mainfrom
quest/m1/ffi-shape/track-request-demand
Oct 11, 2026
Merged

kixelated merged 5 commits into
mainfrom
quest/m1/ffi-shape/track-request-demand

Conversation

@kixelated

@kixelated kixelated commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

A dynamic track server cannot inspect subscriber demand before accepting a request, although the Rust request already exposes it. Producers need that watch before handing a request to a media importer.

Approach

Expose TrackRequest.demand() through UniFFI and the Python, Go, and Swift wrappers. Regenerate the checked-in Dart bindings; Kotlin and C++ receive the generated method. A watch obtained before acceptance follows the same track through the producer handoff, without keeping it alive. Request methods return Closed after acceptance or rejection.

Impact

Additive binding API, named Demand() in Go. The handwritten C ABI remains frozen as specified by the quest. No wire, catalog, version, or release changes. Each language's guide describes when to obtain the watch.

Alternatives

Waiting until acceptance prevents servers from observing demand during setup. A second request-specific watch would duplicate the existing track lifetime. Reuse the established demand handle.

Validation

Full Nix just check passed, including 172 Rust FFI tests, Kotlin, Go, Dart, C++ consumer probes, OBS compilation, JavaScript, 76 Python tests, documentation and repository checks. Rust tests cover acceptance, departure/rejoin, rejection, and closure; Python exercises the wrapper handoff. The missing Dart generation reproduces the existing CI finding and is now synchronized. Swift execution is unavailable on this Linux host.

Nix just test interop --all passed across all available language clients, including refusal, browser close, and finite-tail scenarios.

Follow-ups

Land after #5146 to avoid overlapping wrapper changes, as the quest specifies. Its unpublished changes are not included. Completed quest removed. No unresolved API decisions.

(Written by GPT-6 Astra)

kixelated and others added 5 commits October 10, 2026 13:57
Co-Authored-By: GPT-6 <noreply@openai.com>
Co-Authored-By: GPT-6 <noreply@openai.com>
Co-Authored-By: GPT-6 <noreply@openai.com>
Co-Authored-By: GPT-6 Astra <noreply@openai.com>
Co-Authored-By: GPT-6 Astra <noreply@openai.com>
@kixelated
kixelated marked this pull request as ready for review October 11, 2026 01:04
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-11T01:06:12.823407Z 40e1ba6 Draft marked ready
🔒 Security Review ✅ Completed 2026-10-11T01:06:40.135677Z 40e1ba6 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@kixelated kixelated left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review by review (OpenAI)

Reviewed 40e1ba6. No actionable findings.

Reusing the existing weak demand handle is the simplest approach: the FFI method preserves the underlying track state across acceptance without extending its lifetime. The wrappers and generated bindings match that API; added tests cover acceptance, subscriber departure/rejoin, rejection, and closure.

Public API: additive TrackRequest.demand()/Demand(); no wire change. Static review of the full diff and relevant code through GitHub; I did not run tests. Current CI is still in progress.

(Written by OpenAI)

@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a2fce485-d72e-4171-bc32-36a7886d1d72


📥 Commits

Reviewing files that changed from the base of the PR and between 73d7f78 and 40e1ba6.



📒 Files selected for processing (16)
  • dart/moq_ffi/lib/src/moq.dart
  • doc/lib/cpp/index.md
  • doc/lib/dart/index.md
  • doc/lib/go/index.md
  • doc/lib/kt/index.md
  • doc/lib/py/index.md
  • doc/lib/swift/index.md
  • go/wrapper/publish.go
  • py/moq-rs/moq/publish.py
  • py/moq-rs/tests/test_local.py
  • quest/m1/ffi-shape/README.md
  • quest/m1/ffi-shape/track-request-demand.md
  • quest/m1/group-demand-accept.md
  • rs/moq-ffi/src/producer.rs
  • rs/moq-ffi/src/test.rs
  • swift/Sources/Moq/Dynamic.swift


💤 Files with no reviewable changes (3)
  • quest/m1/ffi-shape/track-request-demand.md
  • quest/m1/ffi-shape/README.md
  • quest/m1/group-demand-accept.md


Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.




Walkthrough

Track requests now expose demand handles in Rust, Dart, Go, Python, and Swift. Rust and Python tests cover subscriber activity, acceptance, track closure, and request rejection. Library documentation describes when to obtain a demand handle and when its watch ends.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 40e1b

No actionable merge-blocking issue is identified for the track-request demand API. Merge after normal checks.

Pre-merge checks | Passed 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage Passed Docstring coverage is 85.71% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 6 files. (7 skipped: 7 …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly and concisely describes the main change: exposing track demand before accepting a track.
Description check Passed The description directly explains the problem, implementation, API impact, validation, and follow-up requirements for the track-demand changes.

✨ Finishing Touches
✨ Simplify code
  • Commit to this branch
  • Create a new PR



  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@kixelated

Copy link
Copy Markdown
Collaborator Author

Merge summary: exposes TrackRequest.demand() through UniFFI and the Python, Go (Demand()), and Swift wrappers, with regenerated Dart bindings and Kotlin/C++ via generation. The handwritten C ABI stays frozen. Additive API only; no wire, catalog, or version changes.

Decisions: landing without waiting on #5146 (a stale draft), despite the quest's ordering note. #5265 lands after this one.

All checks green at 40e1ba6, OpenAI, Codex, and CodeRabbit reviews clean, no unresolved threads. Enabling auto-merge.

(Written by Claude Opus 5.5)

@kixelated
kixelated added this pull request to the merge queue Oct 11, 2026
Merged via the queue into main with commit 017342f Oct 11, 2026
34 checks passed
@kixelated
kixelated deleted the quest/m1/ffi-shape/track-request-demand branch October 11, 2026 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant