You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Verified directly (real Emscripten build + node smoke test, not just reading the roadmap checkmarks):
make wasm builds libcwist_wasm.a clean from src/core/{sstring,seq,seq_auth}, sys/err/error.c, net/http/{http,mux,query,cookie,session}.c, sys/app/{app,middleware,config,logger,shutdown,big_dumb_reply,test_client}.c, core/{siphash,utils/json_builder,utils/json_heal,utils/zod,template,html/builder,html/css_composer,validation/bind,mem/alloc,mem/arena}.c, and cJSON.c. Deliberately excludes sockets, TLS, QUIC/HTTP-3, gRPC (needs HTTP/2), WebSocket transport, threads/scheduler, compression, DB/sync clients.
cwist_app_dispatch_memory() + <cwist/wasm/typedarray.h> (CWIST_WASM_EXPOSE_*, CWIST_WASM_INSTALL_VIEWS, Module.cwistView.{u8,i32,f64}) work end to end: make wasm-smoke actually runs a real request through a real handler and reads the response back as a zero-copy Uint8Array from JS. Confirmed passing right now.
This is a real, working foundation — but it's a library artifact you have to build yourself and wire up by hand. "Usable enough to actually reach for" needs the gaps below closed.
Gaps found while verifying
cwist_db WASM claim doesn't match the build. ROADMAP.md marks cwist_db_open_memory()/cwist_db_serialize() as a shipped WASM feature (v3.4 checklist), but src/core/db/db.c and lib/sqlite3/sqlite3.c are not in Makefile's WASM_SRCS. Either the roadmap entry is wrong, or the wiring was never finished — needs one or the other fixed before anyone tries to use it.
No WASM CI.wasm-smoke is explicitly "not part of make test since CI has no Emscripten toolchain" (Makefile comment). Nothing catches a WASM-only regression except someone manually running it — which is how gap Add doxygen style comments #1 above went unnoticed.
No packaged/published artifact. There's no npm package, no versioned .wasm/.js release asset, nothing beyond "clone the repo, install Emscripten yourself, run make wasm". Every consumer re-derives the EM_JS glue from scratch.
No docs. No docs/api/wasm.md. The only end-user-facing mention is a few lines in the Korean tutorial about css_composer.c being WASM-buildable — nothing documenting cwist_app_dispatch_memory, the TypedArray helpers, or which subsystems are actually in-scope.
Browser/Emscripten only. Everything here targets Module.cwistView + EM_JS, i.e. a browser or Node-with-Emscripten host. No WASI target, so CWIST handlers can't run on WASI-based edge runtimes (Cloudflare Workers, wasmtime, Fastly Compute) — which is presumably what ROADMAP.md's separate, still-🔮 "Serverless / WASM Runtime: Edge deployment target" line is actually after. Worth deciding whether that's this workstream's endgame or a genuinely separate effort.
No streaming.cwist_app_dispatch_memory() is whole-request-in, whole-response-out. Fine for a single edge-function invocation; not fine for anything that wants to stream a large response back to JS incrementally.
Session/cookie story is unclear under WASM.cookie.c/session.c compile into libcwist_wasm.a, but nothing documents or tests how session state is expected to persist across calls when the host (a Service Worker, a JS fetch handler) may not keep the same WASM instance alive between requests.
No example app.tests/wasm_smoke.c is a smoke test (one route, asserts response bytes), not a demonstration of a realistic app — no example showing routing + validation (zod.c, already compiled in) + templating (template.c/html/builder.c, already compiled in) actually being used together from JS.
Proposed roadmap (toward "comfortable to actually use")
Phase 1 — Fix what's already claimed done
Resolve the cwist_db WASM gap: either wire db.c/sqlite3.c into WASM_SRCS and verify cwist_db_open_memory/cwist_db_serialize really work under Emscripten, or correct ROADMAP.md to stop claiming it.
Add a WASM build+smoke job to CI (install Emscripten in the runner image or use emsdk's Docker image) so wasm/wasm-smoke stop being a manual-only check.
Phase 2 — Developer experience / packaging
Write docs/api/wasm.md: what's in scope, the dispatch_memory + TypedArray pattern, a minimal end-to-end example.
Publish a versioned build artifact (npm package wrapping the .wasm/.js glue, or a GitHub Release asset alongside native binaries) so npm install replaces "clone + install emsdk + make wasm".
A small first-party JS wrapper module (thin fetch-shaped API over Module.cwistView/ccall) so consumers don't hand-roll EM_JS glue for the common case.
Phase 3 — Expand the supported surface
Decide and scope a WASI target for edge runtimes, separate from the browser/Emscripten target — this is the actual gap between today's WASM support and ROADMAP's "Serverless / WASM Runtime" line.
Streaming response support for dispatch_memory (or a parallel streaming entry point) for larger payloads.
Document (and add a test for) the session/cookie persistence model under a request-per-call WASM host.
Phase 4 — Real example
A full example app (routing + zod validation + template/html/builder rendering + cwist_db once Phase 1 lands) as a Cloudflare Worker or Service Worker demo, checked into example/ alongside the existing native examples.
Where WASM support actually stands today
Verified directly (real Emscripten build +
nodesmoke test, not just reading the roadmap checkmarks):make wasmbuildslibcwist_wasm.aclean fromsrc/core/{sstring,seq,seq_auth},sys/err/error.c,net/http/{http,mux,query,cookie,session}.c,sys/app/{app,middleware,config,logger,shutdown,big_dumb_reply,test_client}.c,core/{siphash,utils/json_builder,utils/json_heal,utils/zod,template,html/builder,html/css_composer,validation/bind,mem/alloc,mem/arena}.c, andcJSON.c. Deliberately excludes sockets, TLS, QUIC/HTTP-3, gRPC (needs HTTP/2), WebSocket transport, threads/scheduler, compression, DB/sync clients.cwist_app_dispatch_memory()+<cwist/wasm/typedarray.h>(CWIST_WASM_EXPOSE_*,CWIST_WASM_INSTALL_VIEWS,Module.cwistView.{u8,i32,f64}) work end to end:make wasm-smokeactually runs a real request through a real handler and reads the response back as a zero-copyUint8Arrayfrom JS. Confirmed passing right now.This is a real, working foundation — but it's a library artifact you have to build yourself and wire up by hand. "Usable enough to actually reach for" needs the gaps below closed.
Gaps found while verifying
cwist_dbWASM claim doesn't match the build. ROADMAP.md markscwist_db_open_memory()/cwist_db_serialize()as a shipped WASM feature (v3.4 checklist), butsrc/core/db/db.candlib/sqlite3/sqlite3.care not inMakefile'sWASM_SRCS. Either the roadmap entry is wrong, or the wiring was never finished — needs one or the other fixed before anyone tries to use it.wasm-smokeis explicitly "not part ofmake testsince CI has no Emscripten toolchain" (Makefile comment). Nothing catches a WASM-only regression except someone manually running it — which is how gap Add doxygen style comments #1 above went unnoticed..wasm/.jsrelease asset, nothing beyond "clone the repo, install Emscripten yourself, runmake wasm". Every consumer re-derives the EM_JS glue from scratch.docs/api/wasm.md. The only end-user-facing mention is a few lines in the Korean tutorial aboutcss_composer.cbeing WASM-buildable — nothing documentingcwist_app_dispatch_memory, the TypedArray helpers, or which subsystems are actually in-scope.Module.cwistView+EM_JS, i.e. a browser or Node-with-Emscripten host. No WASI target, so CWIST handlers can't run on WASI-based edge runtimes (Cloudflare Workers, wasmtime, Fastly Compute) — which is presumably what ROADMAP.md's separate, still-🔮 "Serverless / WASM Runtime: Edge deployment target" line is actually after. Worth deciding whether that's this workstream's endgame or a genuinely separate effort.cwist_app_dispatch_memory()is whole-request-in, whole-response-out. Fine for a single edge-function invocation; not fine for anything that wants to stream a large response back to JS incrementally.cookie.c/session.ccompile intolibcwist_wasm.a, but nothing documents or tests how session state is expected to persist across calls when the host (a Service Worker, a JS fetch handler) may not keep the same WASM instance alive between requests.tests/wasm_smoke.cis a smoke test (one route, asserts response bytes), not a demonstration of a realistic app — no example showing routing + validation (zod.c, already compiled in) + templating (template.c/html/builder.c, already compiled in) actually being used together from JS.Proposed roadmap (toward "comfortable to actually use")
Phase 1 — Fix what's already claimed done
cwist_dbWASM gap: either wiredb.c/sqlite3.cintoWASM_SRCSand verifycwist_db_open_memory/cwist_db_serializereally work under Emscripten, or correct ROADMAP.md to stop claiming it.emsdk's Docker image) sowasm/wasm-smokestop being a manual-only check.Phase 2 — Developer experience / packaging
docs/api/wasm.md: what's in scope, thedispatch_memory+ TypedArray pattern, a minimal end-to-end example..wasm/.jsglue, or a GitHub Release asset alongside native binaries) sonpm installreplaces "clone + install emsdk + make wasm".fetch-shaped API overModule.cwistView/ccall) so consumers don't hand-rollEM_JSglue for the common case.Phase 3 — Expand the supported surface
dispatch_memory(or a parallel streaming entry point) for larger payloads.Phase 4 — Real example
zodvalidation +template/html/builderrendering +cwist_dbonce Phase 1 lands) as a Cloudflare Worker or Service Worker demo, checked intoexample/alongside the existing native examples.