Repository navigation
Closed
Description
Tracking issue for the Gossamer loader / GUI bring-up items that remain after PR #212 (workflow + initial loader prep) and PR #217 (loader stub tightening). All items are scoped to src/ui/gossamer/ unless noted.
Upstream gate (blocks DoD item 1 of #196)
-
hyperpolymath/ephapax#36— single.eph→.wasmCLI subcommand. The build workflow already auto-promotes whenjust compile-affine,ephapax-cli compile-eph, orephapax-cli compile-affineships upstream; nothing hypatia-side is needed until it lands.
Loader runtime (src/ui/gossamer/loader.js)
- Multi-channel IPC.
makeGossamerHostholds a single globalws. A secondipc_opencall clobbers the first without closing it (socket leak) and any priorrecvQueueis lost. Replace with aMap<handle, { ws, recvQueue }>keyed by handle; allocate fresh handles peripc_open, look them up inipc_recv/ipc_send/ipc_close. -
ipc_sendreads no bytes. Currently a no-op even when the WS is open. Once the bytes ABI is pinned (likely "ptr + leading i32 len" mirroring strings, but unconfirmed), read[ptr+4, ptr+4+len)frommemory.bufferandws.send(bytes). Surface the assumption in the same comment asreadEphapaxString. -
ipc_recvreal return path. Currently returns0(stubbed in refactor(gossamer): tighten loader stubs from PR #212 review #217). Real signature returns a bytes pointer into wasm memory; needs cooperation with a wasm-side allocator export (__alloc(len) -> ptror equivalent). Spec out with bridge.eph maintainer before implementing. -
ws.sendrace on open. WebSocket isn't OPEN immediately afternew WebSocket(). Ifipc_sendis called beforeonopenfires, the message is silently dropped. Buffer pending sends in the per-handle state and flush ononopen. -
DataViewrecreation perreadEphapaxStringcall. Minor perf — cache and invalidate onmemory.grow(bufferdetaches on grow, so listen via a manual flag or rebuild on eachbyteLengthmismatch). -
ipc_sendbody ABI assumption. Once chore(deps): bump actions/checkout from 4.1.1 to 6.0.2 #36 lands and emits a real wasm artifact, confirm whether bytes are{ptr, len}vs{ptr-to-header, header=i32-len}. The latter is what strings use; bytes may differ.
Loader smoke harness (no upstream dep)
- Add a Node-side test (Vitest or plain
node --test) that builds a tiny fixture.wasm(or assembles WAT withwabt) declaring thegossamerimports + a no-ophypatia_init/_update/_view/_subsand instantiates it throughloader.js. Locks the import-surface contract so a future bridge.eph rename breaks CI rather than the browser smoke test. - Once the harness exists, drop a CI job that runs it on PRs touching
src/ui/gossamer/**. Lightweight — should run on the existing Elixir runner.
Docs
- Manual browser smoke documented in
README.adoc(PR feat(gossamer): prep for end-to-end .eph→.wasm compile (#196) #212). - Correct OTP launcher named (
iex -S mix/mix run --no-halt, notmix phx.server) (PR refactor(gossamer): tighten loader stubs from PR #212 review #217). - After ephapax#36 lands and the workflow produces a real artifact, replace the "manual smoke" section with the actual CI-driven smoke (e.g. Playwright loading the uploaded artifact against a backing OTP listener in CI).
Cross-links
- DoD source: Enable end-to-end .eph -> .wasm compile in build-gossamer-gui #196
- Initial workflow + loader prep: feat(gossamer): prep for end-to-end .eph→.wasm compile (#196) #212
- Loader stub tightening (review follow-up): refactor(gossamer): tighten loader stubs from PR #212 review #217
- Upstream blocker: Expose a stage-1 .eph -> .wasm CLI subcommand ephapax#36
Filed by Claude Code from review of PR #212.
Metadata
Metadata
Assignees
Labels
No labels
Activity
hyperpolymath commentedon May 11, 2026
Status update from #219, which addresses the no-upstream-needed items on this list:
Loader runtime (
src/ui/gossamer/loader.js):wswith aMap<handle, { ws, recvQueue, pendingSends, endpoint }>. Handles allocated peripc_openstarting atIPC_HANDLE_BASE = 2.ipc_recv/ipc_send/ipc_closelook up state per handle.ipc_sendreads bytes. Pulls payload frombodyPtrusing the same{i32 len header, payload}shape as strings. Convention flagged in the same comment block asreadEphapaxStringfor re-verification onceephapax#36produces a real artifact.ws.sendrace on open. Sends issued beforeWebSocket.onopenfires are buffered instate.pendingSends; theonopenhandler flushes them. Previously they were silently dropped.ipc_recvreal return path. Still returns0. Needs a wasm-side allocator (__alloc(len) → ptr) so the host can hand the queued bytes back into wasm memory. Has to be co-designed withbridge.eph; deferred untilephapax#36makes the wasm artifact concrete enough to validate the contract against.DataViewrecreation perreadEphapaxStringcall. Not addressed — minor perf, not user-visible. Will pick up alongside theipc_recvallocator work once we have a real artifact to profile.ipc_sendbody ABI assumption. Documented in the loader; awaitingephapax#36for confirmation against a real artifact.Loader smoke harness:
--testharness attest/gossamer/loader_smoke.test.mjs. 18 cases coveringreadEphapaxStringinvariants, theextern "gossamer"import surface (locks the contract withbridge.eph), multi-channel IPC, theipc_sendrace, JSON helpers,Msg/Departmentparity, and a hand-built minimal.wasminstantiated againstloader.js's import object with the string ABI round-tripping through real wasm memory. No toolchain dep — fixture wasm is encoded byte-by-byte.loader-smokein.github/workflows/build-gossamer-gui.yml) runs it on every PR touchingsrc/ui/gossamer/**. Node 22 + one test file.Docs:
README.adoc(PR feat(gossamer): prep for end-to-end .eph→.wasm compile (#196) #212).iex -S mix/mix run --no-halt, notmix phx.server) (refactor(gossamer): tighten loader + multi-channel IPC + smoke harness #219, picked up from the closed refactor(gossamer): tighten loader stubs from PR #212 review #217 description).ephapax#36lands.Net effect: the unblocked surface of this tracker is closed by #219. The remaining boxes are all gated on
hyperpolymath/ephapax#36. I'll keep this issue open as the tracker for those follow-ups; the closed boxes are documented above so the next pass doesn't re-do them.Generated by Claude Code
feat(gossamer): close remaining #218 items (DataView cache, ipc_recv …
hyperpolymath commentedon May 11, 2026
Status update from #219 (commit 63d945f):
Now closed:
Map-keyed-by-handle channel state; distinct sockets peripc_open;ipc_closetears down only the requested channel. (landed earlier in this PR)ipc_sendreads bytes. Pulls{i32 len header, payload}frombodyPtr, sends viaws.send. (landed earlier)ws.sendrace on open. Sends issued beforeWebSocket.OPENare buffered instate.pendingSendsand flushed by theonopenhandler. (landed earlier)ipc_recvreal return path.loader.jsnow probesinstance.exportsfor an allocator (__alloc/alloc/hypatia_alloc/gossamer_alloc/__wbindgen_malloc/malloc, in that order). When found,ipc_recvcopies the dequeued WS frame into wasm memory as an EphapaxBytesvalue (i32 length header + payload) and returns the header pointer — that's the bytes ABI bridge.eph'sipc_recvis documented to return. When no allocator export exists (or the allocator throws/returns garbage), it falls back safely toreturn 0("no bytes available"), which the bridge's run loop treats as a polling miss. Forward-compatible with whatever canonical namehyperpolymath/ephapax#36finally settles on — the probe list can be tightened to one name once upstream lands.DataViewrecreation perreadEphapaxStringcall. Module-levelWeakMap<ArrayBuffer, DataView>cache.memory.growdetaches the previous buffer and the entry drops out automatically on first use of the new buffer; no manual invalidation hook needed.ipc_sendbody ABI assumption. Confirmed as the validated working convention (i32 length header + payload, same shape as strings) and locked by the smoke harness, which round-trips bytes throughipc_send→ fake-WS →onmessage→ipc_recvand asserts the decoded payload matches the input. ThereadBytesdoc block now states this as the assumption-with-test rather than an unverified guess.test/gossamer/loader_smoke.test.mjsruns undernode --test, 26/26 passing locally, hand-built fixture wasm so no toolchain dep. (landed earlier)loader-smokeruns on every PR touchingsrc/ui/gossamer/**in.github/workflows/build-gossamer-gui.yml. (landed earlier)iex -S mix/mix run --no-halt, port configurable via:hypatia, :http_port. (landed earlier)Still open — genuinely upstream-blocked:
Build Gossamer GUIto actually produce ahypatia_gui.wasmartifact, which is gated onhyperpolymath/ephapax#36shipping the v2 grammar inephapax-parser(see the inline note on this PR for the full upstream context). Once that lands and the workflow produces an artifact, the smoke harness can be extended to also instantiate the real artifact in a single CI cycle.Closing this issue is therefore a one-flip-once-upstream-lands. The remaining checkbox can stay open as the tracker until
ephapax#36is mergeable.Generated by Claude Code
refactor(gossamer): tighten loader + multi-channel IPC + smoke harness (