Skip to content

client/uniffi: rename LzError message fields to reason; compile the bindings in CI - #15

Merged
gf5901 merged 2 commits into
mainfrom
uniffi-kotlin-message
Nov 12, 2026
Merged

gf5901 merged 2 commits into
mainfrom
uniffi-kotlin-message

Conversation

@gf5901

@gf5901 gf5901 commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #14.

What

  • Rename. LzError::Lease { message } and LzError::Registration { message } become { reason }. UniFFI makes each variant a Kotlin exception class, where a message property clashes with Throwable.message, so the generated Kotlin didn't compile. The Rust Display text is unchanged ("invalid lease: …"). This changes the Swift and Kotlin API (e.reason instead of e.message), which v0 allows (spec §7). Apps that patch the generated file at build time can drop that workaround once they move their pin.
  • CI check. client/uniffi/check-bindings.sh builds the crate, generates both bindings, compiles the Kotlin against JNA, and typechecks the Swift against the generated header and module map. The Kotlin compiler (2.4.21) and JNA (5.17.0) are downloaded over HTTPS, pinned, and checked against their published SHA-256 sums before anything runs. The new uniffi-bindings job runs it; in CI a missing swiftc fails the job rather than skipping Swift. CONTRIBUTING.md lists the script for changes to what client/uniffi exports.
  • README. Updates the status line (the Kotlin is now compiled) and documents the liblz_client_uniffi-<hash>.so that cargo-ndk copies into jniLibs when an app crate depends on this one: nothing loads it, so delete it after the build. The crate keeps its cdylib type, which apps that use it on its own still need.

Tested

  • Reproduced the bug locally: the generated Kotlin had val `message`: kotlin.String at line 3956, matching the issue. After the rename it's val `reason` .
  • swiftc -typecheck on the generated Swift passes locally (macOS).
  • The Kotlin compile ran in CI only (uniffi-bindings: "Kotlin compiles", "Swift typechecks" on Ubuntu).
  • tests/bindings.rs now checks that LzError::Lease { reason } carries the core's text.
  • Locally: cargo fmt --check, cargo clippy -p lz-client-uniffi --all-targets -D warnings, cargo test -p lz-client-uniffi, scripts/privacy-guards.sh, typos, shellcheck. The full-workspace and 1.89 runs were left to CI. No dependencies changed.

🤖 Generated with Claude Code

gf5901 and others added 2 commits November 11, 2026 17:25
…s in CI

`LzError::Lease` and `LzError::Registration` had a field named
`message`. UniFFI makes each variant a Kotlin exception class, where that
property clashes with `Throwable.message`, so the generated Kotlin didn't
compile. Rename the field to `reason`. This changes the Swift and Kotlin
API, which v0 allows (spec §7).

Add `client/uniffi/check-bindings.sh` and a CI job that runs it: it
generates the bindings, compiles the Kotlin against JNA (pinned
compiler and JNA, checked by SHA-256), and typechecks the Swift against
the generated header.

The README also says what to do with the stray
`liblz_client_uniffi-<hash>.so` that cargo-ndk copies into `jniLibs` for
an app crate that depends on this one.

Fixes #14

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The lease test checks that `reason` carries the core's text, not only
  the variant.
- check-bindings.sh fails in CI when `swiftc` is missing instead of
  skipping Swift, downloads over HTTPS only, and says the Swift is
  typechecked rather than compiled.
- CONTRIBUTING.md lists the script for changes to what client/uniffi
  exports.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gf5901
gf5901 merged commit 59964c7 into main Nov 12, 2026
8 of 9 checks passed
@gf5901
gf5901 deleted the uniffi-kotlin-message branch November 15, 2026 06:31
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.

lz-client-uniffi: generated Kotlin doesn't compile (LzError field named message)

1 participant