Stream: git-wasmtime

Topic: wasmtime / PR #14875 [DO NOT REVIEW] Fill gaps in WASI na...


view this post on Zulip Wasmtime GitHub notifications bot (Oct 19 2026 at 23:48):

jrandolf opened PR #14875 from jrandolf:wasi-named-imports-coverage to bytecodealliance:main:

This fills the gaps in WASI named-import (implements) support from #14858, one commit per step:

A few notes:

Closes #14858

view this post on Zulip Wasmtime GitHub notifications bot (Oct 20 2026 at 20:39):

jrandolf updated PR #14875.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 20 2026 at 22:37):

jrandolf updated PR #14875.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 20 2026 at 22:47):

jrandolf edited PR #14875:

This fills the gaps in WASI named-import (implements) support from #14858, one commit per step:

A few notes:

Closes #14858

view this post on Zulip Wasmtime GitHub notifications bot (Oct 21 2026 at 18:29):

jrandolf updated PR #14875.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 21 2026 at 19:05):

jrandolf edited PR #14875:

This fills the gaps in WASI named-import (implements) support from #14858, one commit per step:

keyvalue, config and nn now depend on wasmtime-wasi to share its NamedId, which roughly doubles their dependency trees. I'd appreciate a second opinion on whether that's the right way to share it. wasi:clocks/timezone isn't covered, since wasmtime-wasi doesn't implement it at all.

Closes #14858

<details>
<summary>LLM summary of the changes</summary>

1. trappable_error_type conversions get the id (wit-bindgen)

With named_imports, bindgen! passed the host-chosen id to every generated method except the convert_* methods for trappable_error_type. Converting wasi:io/streams' stream-error pushes an error resource into the table, which with named imports is found through the id. The generated code now clones the id for the call when the function has a trappable error and passes it to the conversion, in the sync, store and async cases, and the generated convert_* trait methods take it as their first argument.

This changes the signature of convert_* for embedders implementing named-import traits with trappable_error_type. The existing named conversions in wasmtime-wasi and wasmtime-wasi-http are updated; they don't need the id and ignore it.

2. Labelled wasi:io (wasi/src/p2)

3. Synchronous named imports (wasi/src/p2, wasi-http/src/p2)

4. keyvalue, config, tls and nn

Each crate follows the pattern of wasmtime-wasi's named imports (#14275):

The implementations look up the context for the id and call the existing implementations. In wasi-tls p3, send, receive and connect use Access/Accessor, whose getters are plain function pointers that can't close over a NamedId. Their bodies move into free functions that are generic over the getter, unchanged except that store.get() becomes getter(store.data_mut()), and ResultProducer stores a generic getter.

Dependencies

keyvalue, config and nn now have wasmtime-wasi as a regular dependency instead of a dev-dependency, for NamedId (a usize newtype) and WasiCtxNamedView (a one-field wrapper). It's used without default features, but its non-optional dependencies such as tokio still come along. Their normal dependency trees grow from 77 to 151 crates (config), 81 to 151 (keyvalue) and 102 to 166 (nn). Cargo.lock doesn't change.

Interaction with #14873

#14873 changes the signature of the add_named_to_linker lookup. Whichever of the two lands second needs to port the new functions here, which is mechanical.

Tests

</details>


Last updated: Oct 31 2026 at 23:03 UTC