Commit caa2216
fix(snif): make Wasmex an optional, absence-guarded dependency (#46)
## Why
`Burble.Coprocessor.SNIFBackend` referenced `Wasmex.start_link/1` and
`Wasmex.call_function/3` directly while `:wasmex` is not even a declared
dependency, and `available?/0` only checked the `.wasm` file existed.
That produced a compile-time `Wasmex … is undefined` warning and the
wrong runtime failure mode (rescued exception per call instead of clean
degradation).
## What
Applies the accepted `:quicer` / `Burble.Bolt.Quic` pattern from
**ADR-0004** to `:wasmex`:
* **`server/mix.exs`** — `:wasmex` documented in the existing
optional-NIF
block (Rust/wasmtime toolchain), commented like `quicer`/`elmdb`.
* **`snif_backend.ex`** — `@wasmex Wasmex` alias; calls via `apply/3` so
the compiler does not warn when absent; `available?/0` now also
requires `Code.ensure_loaded?(@wasmex)` + `function_exported?`, so the
existing `if available?()` guards transparently fall back to
`ZigBackend`.
* **CHANGELOG** — Fixed entry.
## Verification
`mix compile --force --no-deps-check` → no `Wasmex` warning, no new
unused/undefined warnings in `snif_backend.ex`. Pure consistency/bugfix;
no behaviour change when Wasmex *is* present.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 5286eea commit caa2216
3 files changed
Lines changed: 18 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
24 | 27 | | |
25 | 28 | | |
26 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
160 | 166 | | |
161 | 167 | | |
162 | | - | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
163 | 171 | | |
164 | 172 | | |
165 | 173 | | |
| |||
512 | 520 | | |
513 | 521 | | |
514 | 522 | | |
515 | | - | |
| 523 | + | |
516 | 524 | | |
517 | | - | |
| 525 | + | |
518 | 526 | | |
519 | 527 | | |
520 | 528 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
199 | 202 | | |
200 | 203 | | |
201 | 204 | | |
202 | 205 | | |
| 206 | + | |
203 | 207 | | |
204 | 208 | | |
205 | 209 | | |
| |||
0 commit comments