Skip to content

Update: make wasmtime deps optional behind a wasm feature (on by default) - #461

Merged
0xLeif merged 1 commit into
mainfrom
fix/445-wasm-feature
Jul 2, 2026
Merged

Update: make wasmtime deps optional behind a wasm feature (on by default)#461
0xLeif merged 1 commit into
mainfrom
fix/445-wasm-feature

Conversation

@0xLeif

@0xLeif 0xLeif commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • wasmtime and wasmtime-wasi were unconditional dependencies (~36 transitive crates) purely for the optional sandboxed WASM plugin runtime. Marked both optional = true and added a [features] block with default = ["wasm"] and wasm = ["dep:wasmtime", "dep:wasmtime-wasi"]. Default behavior is unchanged; --no-default-features drops the entire wasmtime dependency tree.
  • Cfg-gated every wasm code path on feature = "wasm":
    • mod wasm; in src/plugin/mod.rs
    • the WASM run-time dispatch in src/plugin/run_plugin.rs
    • the WASM pre-compile step in src/plugin/install.rs
  • For the disabled path, both the run and install sites now bail! with a clear error: "Plugin '<name>' requires the WASM runtime, which was not compiled in (rebuild with --features wasm)."
  • Gated the protocol re-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) β€” clean
  • cargo build --no-default-features β€” clean, warning-free
  • cargo tree -i wasmtime: present with default features, absent with --no-default-features
  • cargo test --bin fledge (default) β€” 897 passed, 0 failed
  • cargo 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

…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
@0xLeif
0xLeif requested a review from a team as a code owner July 2, 2026 15:05
@0xLeif
0xLeif requested review from 0xGaspar, Kyntrin and tofu-ux July 2, 2026 15:05

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 0xGaspar 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.

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.

@github-actions github-actions Bot 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.

βœ… 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

@0xLeif
0xLeif merged commit 8cc2161 into main Jul 2, 2026
13 checks passed
@0xLeif
0xLeif deleted the fix/445-wasm-feature branch July 2, 2026 15:48
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.

Build: feature-gate the WASM plugin runtime

2 participants