Skip to content

feat(cpp)!: generate unprefixed free functions - #6476

Merged
kixelated merged 13 commits into
mainfrom
quest/m1/cpp-free-function-prefix
Oct 24, 2026
Merged

kixelated merged 13 commits into
mainfrom
quest/m1/cpp-free-function-prefix

Conversation

@kixelated

@kixelated kixelated commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Completes quest/m1/cpp-free-function-prefix: generated C++ free functions drop moq-ffi's moq_ prefix the way types already drop Moq, so moq.hpp stops wrapping them before C++ first publishes.

Changes

  • cpp/moq/uniffi.toml sets the generator's new strip_function_prefix = "moq_", so moq::log_level, moq::mint_epoch, moq::client_defaults, moq::versions, moq::qlog_supported, and moq::epoch_time_ms are the generated functions themselves.
  • moq.hpp deletes its five pass-through wrappers (and the <vector> include only they used). epoch_time stays, since it converts milliseconds to a time_point, and now calls the generated epoch_time_ms.
  • The interop C++ client calls moq::log_level instead of moq::moq_log_level. cpp/obs/src, cpp/obs/test, cpp/moq/test, and doc/lib/cpp already used the short names.
  • The migration note lives in the Public API section below rather than cpp/moq/MIGRATE.md, which moq-dev/moq#6610 leaves to the breaking cut.
  • The generator pin moves to v0.11.0-kixelated.6+v0.32.2 everywhere moq-dev/moq#5727 moved it: flake.nix (version, source hash, cargoHash), four workflows, rs/moq-ffi/build.sh, and cpp/moq/README.md. The README and the flake.nix comment list the new option.
  • Deletes the quest and its link in quest/m1/README.md.

Generator change

kixelated/uniffi-bindgen-cpp#5, merged into kixelated/uniffi-0.32 and tagged v0.11.0-kixelated.6+v0.32.2 on the merge commit 4cce88c. strip_function_prefix mirrors strip_type_prefix: each top-level function named <prefix><name> is renamed through uniffi's own rename when <name> starts with a lowercase letter, so FFI symbols and checksums are untouched. Methods keep their names. Generation fails if a stripped name is already a function or a C++ keyword, since the generator's fn_name does not escape keywords. Function renames stay out of the type oracle's rename map.

Tests in the fork's cpp-tests: renamed.toml adds strip_function_prefix = "capi_" and expected-test calls capi::checksum, capi::fail, and async capi::sum; two ctest cases check the refusals (async_maybe_ collides async_maybe_new_megaphone with new_megaphone; oops_ turns oops_enum into enum). The first CI run failed on Windows: --config applies to every crate in the fixtures library, in a platform-dependent order, so async_ hit coverall's async_bool first. Each refusal test now uses a prefix that hits only one crate, and the fork's CI passes on Linux, macOS, and Windows.

Public API

C++ only, and unreleased (no cpp-v* tag yet).

  • Migrate: moq::moq_foo is moq::foo, the name moq.hpp already wrapped most of them as; moq::moq_epoch_time_ms is moq::epoch_time_ms. Regenerate the C++ bindings with uniffi-bindgen-cpp v0.11.0-kixelated.6+v0.32.2.
  • moq::moq_log_level, moq::moq_mint_epoch, moq::moq_client_defaults, moq::moq_versions, moq::moq_qlog_supported, and moq::moq_epoch_time_ms are gone. The short names users already wrote still compile, now as the generated functions; moq::epoch_time_ms is newly reachable by its short name.
  • The doc comments on those functions now come from moq-ffi's Rust docs instead of moq.hpp.

Wire: none.

Checks

  • nix build .#uniffi-bindgen-cpp against the published tag, with the recomputed source hash; cargoHash is unchanged since Cargo.lock is.
  • just check in the Nix dev shell with that generator, after merging main: js, rs, quest, drill, py, kt, go, dart, and cpp pass (swift skipped: no toolchain). The generated moq/ffi/moq.hpp declares log_level, epoch_time_ms, mint_epoch, client_defaults, qlog_supported, and versions with no moq_ names. Local flakes that passed on rerun and are outside this PR: Go TestReservationUpdateReleasesSubscribedTrack (grant unavailable) once, and dart's "build hook rebuilt moq-ffi" guard right after a moq-ffi rebuild.
  • The queue dropped 36f8f8b962 on a quest/m1/README.md conflict (main finished neighboring quests). Re-merged main through babb189dd3, keeping main's list minus this PR's quest. Before the last merge (JS-only), in the branch's own Nix shell: just check passed every module through cpp, obs_compile, and obs (flake hits the local sandbox's unshare uid_map limit); the remaining modules (markdown, shell, large files, toml, nixfmt, justfile, gh) and the test phase (test rs, test js, test py, test gh) passed when run by hand, and just test interop --all passed, including every cpp pairing.

Decisions

  1. Publish the generator: push the fork branch, open its PR against kixelated/uniffi-0.32, merge after CI, and tag v0.11.0-kixelated.6+v0.32.2.
    • ✅ Do it as above (maintainer-approved). Merged as kixelated/uniffi-bindgen-cpp#5 with one extra test fix commit; the tag is on the merge commit and flake.nix's source hash was recomputed.
  2. Option name.
    • ✅ strip_function_prefix, matching strip_type_prefix and the name moq-dev/moq#5727 proposed.

Follow-ups

  • Rust doc comments in the generated header still name prefixed items (moq_mint_epoch, MoqClientConfig). Cosmetic and shared with every binding, as moq-dev/moq#5727 noted; recommend leaving it.

(Written by Claude Opus 5.5)

🤖 Generated with Claude Code

kixelated and others added 2 commits October 22, 2026 20:56
cpp/moq/uniffi.toml sets the generator's new strip_function_prefix = "moq_", so moq::log_level and friends are the generated functions, and moq.hpp drops its five pass-through wrappers. The generator pin moves to v0.11.0-kixelated.6+v0.32.2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title Strip moq_ from generated C++ free functions feat(cpp)!: generate unprefixed free functions Oct 23, 2026
@kixelated

Copy link
Copy Markdown
Collaborator Author

Implementation is done and stays a draft on one blocker: the generator release. The strip_function_prefix change and the .6 release bump are committed locally on the fork branch kixelated/strip-function-prefix (b842b23, 353597a), but the push to kixelated/uniffi-bindgen-cpp was refused by the session's permission check. Once that branch is pushed, merged into kixelated/uniffi-0.32, and tagged v0.11.0-kixelated.6+v0.32.2 on 353597a, the pins here resolve unchanged and this can be marked ready.

just cpp check passes with the .6 generator built locally; the rest of just check passes too.

(Written by Claude Opus 5.5)

@kixelated
kixelated marked this pull request as ready for review October 23, 2026 17:45
@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 98530714-e842-486d-950c-fca3577d22ce
Commits

Reviewing files that changed from the base of the PR and between 0bc39ed and 0311cd0.

Files selected for processing: 2
  • quest/m1/README.md
  • test/interop/clients/cpp/main.cpp
Files with no reviewable changes: 1
  • quest/m1/README.md

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

Walkthrough

The UniFFI C++ generator configuration now strips the moq_ prefix from free functions, and the generator pin and related build references use version v0.11.0-kixelated.6+v0.32.2. The public C++ header removes five pass-through wrappers and updates epoch_time to call epoch_time_ms. The C++ interop test and documentation reflect the updated function names and generator options.

Priority: Low

Merge Risk: Minimal · up to 0311c

No actionable merge-blocking risk remains in the reviewed changes.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: generated C++ free functions now use unprefixed names.
Description check Passed The description directly explains the unprefixed C++ function change, wrapper removals, generator update, migration impact, and validation results.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 3 files.
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.
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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 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-24T13:53:55.259915Z 0311cd0 New commits
ℹ️ 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.

# Conflicts:
#	cpp/moq/MIGRATE.md
#	cpp/moq/include/moq/moq.hpp
@kixelated

Copy link
Copy Markdown
Collaborator Author

Merging. Iterated to settle the maintainer's decisions, then chosen for /quest-merge. CI is green, the current head has a non-Grok review, and quest check passes against main.

(Written by Claude Opus 5.5)

@kixelated
kixelated added this pull request to the merge queue Oct 23, 2026
@kixelated
kixelated added this pull request to the merge queue Oct 24, 2026
@kixelated

Copy link
Copy Markdown
Collaborator Author

Merged main twice to clear the conflicts: cpp/moq/MIGRATE.md keeps both the unprefixed-functions entry and main's new Video rendition preference entry; quest/m1/cpp-free-function-prefix.md stays deleted (main only edited its Related link).

Local checks on 0bc39ed: just check passes every module (js, rs, py, kt, go, dart, cpp, obs) except the flake module, which fails building the self-hosted runner VM image (systemd-repart: unshare: write failed /proc/self/uid_map), a local sandbox limit unrelated to the uniffi-bindgen-cpp pin. just test interop --all passes. quest check passes. Codex thumbs-up on this head.

Public API: C++ only; generated moq::moq_* free functions are now moq::*, and moq.hpp drops its pass-through wrappers. No wire change.

(Written by Claude Opus 5.5)

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 24, 2026
# Conflicts:
#	cpp/moq/MIGRATE.md
@kixelated
kixelated enabled auto-merge October 24, 2026 03:34
@kixelated
kixelated added this pull request to the merge queue Oct 24, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 24, 2026
@kixelated
kixelated enabled auto-merge October 24, 2026 09:08
@kixelated
kixelated added this pull request to the merge queue Oct 24, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 24, 2026
kixelated and others added 2 commits October 24, 2026 06:33
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated added this pull request to the merge queue Oct 24, 2026
Merged via the queue into main with commit b27679f Oct 24, 2026
11 checks passed
@kixelated
kixelated deleted the quest/m1/cpp-free-function-prefix branch October 24, 2026 15:29
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