rvolosatovs opened PR #11221 from rvolosatovs:feat/wasip3-part1 to bytecodealliance:main:
This starts the process of moving wasip3 implementation from https://github.com/bytecodealliance/wasip3-prototyping/tree/0bcd54e714e70dbee4dd2d440abb3017997a061e/crates/wasi
- implement
wasi:clocks
- just like in wasip2,timezoneinterface is not implemented yet- implement
wasi:random- add stubs for
Access::getandAccessor::with- add tests, but ignore them, since async machinery still panics
- allow specifying a subdirectory in WIT fetch script, since p3 WIT lives in a draft subdirectory
- extract a common
WasiCtxBuilderto use for both p2 and p3. Unfortunately, inheritance is sort of tricky here - I originally hoped to implementDerefon the p2/p3 builders, but that breaks the chaining that users are used to, e.g.builder.inherit_env().build()would not work, sinceinherit_envwould return a reference to the inner builder, rather than the outer one. Just duplicate the methods for p2 and p3 for now - let's revisit once we have all of the interfaces implemented and more context on how we can handle this. The reason these contexts are different types is primarily stdio - the abstractions are very different for wasip2 and wasip3.
rvolosatovs edited PR #11221:
This starts the process of moving wasip3 implementation from https://github.com/bytecodealliance/wasip3-prototyping/tree/0bcd54e714e70dbee4dd2d440abb3017997a061e/crates/wasi
- implement
wasi:clocks
- just like in wasip2,timezoneinterface is not implemented yet- implement
wasi:random- add stubs for
Access::getandAccessor::with- add tests, but ignore them, since async machinery still panics
- allow specifying a subdirectory in WIT fetch script, since p3 WIT lives in a draft subdirectory
- extract a common
WasiCtxBuilderto use for both p2 and p3. Unfortunately, inheritance is sort of tricky here - I originally hoped to implementDerefon the p2/p3 builders, but that breaks the chaining that users are used to, e.g.builder.inherit_env().build()would not work, sinceinherit_envwould return a reference to the inner builder, rather than the outer one. Just duplicate the methods for p2 and p3 for now - let's revisit once we have all of the interfaces implemented and more context on how we can handle this. A macro is potential solution. The reason these contexts are different types is primarily stdio - the abstractions are very different for wasip2 and wasip3.
rvolosatovs updated PR #11221.
rvolosatovs edited PR #11221:
This starts the process of moving wasip3 implementation from https://github.com/bytecodealliance/wasip3-prototyping/tree/0bcd54e714e70dbee4dd2d440abb3017997a061e/crates/wasi
- implement
wasi:clocks
- just like in wasip2,timezoneinterface is not implemented yet- implement
wasi:random- add stubs for
Access::getandAccessor::with- add tests, but ignore them, since async machinery still panics. the tests are adapted from analogous p2 tests
- allow specifying a subdirectory in WIT fetch script, since p3 WIT lives in a draft subdirectory
- extract a common
WasiCtxBuilderto use for both p2 and p3. Unfortunately, inheritance is sort of tricky here - I originally hoped to implementDerefon the p2/p3 builders, but that breaks the chaining that users are used to, e.g.builder.inherit_env().build()would not work, sinceinherit_envwould return a reference to the inner builder, rather than the outer one. Just duplicate the methods for p2 and p3 for now - let's revisit once we have all of the interfaces implemented and more context on how we can handle this. A macro is potential solution. The reason these contexts are different types is primarily stdio - the abstractions are very different for wasip2 and wasip3.
rvolosatovs edited PR #11221:
This starts the process of moving wasip3 implementation from https://github.com/bytecodealliance/wasip3-prototyping/tree/0bcd54e714e70dbee4dd2d440abb3017997a061e/crates/wasi
- implement
wasi:clocks
- just like in wasip2,timezoneinterface is not implemented yet- implement
wasi:random- add stubs for
Access::getandAccessor::with- add tests, but ignore them, since async machinery still panics. the tests are adapted from analogous p2 tests
- allow specifying a subdirectory in WIT fetch script, since p3 WIT lives in a draft subdirectory
- extract a common
WasiCtxBuilderto use for both p2 and p3. Unfortunately, inheritance is sort of tricky here - I originally hoped to implementDerefon the p2/p3 builders, but that breaks the chaining that users are used to, e.g.builder.inherit_env().build()would not work, sinceinherit_envwould return a reference to the inner builder, rather than the outer one. Just duplicate the methods for p2 and p3 for now - let's revisit once we have all of the interfaces implemented and more context on how we can handle this. A macro is potential solution. The reason these contexts are different types is primarily stdio - the abstractions are very different for wasip2 and wasip3.closes #10061
closes #10063
rvolosatovs edited PR #11221:
This starts the process of moving wasip3 implementation from https://github.com/bytecodealliance/wasip3-prototyping/tree/0bcd54e714e70dbee4dd2d440abb3017997a061e/crates/wasi
- implement
wasi:clocks
- just like in wasip2,timezoneinterface is not implemented yet- implement
wasi:random- add stubs for
Access::getandAccessor::with.
- for now, these are implemented directly in the file they're used in to avoid an import. There is only one occurrence where we need these in this PR and the hoping is that by the time next PR lands, we'll have them available in the runtime.
- add tests, but ignore them, since async machinery still panics. the tests are adapted from analogous p2 tests
- allow specifying a subdirectory in WIT fetch script, since p3 WIT lives in a draft subdirectory
- extract a common
WasiCtxBuilderto use for both p2 and p3. Unfortunately, inheritance is sort of tricky here - I originally hoped to implementDerefon the p2/p3 builders, but that breaks the chaining that users are used to, e.g.builder.inherit_env().build()would not work, sinceinherit_envwould return a reference to the inner builder, rather than the outer one. Just duplicate the methods for p2 and p3 for now - let's revisit once we have all of the interfaces implemented and more context on how we can handle this. A macro is potential solution. The reason these contexts are different types is primarily stdio - the abstractions are very different for wasip2 and wasip3.closes #10061
closes #10063
rvolosatovs has marked PR #11221 as ready for review.
rvolosatovs requested wasmtime-wasi-reviewers for a review on PR #11221.
rvolosatovs requested wasmtime-core-reviewers for a review on PR #11221.
rvolosatovs requested pchickey for a review on PR #11221.
rvolosatovs requested wasmtime-default-reviewers for a review on PR #11221.
rvolosatovs commented on PR #11221:
https://github.com/bytecodealliance/wasmtime/pull/11127 has been added to the merge queue, so looks like I'll have to rebase this on Monday, moving back to draft
alexcrichton submitted PR review:
A few minor thoughts here and there, but overall looks great, thank you @rvolosatovs! With #11127 merged as well mind removing the
#[ignore]on the tests to confirm they pass too?
alexcrichton created PR review comment:
Could the
wasi:cli/run#runfunction be directly marked asasyncto avoid needing to annotate manually here?
alexcrichton created PR review comment:
I think it should be possible to remove these now (yay!, hopefully at least)
alexcrichton created PR review comment:
Ideally we're going to want to smith this if we can, the invocation here is quite large and I'd want to dig in to why the
async: { ... }bits need to be specified (if they even still do, unsure)
alexcrichton created PR review comment:
For all
[async...]things, could the original WITs be updated to haveasync?I realize the is basically the same as my above comment and I also realize that I'm at fault here where I changed the WITs in-repo in wasip3-prototyping, but as we merge upstream this is probably as good a time as any to send PRs to upstream WIT definitions to get
asyncin WITs
alexcrichton created PR review comment:
Could this documentation, and I imagine all other related documentation too for similar functions, also have a clickable link to the "top-level"
add_to_linkerin case folks land on these docs before seeing that?
alexcrichton created PR review comment:
I think this is a duplicate attribute given the one in
main.rstoo
alexcrichton created PR review comment:
Could these get filled out to assist with debugging? That way
println!in tests should work and such I believe. It's fine to leave theTODOcomments though because it's true that yes, ideally, the components don't use WASIp2 at all for tests here (but there's a long way to get there)
alexcrichton created PR review comment:
Mind changing this to
#[expect(...)]? (that way it forces removal of the attribute once it's used)
rvolosatovs updated PR #11221.
rvolosatovs edited PR #11221:
This starts the process of moving wasip3 implementation from https://github.com/bytecodealliance/wasip3-prototyping/tree/0bcd54e714e70dbee4dd2d440abb3017997a061e/crates/wasi
- implement
wasi:clocks
- just like in wasip2,timezoneinterface is not implemented yet- implement
wasi:random- add stubs for
Access::getandAccessor::with.
- for now, these are implemented directly in the file they're used in to avoid an import. There is only one occurrence where we need these in this PR and the hoping is that by the time next PR lands, we'll have them available in the runtime.
- add tests, ~but ignore them, since async machinery still panics.~ the tests are adapted from analogous p2 tests
- allow specifying a subdirectory in WIT fetch script, since p3 WIT lives in a draft subdirectory
- extract a common
WasiCtxBuilderto use for both p2 and p3. Unfortunately, inheritance is sort of tricky here - I originally hoped to implementDerefon the p2/p3 builders, but that breaks the chaining that users are used to, e.g.builder.inherit_env().build()would not work, sinceinherit_envwould return a reference to the inner builder, rather than the outer one. Just duplicate the methods for p2 and p3 for now - let's revisit once we have all of the interfaces implemented and more context on how we can handle this. A macro is potential solution. The reason these contexts are different types is primarily stdio - the abstractions are very different for wasip2 and wasip3.closes #10061
closes #10063
rvolosatovs edited PR #11221:
This starts the process of moving wasip3 implementation from https://github.com/bytecodealliance/wasip3-prototyping/tree/0bcd54e714e70dbee4dd2d440abb3017997a061e/crates/wasi
- implement
wasi:clocks
- just like in wasip2,timezoneinterface is not implemented yet- implement
wasi:random- ~add stubs for
Access::getandAccessor::with.~
- ~for now, these are implemented directly in the file they're used in to avoid an import. There is only one occurrence where we need these in this PR and the hoping is that by the time next PR lands, we'll have them available in the runtime.~
- add tests, ~but ignore them, since async machinery still panics.~ the tests are adapted from analogous p2 tests
- allow specifying a subdirectory in WIT fetch script, since p3 WIT lives in a draft subdirectory
- extract a common
WasiCtxBuilderto use for both p2 and p3. Unfortunately, inheritance is sort of tricky here - I originally hoped to implementDerefon the p2/p3 builders, but that breaks the chaining that users are used to, e.g.builder.inherit_env().build()would not work, sinceinherit_envwould return a reference to the inner builder, rather than the outer one. Just duplicate the methods for p2 and p3 for now - let's revisit once we have all of the interfaces implemented and more context on how we can handle this. A macro is potential solution. The reason these contexts are different types is primarily stdio - the abstractions are very different for wasip2 and wasip3.closes #10061
closes #10063
rvolosatovs updated PR #11221.
rvolosatovs assigned rvolosatovs to PR #11221.
rvolosatovs edited PR #11221 (assigned to rvolosatovs):
This starts the process of moving wasip3 implementation from https://github.com/bytecodealliance/wasip3-prototyping/tree/0bcd54e714e70dbee4dd2d440abb3017997a061e/crates/wasi
- implement
wasi:clocks
- just like in wasip2,timezoneinterface is not implemented yet- implement
wasi:random- ~add stubs for
Access::getandAccessor::with.~
- ~for now, these are implemented directly in the file they're used in to avoid an import. There is only one occurrence where we need these in this PR and the hoping is that by the time next PR lands, we'll have them available in the runtime.~
- add tests, ~but ignore them, since async machinery still panics.~ the tests are adapted from analogous p2 tests
- allow specifying a subdirectory in WIT fetch script, since p3 WIT lives in a draft subdirectory
- extract a common
WasiCtxBuilderto use for both p2 and p3. Unfortunately, inheritance is sort of tricky here - I originally hoped to implementDerefon the p2/p3 builders, but that breaks the chaining that users are used to, e.g.builder.inherit_env().build()would not work, sinceinherit_envwould return a reference to the inner builder, rather than the outer one. Just duplicate the methods for p2 and p3 for now - let's revisit once we have all of the interfaces implemented and more context on how we can handle this. A macro is potential solution. The reason these contexts are different types is primarily stdio - the abstractions are very different for wasip2 and wasip3.closes #10061
closes #10063refs https://github.com/bytecodealliance/wasip3-prototyping/issues/228
rvolosatovs updated PR #11221 (assigned to rvolosatovs).
rvolosatovs submitted PR review.
rvolosatovs created PR review comment:
Documented in #11246 and added a TODO with a ref
rvolosatovs submitted PR review.
rvolosatovs created PR review comment:
See #11246
rvolosatovs updated PR #11221 (assigned to rvolosatovs).
rvolosatovs submitted PR review.
rvolosatovs created PR review comment:
<img width="989" height="391" alt="Screenshot 2025-07-16 at 12 43 14" src="https://github.com/user-attachments/assets/c6346e85-a43d-4ed3-905c-0941033096e9" />
rvolosatovs has marked PR #11221 as ready for review.
rvolosatovs commented on PR #11221:
@alexcrichton review comments addressed, mind giving this another look?
alexcrichton submitted PR review.
alexcrichton merged PR #11221.
Last updated: Jan 10 2026 at 02:36 UTC