Update: make wasmtime deps optional behind a wasm feature (on by default) - #461
Conversation
β¦fault)
wasmtime + wasmtime-wasi pulled in ~36 crates unconditionally purely for
the optional sandboxed WASM plugin runtime. Mark both `optional = true` and
add a `wasm` feature (in `default`, so behavior is unchanged) that enables
them. Building `--no-default-features` now drops the entire wasmtime tree.
Every path touching the wasm module is cfg-gated on `feature = "wasm"`:
`mod wasm;`, the run-time dispatch in `run_plugin`, and the pre-compile step
in `install`. The disabled path returns a clear error ("requires the WASM
runtime, which was not compiled in (rebuild with --features wasm)"). The
`protocol` re-exports that exist only for the wasm host bridge are gated too
so the no-default-features build stays warning-free.
Verified: `cargo build`, `cargo build --no-default-features`,
`cargo test --bin fledge` (897 pass), and clippy/fmt all clean under both
feature configurations; wasmtime absent from the no-default-features tree.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AvsKakjAc3EKN2ztcMfYi
There was a problem hiding this comment.
Code Review
This pull request makes the WASM plugin runtime optional by introducing a new wasm feature flag. It updates Cargo.toml to make wasmtime and wasmtime-wasi optional dependencies, gates WASM-related installation, execution, and module declarations behind #[cfg(feature = "wasm")], and ensures that appropriate errors are returned if a WASM plugin is invoked when the feature is disabled. Additionally, unused re-exports are gated to prevent compiler warnings. I have no further feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
0xGaspar
left a comment
There was a problem hiding this comment.
Clean feature-gating. The cfg split is consistent across all three surfaces β the wasm module, both run/install dispatch sites, and the protocol host-bridge re-exports (gated to keep the no-default-features build warning-free) β and the disabled path bail!s with an actionable message instead of silently degrading. default = ["wasm"] keeps current behavior; the dependency-tree win is opt-in via --no-default-features, which is the right default. cargo tree -i wasmtime present/absent both ways is the proof that matters. LGTM.
There was a problem hiding this comment.
β Corvin says...
_
<(^\ .oO(Caw! ^v^)
|/(\
\(\\
" "\\
"Looking sharp! Like a beak should be."
CI Summary
| Check | Status |
|---|---|
| Dependency Audit | β Passed |
| Integration (3 OS) | β Passed |
| Lint (fmt + clippy) | β Passed |
| Spec Validation | β Passed |
| Tests (3 OS) | β Passed |
Powered by corvid-pet
Summary
wasmtimeandwasmtime-wasiwere unconditional dependencies (~36 transitive crates) purely for the optional sandboxed WASM plugin runtime. Marked bothoptional = trueand added a[features]block withdefault = ["wasm"]andwasm = ["dep:wasmtime", "dep:wasmtime-wasi"]. Default behavior is unchanged;--no-default-featuresdrops the entire wasmtime dependency tree.feature = "wasm":mod wasm;insrc/plugin/mod.rssrc/plugin/run_plugin.rssrc/plugin/install.rsbail!with a clear error:"Plugin '<name>' requires the WASM runtime, which was not compiled in (rebuild with --features wasm)."protocolre-exports (detect_project_context,handle_exec,handle_metadata,handle_load,handle_store,handle_log) that exist solely for the wasm host bridge, so the no-default-features build stays warning-free (they are the only external consumers).Test Plan
cargo build(default, wasm ON) β cleancargo build --no-default-featuresβ clean, warning-freecargo tree -i wasmtime: present with default features, absent with--no-default-featurescargo test --bin fledge(default) β 897 passed, 0 failedcargo clippy --bin fledge -- -D warningsβ clean (also verified with--no-default-features)cargo fmt --checkβ cleanπ€ Generated with Claude Code
Closes #445
https://claude.ai/code/session_016AvsKakjAc3EKN2ztcMfYi