Commit Graph
1 Commits
Author SHA1 Message Date
Ivan FBandClaude Opus 5 6eb524d245 build(wasm): brokers copy that can be imported with --threads:off
The edge build is --threads:off. brokers' EventBroker / RequestBroker /
SignalBroker macros each carry a

    when not compileOption("threads"):
      {.error: "... requires --threads:on".}

inside the macro's OWN body. A `{.error.}` pragma is evaluated when the macro
is semchecked -- that is, on a plain `import` -- so threads-off the modules
cannot be imported at all, not merely used in mt mode. Gating the macro call
sites is therefore not sufficient; roughly a dozen modules in the waku tree
import request_broker/event_broker without ever invoking them threads-off.

So wasm-deps/brokers is bumped from the old 3.1.1 snapshot to the pinned 3.3.0
with those six pragmas rewritten as `macros.error(...)` calls, which fire only
if the macro is actually invoked in that mode. That is the correct behaviour
and worth upstreaming; scripts/patch_wasm_brokers.py reapplies it after a bump.

config.nims switches the override in under -d:emscripten, after the Nimble
block: Nim prepends each --path as it is registered, so the last one wins, and
config-file paths are registered after the command line. Passing --path in the
build script does not work for this reason -- the nimble copy still wins.

backend_comm.nim additionally gates its own mt broker declarations, which
genuinely cannot exist threads-off, and defines just the response types the
persistency facade names. Those are inert: the facade's threads-off path never
reaches a provider, and the browser build has no persistence.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012qDYE5r2t2dMry5XpWWySu
2026-08-08 01:45:09 +02:00