Sub-issue of #94. The host-intrinsic ABI shipped in meld_core::p3_async defines stream/future read/write return values informally:
stream_write returns bytes accepted; accepted < requested = backpressure, retry later.
stream_read returns 0 = EOF, negative = error code.
future_read returns 1 = resolved, 0 = pending, negative = error.
This issue tracks formalising these conventions so meld and downstream runtimes (kiln, wasmtime reference impl) agree:
Tasks
- Define a closed enum of error codes (
ABI_ERR_CLOSED, ABI_ERR_INVALID_HANDLE, ABI_ERR_OOM, ABI_ERR_CANCELLED, …) with stable numeric values.
- Document the semantics of partial writes (must the producer always retry? does the runtime queue?) and EOF distinguishability from "0 bytes available right now".
- Specify how the ABI interacts with the existing
[waitable-set-wait] builtin: does a pending stream read register a waitable, and how is the return value retrieved?
- Companion docs in kiln (the runtime reference) and a wasmtime reference implementation.
- A
tests/p3_async_lowering.rs integration test that exercises each error path.
References
Sub-issue of #94. The host-intrinsic ABI shipped in
meld_core::p3_asyncdefines stream/future read/write return values informally:stream_writereturns bytes accepted;accepted < requested= backpressure, retry later.stream_readreturns 0 = EOF, negative = error code.future_readreturns 1 = resolved, 0 = pending, negative = error.This issue tracks formalising these conventions so meld and downstream runtimes (kiln, wasmtime reference impl) agree:
Tasks
ABI_ERR_CLOSED,ABI_ERR_INVALID_HANDLE,ABI_ERR_OOM,ABI_ERR_CANCELLED, …) with stable numeric values.[waitable-set-wait]builtin: does a pending stream read register a waitable, and how is the return value retrieved?tests/p3_async_lowering.rsintegration test that exercises each error path.References
safety/adr/ADR-1-p3-async-lowering.md) §"What this PR ships" / "Out of scope"