Skip to content

ci: catch stale iOS bindings on pull requests - #365

Open
Imod7 wants to merge 2 commits into
mainfrom
domi/ios-bindings-gate
Open

ci: catch stale iOS bindings on pull requests#365
Imod7 wants to merge 2 commits into
mainfrom
domi/ios-bindings-gate

Conversation

@Imod7

@Imod7 Imod7 commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Description

Adds a CI job that checks the committed iOS UniFFI bindings still match the Rust source in the pull request. Also moves the binding copy step out of rebuild.sh into a script that both the local rebuild and the CI check call.

Changes

ios/truapi-host/scripts/sync-bindings.sh (new). Copies the generated Swift bindings for the three uniffi namespaces into the package and strips trailing whitespace, which is what rebuild.sh did inline. --check compares instead of writing, staging into a temporary directory so a failure leaves nothing behind.

ios/truapi-host/scripts/rebuild.sh. Calls the new script instead of copying inline. Same result as before, but the check and the in place write cannot disagree about the file list or the normalization.

.github/workflows/ci.yml. New ios-bindings job running make uniffi then sync-bindings.sh --check, registered in ci-status. Runs on ubuntu-latest, so no macOS runner, no Xcode and no iOS targets.

ios/truapi-host/README.md, CLAUDE.md, .claude/skills/truapi-definition-of-done/SKILL.md. Document the bindings only refresh command and the CI check. The definition of done checklist gains an iOS bindings step, which it never had, so a HostCallbacks change can no longer pass the whole checklist with stale bindings.

Why these changes

The committed UniFFI Swift bindings are build outputs. Any change to HostCallbacks, NativeTrUApiCore or the native mirror types makes them stale, and no CI job notices, so it lands green and surfaces later to whoever next runs rebuild.sh or cuts an iOS release.

What this catches and what it does not

Failure Caught Why
Rust declares a new method, the committed truapi_server.swift does not Yes CI runs make uniffi itself and compares its output against the committed file
Rust and truapi_server.swift agree, but a hand written conformer such as StubHostCallbacks still has the old method set No The job compares generated files, it does not compile Swift. That needs xcodebuild on a macOS runner

This PR guarantees the generated bindings match the Rust source. It does not guarantee the package compiles.

Testing

make uniffi
./ios/truapi-host/scripts/sync-bindings.sh --check

Before this PR: nothing regenerated or compared the iOS bindings, so stale bindings could not fail any check.

After this PR, run locally on base aa878d1f: exit 0 on an unmodified checkout, exit 1 naming every stale file when a required method is added to HostCallbacks without regenerating, exit 66 when target/uniffi-swift-out is missing. --check modifies no files, and write mode reproduces the committed bindings byte for byte. The job lands green on this base.

@Imod7
Imod7 requested a review from a team August 11, 2026 06:47
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