Skip to content

fix(cli): synth verify exits non-zero when built without verify feature#125

Merged
avrabe merged 1 commit into
mainfrom
fix/issue-124-verify-inert-exit-nonzero
May 21, 2026
Merged

fix(cli): synth verify exits non-zero when built without verify feature#125
avrabe merged 1 commit into
mainfrom
fix/issue-124-verify-inert-exit-nonzero

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented May 20, 2026

Summary

Closes #124. synth verify is advertised in synth --help and the usage examples, but on a binary built without the verify feature it printed a "rebuild" hint and returned Ok(())exit code 0. A script or CI step gating on synth verify would silently believe the binary was validated when nothing ran.

synth verify is the Z3 translation-validation oracle — the "did the ARM lowering preserve WASM semantics" check, load-bearing on the ASIL-D path. A success-shaped no-op defeats it.

Fix

The #[cfg(not(feature = "verify"))] branch now anyhow::bail!s with a clear message and a non-zero exit:

Error: this `synth` binary was built without the `verify` feature — Z3 translation
validation is unavailable.
  Rebuild with verification support:
    cargo build --features verify
  (or `cargo install --path crates/synth-cli --features verify`)

Also marks the Verify subcommand's help text as requiring --features verify.

What's deliberately NOT changed

verify stays a non-default feature. Making it default would pull z3-sys into every cargo install — z3-sys needs network at build time, which is exactly why it's opt-in. The fix is to fail honestly, not to force the dependency on everyone.

Test plan

  • cargo install --path crates/synth-cli (no verify) → synth verify a.wasm b.elf exits non-zero with the clear message.
  • cargo install --path crates/synth-cli --features verifysynth verify runs Z3 validation as before.
  • synth --help shows the --features verify requirement on the Verify subcommand.

🤖 Generated with Claude Code

`synth verify` is advertised as a subcommand in `synth --help` and in
the top-level usage examples, but on a binary built without the
`verify` feature (the default — `verify` pulls in z3-sys, which needs
network and breaks `cargo install` for many users) it printed a
"rebuild" hint and returned `Ok(())`. Exit code 0.

A script or CI step gating on `synth verify` — the Z3 translation-
validation oracle, the "did the ARM lowering preserve WASM semantics"
check — would silently believe the binary was validated when in fact
nothing ran. That is a correctness-of-process bug: the verify step is
load-bearing on the ASIL-D path, and a success-shaped no-op defeats it.

Fix: the `#[cfg(not(feature = "verify"))]` branch now `anyhow::bail!`s
with a clear message and a non-zero exit. A consumer that runs
`synth verify` and checks the exit code now correctly sees failure
when the binary cannot verify.

Also marks the `Verify` subcommand's help text as requiring
`--features verify`, so `synth --help` is honest about the dependency.

Not changed: `verify` stays a non-default feature. Making it default
would pull z3-sys into every `cargo install`, which needs network at
build time and is the reason it is opt-in. The fix is to fail honestly,
not to force the dependency on everyone.

Closes #124.
@codecov
Copy link
Copy Markdown

codecov Bot commented May 20, 2026

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/synth-cli/src/main.rs 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@avrabe avrabe merged commit 28be9d6 into main May 21, 2026
9 of 13 checks passed
@avrabe avrabe deleted the fix/issue-124-verify-inert-exit-nonzero branch May 21, 2026 03:50
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.

synth verify advertised in CLI but inert unless built with --features verify

1 participant