Symptom
cargo check --target wasm32-unknown-unknown -p willow-network --all-features fails because crates/network/src/mem.rs uses tokio::sync::broadcast + tokio::select! without a cfg(not(target_arch = "wasm32")) gate. Reproduces clean on main @ 0b051c1.
Why this isn't caught today
The project's actual wasm gate (just check-wasm, justfile:144) runs cargo check --target wasm32-unknown-unknown without --all-features. MemNetwork is gated behind the test-utils feature and is opt-in for native test consumers; under default features it's not compiled, so the wasm gate stays green.
Why anyone would hit it
A future contributor running cargo check --all-features --target wasm32-unknown-unknown (e.g. for a workspace-wide audit) trips on this. Discovered while running #258's local merge gate — implementer flagged it as pre-existing, out of scope for the 2-line _ => exhaustive-match fix.
Suggested fix
Two reasonable options:
- Gate
mem.rs behind #[cfg(not(target_arch = "wasm32"))] at the module / feature level so the test-utils feature still compiles cleanly under wasm (no-op on wasm, since MemNetwork is a native-only test double anyway). Cleanest option — matches the documented test-double role.
- Drop
MemNetwork from --all-features on wasm by making the test-utils feature itself native-only via a target-conditional dep / cfg gate.
Option 1 is more surgical. Real production wasm wires IrohNetwork; MemNetwork has no wasm consumer.
Verify
cargo check --target wasm32-unknown-unknown -p willow-network --all-features # expect: success after fix
just check-wasm # expect: still passes (regression check)
Refs
Symptom
cargo check --target wasm32-unknown-unknown -p willow-network --all-featuresfails becausecrates/network/src/mem.rsusestokio::sync::broadcast+tokio::select!without acfg(not(target_arch = "wasm32"))gate. Reproduces clean onmain@0b051c1.Why this isn't caught today
The project's actual wasm gate (
just check-wasm,justfile:144) runscargo check --target wasm32-unknown-unknownwithout--all-features.MemNetworkis gated behind thetest-utilsfeature and is opt-in for native test consumers; under default features it's not compiled, so the wasm gate stays green.Why anyone would hit it
A future contributor running
cargo check --all-features --target wasm32-unknown-unknown(e.g. for a workspace-wide audit) trips on this. Discovered while running #258's local merge gate — implementer flagged it as pre-existing, out of scope for the 2-line_ =>exhaustive-match fix.Suggested fix
Two reasonable options:
mem.rsbehind#[cfg(not(target_arch = "wasm32"))]at the module / feature level so the test-utils feature still compiles cleanly under wasm (no-op on wasm, since MemNetwork is a native-only test double anyway). Cleanest option — matches the documented test-double role.MemNetworkfrom--all-featureson wasm by making thetest-utilsfeature itself native-only via a target-conditional dep / cfg gate.Option 1 is more surgical. Real production wasm wires
IrohNetwork;MemNetworkhas no wasm consumer.Verify
Refs
MemNetworkandIrohNetworkhave asymmetric unknown-event handling — test double hides production bugs #258 local merge gate (commitd19de75).MemNetworkdoc:crates/network/src/mem.rs("test-utils feature only" / native-only test double perCLAUDE.mdrepository-structure section).