Repository navigation
fix(importer): feature-gate wasmtime so --no-default-features drops cranelift - #1430
Conversation
…ranelift `cargo install rustledger --no-default-features` regressed (#1427, same as #867): it still compiled `cranelift-codegen`, which can't build on Termux/ aarch64. The cause was two unconditional paths to `wasmtime`: 1. `rustledger-importer` depended on `wasmtime` (and `rustledger-plugin`'s `wasm-runtime`) unconditionally for the WASM importer loader (#1131). 2. The CLI pulled both crates with their default (wasmtime-enabling) features. Gate the WASM importer behind a new `wasm-importer` feature (off by default): - rustledger-importer: `wasmtime`/`rmp-serde`/`serde`/`thiserror`/ `rustledger-plugin` are now optional, enabled only by `wasm-importer`; the `wasm` module, the registry's `register_wasm_*` methods + `WasmDirScanReport`, and the e2e test are `#[cfg(feature = "wasm-importer")]`. - CLI: `rustledger-importer`/`rustledger-plugin` resolve to their wasmtime-free feature sets by default; `python-plugin-wasm` (still the default feature) re-enables `rustledger-importer/wasm-importer`. The extract command's WASM importer-dir loading + its `resolve_scan_dirs`/`WasmDirSetting`/`expand_tilde` helpers are gated behind `python-plugin-wasm`. The default build is unchanged (WASM importer + Python-plugin sandbox present; 364 lib tests pass). A `--no-default-features` build now carries no `wasmtime`/ cranelift and keeps `check`/`query`/price-download. A CI ratchet (`scripts/check-slim-no-wasmtime.sh`) fails if `wasmtime` re-enters the no-default tree, so this can't regress a third time (#1395). Closes #1427. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
📊 Benchmark Results
vs main branch (2026-06-18)
What do these numbers mean?
|
There was a problem hiding this comment.
Pull request overview
This PR fixes a build regression where cargo install rustledger --no-default-features still pulled in wasmtime (and therefore cranelift-codegen), preventing slim native builds on platforms like Termux/aarch64. It does so by feature-gating the WASM importer support behind a new rustledger-importer/wasm-importer feature and wiring the CLI’s existing python-plugin-wasm default feature to re-enable it.
Changes:
- Add
wasm-importerfeature torustledger-importer, makingwasmtime(and related deps/APIs/tests) optional and#[cfg]-gated. - Gate the CLI’s WASM-importer registry loading and related helpers/tests behind
python-plugin-wasm. - Add a “slim build” guard script and CI job to ensure
--no-default-featuresstayswasmtime-free.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
scripts/check-slim-no-wasmtime.sh |
Adds a dependency-tree guard to assert wasmtime is absent under --no-default-features. |
crates/rustledger/src/cmd/extract_cmd/mod.rs |
Gates WASM importer loading/dir resolution and related tests behind python-plugin-wasm. |
crates/rustledger/src/cmd/extract_cmd/config.rs |
Gates TOML wasm_importer_dir handling and expand_tilde behind python-plugin-wasm. |
crates/rustledger/Cargo.toml |
Ensures python-plugin-wasm re-enables rustledger-importer/wasm-importer and documents slim build intent. |
crates/rustledger-importer/Cargo.toml |
Introduces wasm-importer feature; makes wasmtime + serialization deps optional. |
crates/rustledger-importer/src/lib.rs |
#[cfg]-gates the wasm module and WASM-related re-exports. |
crates/rustledger-importer/src/registry.rs |
#[cfg]-gates WASM registry APIs and report type; gates WASM discovery tests. |
crates/rustledger-importer/tests/wasm_importer_e2e.rs |
Gates the e2e WASM importer test behind wasm-importer. |
.github/workflows/ci.yml |
Adds “Slim Build (no wasmtime)” CI job running the new guard script. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
✅ Compatibility Test Results
What's tested
Full results available in workflow artifacts |
Closes #1427 (regression of #867).
cargo install rustledger --no-default-featuresstill compiledcranelift-codegen, which can't build on Termux/aarch64.Root cause
Two unconditional paths to
wasmtimesurvived--no-default-features:rustledger-importerdepended onwasmtime(+rustledger-plugin'swasm-runtime) unconditionally for the WASM importer loader (added in feat(importer): WasmImporter host loader (wave 2.3b) #1131 — this is what re-broke Build/installation fails on Android (Termux) #867).rustledger-importer/rustledger-pluginwith their default, wasmtime-enabling features.Fix
Gate the WASM importer behind a new
wasm-importerfeature (off by default):wasmtime/rmp-serde/serde/thiserror/rustledger-pluginare nowoptional, enabled only bywasm-importer. Thewasmmodule, the registry'sregister_wasm_*methods +WasmDirScanReport, and the e2e test are#[cfg(feature = "wasm-importer")].python-plugin-wasmfeature re-enablesrustledger-importer/wasm-importer. The extract command's WASM-importer-dir loading + itsresolve_scan_dirs/WasmDirSetting/expand_tildehelpers are gated behindpython-plugin-wasm(the CLI's plugin-runtime paths were already gated).Verification
cargo tree -p rustledger --no-default-features -i wasmtime→ "did not match any packages" (wasmtime/cranelift gone).cargo clippy -- -D warningsclean in both.register_wasm_*/resolve_scan_dirs/expand_tildetests). Importer no-default tests pass.--no-default-featuresbuild keepscheck/query/price-download — the use case the reporter needs.Regression guard
scripts/check-slim-no-wasmtime.sh+ a CI job (Slim Build (no wasmtime)) fail ifwasmtimere-enters the no-default dependency tree — so #867→#1427 can't happen a third time (ties into #1395).How to test