Skip to content

v0.0.195

Choose a tag to compare

@aallan aallan released this 02 Jul 17:52
91e19d1

Added

  • --world server — verified HTTP handlers as portable wasi:http components (Stage D of the server-effects sprint; spec §13.7). vera compile --target wasi-p2 --world server packages the same contract-checked handle(@Request -> @Response) program vera serve hosts natively (#305) as a component exporting wasi:http/incoming-handler@0.2.0stock wasmtime serve runs it unmodified, no flags (live-tested: routing, handler-set headers, a 1 MiB body byte-identical under GC stress, trap → host 500; imports pinned at @0.2.0, which wasmtime's semver-compatible lookup links — the design study also probed @0.2.3 acceptance). A generated adapter wrapper reads method / path-with-query / headers / body through the wasi:http interfaces into the arena, constructs the Request ADT in the guest heap from the compilation's own constructor layouts (WAT-level shadow-stack rooting throughout), calls handle, decodes the Response, and drives the outgoing-response resource sequence (borrow-before-transfer, child-stream-drop-before-finish, 4096-byte write chunks). Headers without a host: Map<String, String> operations are host imports on the core target, but a Vera Map is two plain guest-heap blocks — the server world implements the String-keyed Map ops in guest WAT with the host's exact semantics (position-preserving update, later-insert-wins, power-of-two capacity growth), pinned by a host-vs-served differential battery (mixed-case / absent / duplicate / 41-header matrix + insertion-order agreement); non-String Map instantiations and all other collection families stay gated. The server-world surface is honest and explicit: IO.print/IO.stderr route to the serve console; read_line/read_char/read_file/write_file/get_env/args/exit are rejected with a diagnostic (negative-probed: those imports do not link under the wasi:http proxy world); bodies are buffered (streaming is future work); request headers share the ~63 KiB arena; an out-of-range status or forbidden header answers 500 instead of trapping the server. The cli-world emission is byte-identical to v0.0.194 (pinned). vera run rejects server-world artifacts with a pointer to wasmtime serve (wasmtime-py's built-in host has no wasi:http); the native vera serve driver is unchanged — one handler, two deployment paths. Design decisions live-validated before implementation (topology: MAIN owns memory, serve wrapper in the adapter, dispatch table 16→32 slots; the check-7 $Libc dodge and incoming-body.finish both superseded — recorded in WASI.md); five mutation kills (later-wins parity, map update-vs-append, Request-build shadow-push via an in-suite eager-GC surgery test, cli-pin leak — which first false-greened on a stale .pyc, purged and confirmed RED — and a family-gate line).