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
feat(bindgen): per-function async override for p3 (async_interfaces) (#526) (#527)
`rust_wasm_component_bindgen(wasi_version="p3")` hardcoded `--async all`, so
every export — including plain-sync WIT functions — was lifted async. A
call-return consumer (e.g. a witness MC/DC harness) cannot invoke an async-lift
export, forcing a separate p2 sibling component just to expose one sync entry
point (#526).
Add an `async_interfaces` parameter exposing wit-bindgen's `--async` filters on
the guest bindings. Default is unchanged (p3 -> ["all"], p2 -> []). Callers can
now pass:
[] # no --async: each export follows its WIT
# signature (async-typed async, sync sync)
["-all"] # force every export sync
["-export:pkg:iface/i@0.1.0#fn"] # that export sync, others WIT-default
["pkg:iface/i@0.1.0#stream-fn"] # that export async, others WIT-default
Also fix `_build_async_args` to emit `--async=VALUE` (not `--async VALUE`) so
filter values beginning with `-` (`-all`, `-export:...`) aren't misparsed by
clap as separate flags.
Verified end-to-end: new //test/p3:hello_p3_sync builds a p3 component whose
`greet` export is a plain sync `fn` (no async, no cfg dance) via
async_interfaces=["-export:hello:interfaces/greeting@0.1.0#greet"]. Under the
p3 default this fails to compile ("method should be `async` or return a future,
but it is synchronous"); generated bindings drop from 3 async-lift exports to 0.
Default p3 path (hello_p3, --async=all) still builds — no regression.
Findings captured for the wit-bindgen 0.54 contract: filter names require the
package version; combining `all` with a per-export `-export:` exclude is
rejected ("unused async option") — use [] (WIT defaults) or the allowlist form.
Refs: pulseengine/relay#202, pulseengine/witness#107
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0 commit comments