Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `prim__registerCallback` made module-private (unsafe boundary, awaits idris2#3182)
- `docs/developer/wsl-mirrored-networking.adoc` rewritten — NAT + host forwarder is the recommended WSL2 Bolt path; mirrored networking demoted to last-resort (Win11 24H2/Insider `Wsl/Service/E_UNEXPECTED` instability)

### Fixed
- SNIF: `Burble.Coprocessor.SNIFBackend` no longer emits a compile warning for the optional `Wasmex` runtime and no longer mis-fails when it is absent — `Wasmex` is referenced via `apply/3` and `available?/0` now gates on it loadable, so kernels degrade cleanly to `ZigBackend` (mirrors the `:quicer` pattern, ADR-0004)

### Removed
- TODO.md (superseded by CLAUDE-WORK.md — 0 TODOs remain in codebase)

Expand Down
14 changes: 11 additions & 3 deletions server/lib/burble/coprocessor/snif_backend.ex
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,17 @@ defmodule Burble.Coprocessor.SNIFBackend do
3. Verify configuration in `config/runtime.exs`
4. Check `BURBLE_SNIF_PATH` environment variable
"""
# Optional WASM runtime. Referenced via apply/3 (see call_snif_module/3)
# so the compiler does not warn when :wasmex is absent at build time —
# mirrors the Burble.Bolt.Quic / :quicer pattern (ADR-0004). When absent,
# available?/0 is false so every kernel transparently uses ZigBackend.
@wasmex Wasmex

@impl true
def available? do
File.exists?(@snif_path)
File.exists?(@snif_path) and
Code.ensure_loaded?(@wasmex) and
function_exported?(@wasmex, :start_link, 1)
end

# ---------------------------------------------------------------------------
Expand Down Expand Up @@ -512,9 +520,9 @@ defmodule Burble.Coprocessor.SNIFBackend do
# `{:error, reason}` so the caller can fall back gracefully.
defp call_snif_module(path, function, args) do
try do
case Wasmex.start_link(%{bytes: File.read!(path)}) do
case apply(@wasmex, :start_link, [%{bytes: File.read!(path)}]) do
{:ok, pid} ->
result = Wasmex.call_function(pid, function, args)
result = apply(@wasmex, :call_function, [pid, function, args])
GenServer.stop(pid, :normal)
result
{:error, reason} -> {:error, {:wasm_load_failed, reason}}
Expand Down
4 changes: 4 additions & 0 deletions server/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,14 @@ defmodule Burble.MixProject do
# quicer — needs msquic (Microsoft QUIC C library)
# elmdb — links liberl_interface which was dropped in OTP 23+
# ex_lmdb — depends on elmdb
# wasmex — Rust NIF (wasmtime); needs a Rust toolchain. SNIF
# (Burble.Coprocessor.SNIFBackend) transparently degrades
# to ZigBackend when absent — available?/0 gates on it.
#
# {:quicer, github: "emqx/quic", tag: "0.2.15", submodules: true, optional: true},
# {:elmdb, "~> 0.4", optional: true},
# {:ex_lmdb, "~> 0.1", optional: true},
# {:wasmex, "~> 0.9", optional: true},

# Media plane — ex_webrtc SFU (audio-only, Opus)
{:ex_webrtc, "~> 0.16"},
Expand Down
Loading