| name | wasi-fixtures |
| description | Add or update WASI preview1/wasip2 fixture smokes, regenerate catalogs, and run coverage runtime gates. Use when working on fixtures/wasip1, fixtures/wasip2, smoke_templates, generate_fixtures, or RUNTIME_EXCEPTIONS. |
WASI fixture maintenance (Ark)
Layout
| Path | Role |
|---|
fixtures/wasip1/ | Preview1 runtime fixtures (tests/wasip1_spec/generate_fixtures.py) |
fixtures/wasip2/runtime/ | Component runtime smokes (tier=runtime) |
fixtures/wasip2/compile_only/ | Import ABI stubs + blocked cases |
tests/wasip2_spec/smoke_templates.py | Runtime smoke bodies + RUNTIME_EXCEPTIONS |
tests/wasip2_spec/wasip2_sig.py | Canonical import signatures for codegen |
tests/wasip2_spec/runtime_exceptions.txt | Human-readable blocked list (doc) |
Regenerate
python3 tests/wasip2_spec/generate_fixtures.py
python3 tests/wasip1_spec/generate_fixtures.py
python3 scripts/gen_fixture_remediation_doc.py
Catalogs updated: tests/wasip2_spec/{functions,runtime,compile_only}.catalog.
Gates (native)
moon test -p coverage --target native --filter "wasip1 runtime fixture execution"
moon test -p coverage --target native --filter "wasip2 native command runtime fixture wasmtime execution"
moon test -p coverage --target native --filter "wasip2 native command compile_only compile and WIT import ABI"
moon test -p cmd/ark --target native --filter "wasip2 compat"
Adding a wasip2 runtime smoke
- Implement
render_wasip2_smoke() branch or helper in smoke_templates.py.
- If the import cannot run under
component-wasi02-command + wasmtime, add (wit_iface, field) to RUNTIME_EXCEPTIONS and document in runtime_exceptions.txt.
- Regenerate fixtures; run both wasip2 gates above.
moon info && moon fmt in touched MoonBit packages.
Patterns that work
- Stdout marker:
expect_guest_stdout=tag: + blocking_write_and_flush(get_stdout(), ...).
- Sockets:
create_*_socket(0, 256) → handle at load_i32(260); start-bind / start-connect use address args 0, 128, 16 (not p0=128).
- TCP/UDP lifecycle methods: listed in
_SOCKET_RUNTIME_ALLOW (finish-bind, start-bind, local-address, etc.).
- Wall clock
now: import alias wall_clock_now — now is an Ark keyword; tag-only smoke (datetime bytes OK on resolution via write_datetime_bytes).
- Monotonic subscribe:
drop(subscribe_instant(0)) / subscribe_duration(0) + tag stdout.
Permanently blocked (keep compile_only)
| Area | Reason |
|---|
wasi:http/types ctors/static | wasmtime missing http resource linker |
wasi:http/outgoing-handler handle | live HTTP / proxy |
resolve-addresses, resolve-address-stream | CI network + invalid handles |
| UDP datagram-stream receive/send/subscribe | invalid handle / ABI mismatch |
get-random-bytes, get-insecure-random-bytes | list-u8 return ABI vs guest len, buf stub |
poll | guest list ABI vs component typecheck (list<borrow<pollable>> lowering) |
filesystem-error-code, error.to-debug-string | borrow handle 0 invalid at runtime |
wasi:cli/exit | runtime smoke writes exit:42 then calls exit(0) (wasmtime does not surface guest status 42) |
wasi:clocks/timezone@0.2.0 | not in command world (experimental compile_only only) |
HTTP bulk (~50 compile_only)
Do not delete RUNTIME_EXCEPTIONS entries for http types until linker resources exist in the component pipeline. Optional future work: narrow http-proxy world in compile/component_build.mbt + coverage gate.
Target isolation gates
coverage/gate.mbt rejects cross-target WASI imports in compiled wasm:
- wasip1:
check_no_wasip2_import_modules — no wasi: WIT module names in preview1 fixtures.
- wasm2:
check_no_wasi_import_modules — no wasi* import modules in core wasm2 fixtures.
Do not repeat
- http ctors without linker resources
- UDP receive hang / datagram streams without lifecycle fix
resolve-address-stream with dummy handle 20
start-bind with p0=128 (use p0=0, p1=128, p2=16)