Repository navigation
feat(ffi): a contract symbol each header and library check - #146
Conversation
Quest-Claim: 53e4cf6eda7dee63
Each export's header defines <PREFIX>_CONTRACT, a stable hash of what it declares, and the library exports <prefix>_contract() returning it, so a binding refuses a header and a library from different builds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c29a110e4a
ℹ️ 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".
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed commit: c29a110
No additional actionable implementation bugs found. The new reserved names in ffi/src/abi.rs:390-395 do break existing exports; the missing migration entry is already covered by the existing finding, rather than duplicated here.
Direction: one header hash, computed once and passed directly to glue generation, is a simple fit for whole-header compatibility; per-method checksums would add unnecessary machinery. Including docs deliberately makes compatibility stricter.
Verification: static review of header generation, glue wiring, name claims and the two C checks only. I did not run builds/tests or verify mismatch rejection with a deliberately mismatched header/library pair.
(Written by OpenAI)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed commit: 677a932
The previously referenced migration finding is fixed: ffi/MIGRATE.md:3-7 documents both reserved names and the rename migration. This is the only change since c29a110; the base is unchanged.
No new actionable bugs found. The focused documentation fix preserves the simple whole-header contract design without adding compatibility machinery. Verification was static comparison and document inspection only; no builds or tests run.
(Written by OpenAI)
# Conflicts: # ffi/MIGRATE.md
|
Merge summary:
(Written by Claude Opus 5.5) |
Problem
A header and a library from different exports can be compiled and linked together, and nothing notices until a call misbehaves. The UniFFI fork guards this with a namespaced contract version and per-method checksums; the exporter had nothing.
Approach
c::headerhashes everything the header declares (types, functions, and their docs) with rustc's platform-independentStableHasher, already linked throughrustc_data_structures, so no new dependency.<PREFIX>_CONTRACTand declaresuint64_t <prefix>_contract(void)right afterextern "C" {; the glue exports that function returning the same value.contractandCONTRACTare claimed as runtime names, so an exported item with that C name is a clash error likebuf_free.tests/api.candmoq/moq.ccheck the contract before any other call.Removes
quest/m1/ffi-export/contract.mdand its link.Impact
<prefix>_contract()and#define <PREFIX>_CONTRACT. Breaking only for an item that already took either name, such as a crate rootpub fn contract, which now clashes and needs arename; seeffi/MIGRATE.md.Choices made without asking
self", so a doc-only change also changes the contract. That's stricter than strictly needed, and harmless since header and library ship together.Alternatives
Checks
just check: passjust ffi test: pass (14 tests)just ffi moq: passjust ts test,just driver test,just uniffi test: not run, since this doesn't touch themFollow-ups
None.
🤖 Generated with Claude Code
(Written by Claude Opus 5.5)