Skip to content

Conversation

@ricochet
Copy link
Contributor

@ricochet ricochet commented Jan 6, 2026

Update wasmtime's WASI implementation from version
0.3.0-rc-2025-09-16 to 0.3.0-rc-2026-01-06, using wkg for WIT vendoring.

This involves API changes in clocks and HTTP.

By using wkg here, we are also now pointing at the WASI monorepo (closes #9419).

@ricochet ricochet requested review from a team as code owners January 6, 2026 19:17
@ricochet ricochet requested review from fitzgen and removed request for a team January 6, 2026 19:17
world: "test-reactor",
path: "../wasi/src/p2/wit",
generate_all,
features: ["cli-exit-with-code", "clocks-timezone"],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How come here (and a number of other locations in this PR) are now specifying features? Would it be possible to omit them?

The annotations in the adapter, for example, I think are load bearing in the sense that we don't want to activate them there ideally.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I may need some help diagnosing. It seems like bindgen here is either configured for all features or previously relied on not receiving wit with unstable.

When not specifying features:

cargo test --package wasmtime-wasi --test all -- p2_api_reactor
   Compiling test-programs-artifacts v0.0.0 (/Users/bhayes/repos/bytecodealliance/wasmtime/crates/test-programs/artifacts)
error: failed to run custom build command for `test-programs-artifacts v0.0.0 (/Users/bhayes/repos/bytecodealliance/wasmtime/crates/test-programs/artifacts)`

Caused by:
  process didn't exit successfully: `/Users/bhayes/repos/bytecodealliance/wasmtime/target/debug/build/test-programs-artifacts-09b249d84a25b153/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-changed=/Users/bhayes/repos/bytecodealliance/wasmtime/crates/wasi/src/p2/wit/deps/cli.wit
  cargo:rerun-if-changed=/Users/bhayes/repos/bytecodealliance/wasmtime/crates/wasi/src/p2/wit/deps/clocks.wit
  cargo:rerun-if-changed=/Users/bhayes/repos/bytecodealliance/wasmtime/crates/wasi/src/p2/wit/deps/filesystem.wit
  cargo:rerun-if-changed=/Users/bhayes/repos/bytecodealliance/wasmtime/crates/wasi/src/p2/wit/deps/io.wit
  cargo:rerun-if-changed=/Users/bhayes/repos/bytecodealliance/wasmtime/crates/wasi/src/p2/wit/deps/random.wit
  cargo:rerun-if-changed=/Users/bhayes/repos/bytecodealliance/wasmtime/crates/wasi/src/p2/wit/deps/sockets.wit
  cargo:rerun-if-changed=/Users/bhayes/repos/bytecodealliance/wasmtime/crates/wasi/src/p2/wit/test.wit
  cargo:rerun-if-changed=/Users/bhayes/repos/bytecodealliance/wasmtime/crates/wasi/src/p2/wit/world.wit
  cargo:rerun-if-changed=/Users/bhayes/repos/bytecodealliance/wasmtime/crates/wasi-preview1-component-adapter/build.rs
  cargo:rerun-if-changed=/Users/bhayes/repos/bytecodealliance/wasmtime/crates/wasi-preview1-component-adapter/byte-array-literals/src/lib.rs
  cargo:rerun-if-changed=/Users/bhayes/repos/bytecodealliance/wasmtime/crates/wasi-preview1-component-adapter/src/descriptors.rs
  cargo:rerun-if-changed=/Users/bhayes/repos/bytecodealliance/wasmtime/crates/wasi-preview1-component-adapter/src/lib.rs
  cargo:rerun-if-changed=/Users/bhayes/repos/bytecodealliance/wasmtime/crates/wasi-preview1-component-adapter/src/macros.rs
  wasi reactor adapter: "/Users/bhayes/repos/bytecodealliance/wasmtime/target/debug/build/test-programs-artifacts-eba4d8530bb0b1ec/out/wasi_snapshot_preview1.reactor.wasm"
  wasi command adapter: "/Users/bhayes/repos/bytecodealliance/wasmtime/target/debug/build/test-programs-artifacts-eba4d8530bb0b1ec/out/wasi_snapshot_preview1.command.wasm"
  cargo:rerun-if-changed=/Users/bhayes/repos/bytecodealliance/wasmtime/crates/wasi-http/wit/deps/cli.wit
  cargo:rerun-if-changed=/Users/bhayes/repos/bytecodealliance/wasmtime/crates/wasi-http/wit/deps/clocks.wit
  cargo:rerun-if-changed=/Users/bhayes/repos/bytecodealliance/wasmtime/crates/wasi-http/wit/deps/filesystem.wit
  cargo:rerun-if-changed=/Users/bhayes/repos/bytecodealliance/wasmtime/crates/wasi-http/wit/deps/http.wit
  cargo:rerun-if-changed=/Users/bhayes/repos/bytecodealliance/wasmtime/crates/wasi-http/wit/deps/io.wit
  cargo:rerun-if-changed=/Users/bhayes/repos/bytecodealliance/wasmtime/crates/wasi-http/wit/deps/random.wit
  cargo:rerun-if-changed=/Users/bhayes/repos/bytecodealliance/wasmtime/crates/wasi-http/wit/deps/sockets.wit
  cargo:rerun-if-changed=/Users/bhayes/repos/bytecodealliance/wasmtime/crates/wasi-http/wit/world.wit
  wasi proxy adapter: "/Users/bhayes/repos/bytecodealliance/wasmtime/target/debug/build/test-programs-artifacts-eba4d8530bb0b1ec/out/wasi_snapshot_preview1.proxy.wasm"
  cargo:rerun-if-env-changed=MIRI_TEST_CWASM_DIR

  --- stderr
  running: env -u CARGO_ENCODED_RUSTFLAGS CARGO_TARGET_DIR="/Users/bhayes/repos/bytecodealliance/wasmtime/target/debug/build/test-programs-artifacts-eba4d8530bb0b1ec/out" RUSTFLAGS="" "cargo" "build" "--release" "--package=wasi-preview1-component-adapter" "--target=wasm32-unknown-unknown"
     Compiling wasi-preview1-component-adapter v41.0.0 (/Users/bhayes/repos/bytecodealliance/wasmtime/crates/wasi-preview1-component-adapter)
      Finished `release` profile [optimized] target(s) in 1.10s
  running: env -u CARGO_ENCODED_RUSTFLAGS CARGO_TARGET_DIR="/Users/bhayes/repos/bytecodealliance/wasmtime/target/debug/build/test-programs-artifacts-eba4d8530bb0b1ec/out" RUSTFLAGS="" "cargo" "build" "--release" "--package=wasi-preview1-component-adapter" "--target=wasm32-unknown-unknown" "--no-default-features" "--features=command"
     Compiling wasi-preview1-component-adapter v41.0.0 (/Users/bhayes/repos/bytecodealliance/wasmtime/crates/wasi-preview1-component-adapter)
      Finished `release` profile [optimized] target(s) in 0.93s
  running: env -u CARGO_ENCODED_RUSTFLAGS CARGO_TARGET_DIR="/Users/bhayes/repos/bytecodealliance/wasmtime/target/debug/build/test-programs-artifacts-eba4d8530bb0b1ec/out" RUSTFLAGS="" "cargo" "build" "--release" "--package=wasi-preview1-component-adapter" "--target=wasm32-unknown-unknown" "--no-default-features" "--features=proxy"
     Compiling wasi-preview1-component-adapter v41.0.0 (/Users/bhayes/repos/bytecodealliance/wasmtime/crates/wasi-preview1-component-adapter)
      Finished `release` profile [optimized] target(s) in 0.40s
  running: env -u CARGO_ENCODED_RUSTFLAGS CARGO_PROFILE_DEV_DEBUG="2" CARGO_TARGET_DIR="/Users/bhayes/repos/bytecodealliance/wasmtime/target/debug/build/test-programs-artifacts-eba4d8530bb0b1ec/out" RUSTFLAGS="" "cargo" "build" "--target=wasm32-wasip1" "--package=test-programs"
     Compiling test-programs v0.0.0 (/Users/bhayes/repos/bytecodealliance/wasmtime/crates/test-programs)
  error: failed to resolve directory while parsing WIT for path [/Users/bhayes/repos/bytecodealliance/wasmtime/crates/wasi/src/p2/wit]
         
         Caused by:
           interface not found in package
              --> /Users/bhayes/repos/bytecodealliance/wasmtime/crates/wasi/src/p2/wit/deps/cli.wit:174:22
               |
           174 |   import wasi:clocks/[email protected];
               |                      ^-------
   --> crates/test-programs/src/bin/p2_api_reactor.rs:3:1
    |
  3 | / wit_bindgen::generate!({
  4 | |     world: "test-reactor",
  5 | |     path: "../wasi/src/p2/wit",
  6 | |     generate_all,
  7 | | });
    | |__^
    |
    = note: this error originates in the macro `wit_bindgen::generate` (in Nightly builds, run with -Z macro-backtrace for more info)

  error: cannot find macro `export` in this scope
    --> crates/test-programs/src/bin/p2_api_reactor.rs:11:1
     |
  11 | export!(T);
     | ^^^^^^

  error[E0405]: cannot find trait `Guest` in this scope
    --> crates/test-programs/src/bin/p2_api_reactor.rs:18:6
     |
  18 | impl Guest for T {
     |      ^^^^^ not found in this scope
     |
  help: consider importing one of these traits
     |
   1 + use test_programs::p3::exports::wasi::cli::run::Guest;
     |
   1 + use test_programs::p3::proxy::exports::wasi::http::handler::Guest;
     |
   1 + use test_programs::proxy::exports::wasi::http::incoming_handler::Guest;
     |
   1 + use wasip2::exports::cli::run::Guest;
     |
     = and 1 other candidate

  error[E0412]: cannot find type `OutputStream` in this scope
    --> crates/test-programs/src/bin/p2_api_reactor.rs:36:28
     |
  36 |     fn write_strings_to(o: OutputStream) -> Result<(), ()> {
     |                            ^^^^^^^^^^^^ not found in this scope
     |
  help: consider importing one of these items
     |
   1 + use test_programs::wasi::cli::stderr::OutputStream;
     |
   1 + use test_programs::wasi::cli::stdout::OutputStream;
     |
   1 + use test_programs::wasi::filesystem::types::OutputStream;
     |
   1 + use test_programs::wasi::http::types::OutputStream;
     |
     = and 9 other candidates

  error[E0433]: failed to resolve: use of unresolved module or unlinked crate `wasi`
    --> crates/test-programs/src/bin/p2_api_reactor.rs:67:38
     |
  67 |     fn pass_an_imported_record(stat: wasi::filesystem::types::DescriptorStat) -> String {
     |                                      ^^^^ use of unresolved module or unlinked crate `wasi`
     |
     = help: if you wanted to use a crate named `wasi`, use `cargo add wasi` to add it to your `Cargo.toml`
  help: consider importing one of these modules
     |
   1 + use test_programs::p3::wasi::filesystem::types;
     |
   1 + use test_programs::wasi::filesystem::types;
     |
   1 + use wasip2::filesystem::types;
     |
  help: if you import `types`, refer to it directly
     |
  67 -     fn pass_an_imported_record(stat: wasi::filesystem::types::DescriptorStat) -> String {
  67 +     fn pass_an_imported_record(stat: types::DescriptorStat) -> String {
     |

  Some errors have detailed explanations: E0405, E0412, E0433.
  For more information about an error, try `rustc --explain E0405`.
  error: could not compile `test-programs` (bin "p2_api_reactor") due to 5 previous errors

  thread 'main' (480942390) panicked at crates/test-programs/artifacts/build.rs:156:9:
  assertion failed: status.success()
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

With just the clocks-timezone feature:

  creating a component from "/Users/bhayes/repos/bytecodealliance/wasmtime/target/debug/build/test-programs-artifacts-eba4d8530bb0b1ec/out/wasm32-wasip1/debug/p2_api_reactor.wasm"

  --- stderr
  running: env -u CARGO_ENCODED_RUSTFLAGS CARGO_TARGET_DIR="/Users/bhayes/repos/bytecodealliance/wasmtime/target/debug/build/test-programs-artifacts-eba4d8530bb0b1ec/out" RUSTFLAGS="" "cargo" "build" "--release" "--package=wasi-preview1-component-adapter" "--target=wasm32-unknown-unknown"
     Compiling wasi-preview1-component-adapter v41.0.0 (/Users/bhayes/repos/bytecodealliance/wasmtime/crates/wasi-preview1-component-adapter)
      Finished `release` profile [optimized] target(s) in 1.27s
  running: env -u CARGO_ENCODED_RUSTFLAGS CARGO_TARGET_DIR="/Users/bhayes/repos/bytecodealliance/wasmtime/target/debug/build/test-programs-artifacts-eba4d8530bb0b1ec/out" RUSTFLAGS="" "cargo" "build" "--release" "--package=wasi-preview1-component-adapter" "--target=wasm32-unknown-unknown" "--no-default-features" "--features=command"
     Compiling wasi-preview1-component-adapter v41.0.0 (/Users/bhayes/repos/bytecodealliance/wasmtime/crates/wasi-preview1-component-adapter)
      Finished `release` profile [optimized] target(s) in 0.88s
  running: env -u CARGO_ENCODED_RUSTFLAGS CARGO_TARGET_DIR="/Users/bhayes/repos/bytecodealliance/wasmtime/target/debug/build/test-programs-artifacts-eba4d8530bb0b1ec/out" RUSTFLAGS="" "cargo" "build" "--release" "--package=wasi-preview1-component-adapter" "--target=wasm32-unknown-unknown" "--no-default-features" "--features=proxy"
     Compiling wasi-preview1-component-adapter v41.0.0 (/Users/bhayes/repos/bytecodealliance/wasmtime/crates/wasi-preview1-component-adapter)
      Finished `release` profile [optimized] target(s) in 0.43s
  running: env -u CARGO_ENCODED_RUSTFLAGS CARGO_PROFILE_DEV_DEBUG="2" CARGO_TARGET_DIR="/Users/bhayes/repos/bytecodealliance/wasmtime/target/debug/build/test-programs-artifacts-eba4d8530bb0b1ec/out" RUSTFLAGS="" "cargo" "build" "--target=wasm32-wasip1" "--package=test-programs"
     Compiling test-programs v0.0.0 (/Users/bhayes/repos/bytecodealliance/wasmtime/crates/test-programs)
      Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.35s

  thread 'main' (480860142) panicked at crates/test-programs/artifacts/build.rs:233:14:
  called `Result::unwrap()` on an `Err` value: failed to merge WIT packages of adapter `wasi_snapshot_preview1` into main packages

  Caused by:
      0: failed to merge WIT package sets together
      1: failed to merge package `wasi:[email protected]` into existing copy
      2: failed to merge interface `exit`
      3: expected function `exit-with-code` to be present

With both features:

 cargo test --package wasmtime-wasi --test all -- p2_api_reactor
   Compiling test-programs-artifacts v0.0.0 (/Users/bhayes/repos/bytecodealliance/wasmtime/crates/test-programs/artifacts)
   Compiling wasmtime-wasi v41.0.0 (/Users/bhayes/repos/bytecodealliance/wasmtime/crates/wasi)
    Finished `test` profile [unoptimized + debuginfo] target(s) in 23.27s
     Running tests/all/main.rs (target/debug/deps/all-ac8347edcc640c32)

running 1 test
test p2::api::p2_api_reactor ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 195 filtered out; finished in 1.45s

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok this specific location I think is ok to keep the features enabled since it's just related to testing, but there's some other locations that I was curious about too:

  • crates/test-programs/src/bin/p3_http_middleware.rs - how come the timezone feature was necessary here?
  • crates/test-programs/src/bin/p3_http_middleware_with_chain.rs - same as above
  • crates/test-programs/src/lib.rs - seems ok as this is generating more bindings for more tests. Was the addition of clocks-timezone necessary though? I don't think it's problematic, but with nothing using it prior I wouldn't have expected it to be required to be added.
  • crates/test-programs/src/p3/mod.rs - similar to above
  • crates/wasi-preview1-component-adapter/src/lib.rs - this one is what I'm particularly worried about and I think this cannot have extra features enabled (since it's such a public-facing component that shouldn't be using unstable WASI features)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this a stray addition? Most of the other folders don't have wkg.lock and given that we're already pinning versions I'd imagine that we could probably eschew having this entirely, but I'm also not too too familiar with wkg.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think generally wkg.lock should always be included like a Cargo.lock. We could add a gitignore but when running wkg and the vendor step it will always create this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to switch to wkg in a separate PR maybe? This is for example both updating WITs and switching to wkg, but ideally we'd do those as two discrete steps to ensure everything stays in sync and nothing slips through the cracks

@alexcrichton alexcrichton requested review from alexcrichton and removed request for fitzgen January 6, 2026 19:44
Update wasmtime's WASI implementation from version
0.3.0-rc-2025-09-16 to 0.3.0-rc-2026-01-06, using wkg for WIT vendoring.

This involves API changes in clocks and HTTP.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Using wkg to manage wit dependencies

2 participants