Skip to content

ci: keep mobile builds unwinding on panic - #229

Open
ovitrif wants to merge 2 commits into
masterfrom
ci/check-panic-unwind
Open

ovitrif wants to merge 2 commits into
masterfrom
ci/check-panic-unwind

Conversation

@ovitrif

@ovitrif ovitrif commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator

Description

  • Adds a Panic strategy CI check that fails if an Android or iOS build of this library would abort on panic, because UniFFI can turn a Rust panic into a Kotlin or Swift error only when the library unwinds; with panic = "abort" every panic kills the app.
  • Leaves the panic strategy as it is: Android and iOS build release, which unwinds both before and after this PR
  • Needs no release or app bump

Preview

N/A — no user-visible changes.

QA Notes

Manual Tests

N/A

Automated Checks

  • ran python3 scripts/check_panic_unwind.py: passes, and fails with panic = "abort" in the release profile
  • ran an inspection of the published 0.8.0-rc15 Android arm64-v8a library: it carries unwind tables and no panic_abort runtime

Models used

  • Planning/scoping: Claude Opus 5.5 (reasoning: medium)
  • Implementation: Claude Opus 5.5 (reasoning: medium)
  • Review: Gemini 4 Neon (reasoning: high)
  • Review rounds: 1

Verified: python3 scripts/check_panic_unwind.py passes, and fails with panic = "abort" in the release profile; actionlint
Verified: python3 scripts/check_panic_unwind.py passes
@ovitrif ovitrif self-assigned this Nov 28, 2026
@ovitrif
ovitrif requested review from a team, coreyphillips and piotr-iohk and removed request for a team November 28, 2026 23:27
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-28T23:43:26.451695Z af19db2 PR opened
ℹ️ 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.

@talosmachina talosmachina left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No findings. Adds a CI check that fails when an Android or iOS build of the library would use panic = "abort", so UniFFI can still turn Rust panics into Kotlin/Swift errors. Reviewed af19db2, light tier.

What I checked, and 6 candidates I ruled out

Read in full: .github/workflows/panic-unwind.yml, scripts/check_panic_unwind.py, Cargo.toml, build_android.sh, build_ios.sh, .cargo/config.toml
Not run: this is a static review; I did not execute the PR's code. I applied the script's regex literals to the head's build scripts and to hand-written mutations instead.
CI: mobile-builds-unwind green on this head; the other checks are green except usdt-tests, still running and untouched by this diff.

What the patterns classify on this head: the mobile commands are cargo ndk ... build --release in build_android.sh and the two cargo build --release --target=aarch64-apple-ios{,-sim} in build_ios.sh, all profile release; the bare host cargo build / --release lines are skipped as host builds. Cargo.toml has no [profile] table, so release resolves to unwind, which matches the description.

Ruled out

  • Abort set outside Cargo.toml slips through: ABORT matches panic = "abort", panic='abort', -C panic=abort and -Cpanic=abort in RUSTFLAGS or a rustflags array, CARGO_PROFILE_<ANY>_PANIC, --config 'profile.release.panic="abort"', immediate-abort and panic_immediate_abort; CARGO_PROFILE_RELEASE_DEBUG=2 and panic = "unwind" do not match.
  • Custom profile or inherits chain hides abort: --profile=mobile is parsed, and panic_strategy follows inherits until it finds a panic key. A cycle would loop, but Cargo rejects cyclic inherits before CI gets this far.
  • A build moves to a form the parser does not see (CARGO_BUILD_TARGET, a renamed script): no mobile build is found, and the script errors with no mobile build found, so it fails closed.
  • -r false match: REL needs whitespace before it and a word boundary after it, so -rf or a --target=...-r... value does not count as release.
  • Workflow risk: pull_request (not _target), contents: read, no secrets, one python3 step. tomllib needs 3.11, and ubuntu-24.04 ships 3.12.
  • Comment-only skip is line-start only: an abort string in a trailing # ... comment would be flagged. That fails closed, so it can only cause a false alarm.

Merge confidence: 4/5, no findings and CI green, but the script's failing path was exercised here only through its copied patterns, not by running it on an abort profile.

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.

2 participants