Skip to content

feat(cpp): reuse validated shared FFI native inputs - #5740

Merged
kixelated merged 14 commits into
mainfrom
quest/m1/cpp-ffi-reuse
Oct 17, 2026
Merged

kixelated merged 14 commits into
mainfrom
quest/m1/cpp-ffi-reuse

Conversation

@kixelated

@kixelated kixelated commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

C++ rebuilds four default-feature FFI libraries that the shared coordinator already builds. Its independent cpp-v* releases need an explicit, durable input and four-platform consumer proof before switching.

Approach

Approved release-input decision: ✅ option 1, pin immutable default-feature native assets with cpp/moq/FFI_VERSION and checked-in SHA-256 hashes on the corresponding moq-ffi-v* release. The alternatives were separate source builds or deferring reuse. Never select the newest release or fall back after a selected prebuilt fails.

Add validated CMake/build-script prebuilt input, prepare checksummed release assets only after installed C++17/C++23 consumer gates on all four hosts, and refuse replacing published native assets. Nightly reuses each target's cpp-native-* archive only after that target's installed-consumer gate succeeds, verifying its sidecar and manifest. Its packaging requires no second Rust build, and unrelated coordinator failures do not suppress successful C++ targets. Tag releases refuse same-run inputs.

If the C++ publisher is first to create the shared moq-ffi-v* release, it creates it exactly like sh/gh/release.sh (same title, notes generated from the previous moq-ffi tag), so the release looks the same whichever publisher wins the race.

Keep standalone source builds as the current default: no existing release has this four-target default-feature asset contract, so the pin remains unset pending actual publication and compatibility evidence.

Decisions

Pinned-FFI download path (FFI_VERSION, FFI_SHA256.json, ffi.py fetch), dormant until a release is pinned:

  • ✅ Keep it, so activation is a two-file data change.
  • Remove it now and add it back in the activation PR.

Nightly C++ packaging depends on the shared FFI build (a target whose same-run consumer gate fails also fails its nightly C++ package; tags still build from source until pinned):

  • ✅ Accept it.
  • Keep an extra source-build C++ nightly job.

The C++ FFI fixtures run once, in just cpp check (every pull request and all four C++ hosts), not again in nightly gh test.

Impact

  • Public build API: explicit MOQ_FFI_DIR / --ffi-dir; FFI_VERSION and per-target SHA-256 hashes select package-release inputs. Direct CMake and just cpp check default to the current source checkout. Nightly reuses validated same-run native inputs.
  • C++ and Rust runtime API: unchanged.
  • Wire: unchanged.
  • Release assets: on the next moq-ffi-v* tag, attach default-feature static libraries, binding metadata and native linker inputs for all four C++ targets, gated by installed consumers; no release or tag is created by this PR.

Alternatives

Expiring Actions artifact IDs cannot rebuild historical C++ releases. Separate native source builds remain the default until the approved release contract is available.

Validation

  • Eleven CI-wired fixtures pass in Nix: checksum and selected-manifest mismatches, archive traversal/symlink rejection, deterministic archive roundtrip, immutable-publication refusal, release creation matching the other publishers, sidecar validation and build-free CMake generation with invalid inputs.
  • Workflow lint, shell lint and formatting pass. nix develop --command just check passes on 4d449766f, including installed C++17/C++23, pkg-config, doc samples and OBS compile checks.
  • Focused four-host dry-run 38969347067 passes on implementation head cbbcf9b2c: all four installed C++17/C++23/coroutine consumers, Unix pkg-config/docs, checked archive extraction and final packages. Publication jobs were skipped. Later commits change only documentation and the tag-only release-creation notes, which the dry-run does not exercise.
  • Historical same-revision evidence is retained and corrected in .github/ffi.md: Windows has 6,077 archive members, including six assembly members with code differences. Complete executable equivalence remains unproven; installed consumers gate reuse. If feat(cpp)!: generate unprefixed names and one moq::expected #5727 changes the generator before merge/release, repeat the gates on that final checkout.

Follow-ups

First publish a real FFI release with all four validated default-feature assets, then pin its version and exact archive hashes. Nightly reuse requires successful same-run installed-consumer gates; pinned release reuse additionally requires the actual four published downloads to pass those gates. The retained quest records the settled decision and passing current gates, and remains open for the real published-asset/pin activation condition.

Originally drafted by GPT-6; iterated by Claude Opus 5.5.

(Written by Claude Opus 5.5)

@kixelated

Copy link
Copy Markdown
Collaborator Author

Outcome: evidence-only draft. The quest remains open because release-input direction and compatibility work remain. Recommended next choice is an explicit FFI_VERSION pin plus immutable default-feature native release assets. Retaining native builds is the alternative that avoids adding that contract. No build, API, wire, or publishing behavior changed. Leave this PR a draft pending the maintainer's decision; the parent batch will present the choice.

(written by GPT-6)

@kixelated kixelated changed the title docs(ffi): record C++ reuse compatibility evidence feat(cpp): prepare pinned shared FFI release inputs Oct 16, 2026
Keep direct CMake builds on the current source checkout, while release packaging selects the explicit immutable FFI pin. Make the Nightly helper fixture portable so its existing tests run in the Nix shell.

Co-Authored-By: GPT-6 <noreply@openai.com>
@kixelated kixelated changed the title feat(cpp): prepare pinned shared FFI release inputs feat(cpp): reuse validated shared FFI native inputs Oct 16, 2026
Co-Authored-By: GPT-6 <noreply@openai.com>
@kixelated
kixelated marked this pull request as ready for review October 16, 2026 22:02
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 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 ⚠️ Failed 2026-10-17T04:24:47.943751Z f11943a Manual request
ℹ️ 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.

@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You'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 12 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 465fa97b-9d57-4137-bebb-403bea1f7c15
📥 Commits

Reviewing files that changed from the base of the PR and between 6ae07a8 and f11943a.

📒 Files selected for processing: 17
  • .github/ffi.md
  • .github/workflows/nightly.yml
  • .github/workflows/release-cpp.yml
  • .github/workflows/release-shared-ffi.yml
  • cpp/justfile
  • cpp/moq/CMakeLists.txt
  • cpp/moq/FFI_SHA256.json
  • cpp/moq/FFI_VERSION
  • cpp/moq/README.md
  • cpp/moq/build.sh
  • doc/lib/cpp/index.md
  • flake.nix
  • quest/m2/cpp-ffi-reuse.md
  • sh/cpp/check.sh
  • sh/cpp/ffi.py
  • sh/cpp/ffi.test.py
  • sh/gh/nightly.test.py
  • 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.

Co-Authored-By: GPT-6 <noreply@openai.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 041b74a0df

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sh/cpp/ffi.py Resolved
kixelated and others added 4 commits October 16, 2026 16:09
The C++ native publisher could win the race to create the shared moq-ffi
release and stamp it with hardcoded notes naming an AI model. Create it the
way sh/gh/release.sh does, with generated notes from the previous moq-ffi
tag, so the release looks the same whichever publisher creates it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
just cpp check already runs sh/cpp/ffi.test.py on every pull request and on all four C++ hosts, so the nightly gh test copy is redundant.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated added this pull request to the merge queue Oct 17, 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 17, 2026
@kixelated

Copy link
Copy Markdown
Collaborator Author

@codex review

Merged origin/main to resolve a conflict in .github/ffi.md (kept main's measured Nightly savings table, then the C++ comparison section). Please review head f11943a.

(Written by Claude Opus 5.5)

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@kixelated

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

Codex hit its usage limit. Please review head f11943a (merge of origin/main resolving .github/ffi.md).

(Written by Claude Opus 5.5)

@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@kixelated

Copy link
Copy Markdown
Collaborator Author

Both review bots are rate limited, so I ran a local Codex review (codex review --base origin/main) of head f11943a: no actionable regressions, and the 11 native-input tests passed. just check is green on this head.

(Written by Claude Opus 5.5)

@kixelated
kixelated added this pull request to the merge queue Oct 17, 2026
Merged via the queue into main with commit 30ada8c Oct 17, 2026
20 checks passed
@kixelated
kixelated deleted the quest/m1/cpp-ffi-reuse branch October 17, 2026 06:20
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