Skip to content

Commit 1cc0bcf

Browse files
feat(p3)!: vendor 0.3.0-rc-2026-01-06 (#12250)
* feat(p3)!: vendor 0.3.0-rc-2026-01-06 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. * Handle some review comments * Update WASI implementations to avoid `as` This can have a loss in precision so this shuffles around some types to ensure that `try_into` and friends are always used instead of `as`. This changes the source-of-truth for timestamps to be `i64` seconds so WASIp2 is the odd-one-out that can't represent negative timestamps. * Flag expected WASI failures * Get wasi:http tests working again * Rename `proxy` module to `service` to reflect the WIT world. * Adjust the middleware test to using the `middleware` world. --------- Co-authored-by: Alex Crichton <alex@alexcrichton.com>
1 parent 9a87410 commit 1cc0bcf

39 files changed

+855
-763
lines changed

ci/vendor-wit.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ get_github() {
3434
}
3535

3636
p2=0.2.6
37-
p3=0.3.0-rc-2025-09-16
37+
p3=0.3.0-rc-2026-01-06
3838

3939
rm -rf crates/wasi-io/wit/deps
4040
mkdir -p crates/wasi-io/wit/deps

crates/test-programs/src/bin/p3_api_proxy.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ use wit_bindgen::spawn;
55

66
struct T;
77

8-
test_programs::p3::proxy::export!(T);
8+
test_programs::p3::service::export!(T);
99

10-
impl test_programs::p3::proxy::exports::wasi::http::handler::Guest for T {
10+
impl test_programs::p3::service::exports::wasi::http::handler::Guest for T {
1111
async fn handle(request: Request) -> Result<Response, ErrorCode> {
1212
assert!(request.get_scheme().is_some());
1313
assert!(request.get_authority().is_some());
@@ -54,7 +54,7 @@ impl test_programs::p3::proxy::exports::wasi::http::handler::Guest for T {
5454
}
5555
}
5656

57-
// Technically this should not be here for a proxy, but given the current
57+
// Technically this should not be here for a service, but given the current
5858
// framework for tests it's required since this file is built as a `bin`
5959
fn main() {}
6060

crates/test-programs/src/bin/p3_cli_serve_hello_world.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use test_programs::p3::wasi::http::types::{ErrorCode, Fields, Request, Response};
2-
use test_programs::p3::{proxy, wit_future, wit_stream};
2+
use test_programs::p3::{service, wit_future, wit_stream};
33

44
struct T;
55

6-
proxy::export!(T);
6+
service::export!(T);
77

8-
impl proxy::exports::wasi::http::handler::Guest for T {
8+
impl service::exports::wasi::http::handler::Guest for T {
99
async fn handle(_request: Request) -> Result<Response, ErrorCode> {
1010
let (mut body_tx, body_rx) = wit_stream::new();
1111
let (body_result_tx, body_result_rx) = wit_future::new(|| Ok(None));

crates/test-programs/src/bin/p3_cli_serve_sleep.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
use test_programs::p3::proxy;
1+
use test_programs::p3::service;
22
use test_programs::p3::wasi::clocks::monotonic_clock;
33
use test_programs::p3::wasi::http::types::{ErrorCode, Request, Response};
44

55
struct T;
66

7-
proxy::export!(T);
7+
service::export!(T);
88

9-
impl proxy::exports::wasi::http::handler::Guest for T {
9+
impl service::exports::wasi::http::handler::Guest for T {
1010
async fn handle(_request: Request) -> Result<Response, ErrorCode> {
1111
monotonic_clock::wait_for(u64::MAX).await;
1212
unreachable!()

crates/test-programs/src/bin/p3_http_echo.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use {
22
test_programs::p3::{
3-
proxy::exports::wasi::http::handler::Guest as Handler,
3+
service::exports::wasi::http::handler::Guest as Handler,
44
wasi::http::types::{ErrorCode, Request, Response},
55
wit_future, wit_stream,
66
},
@@ -9,7 +9,7 @@ use {
99

1010
struct Component;
1111

12-
test_programs::p3::proxy::export!(Component);
12+
test_programs::p3::service::export!(Component);
1313

1414
impl Handler for Component {
1515
/// Return a response which echoes the request headers, body, and trailers.

crates/test-programs/src/bin/p3_http_middleware.rs

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use {
55
},
66
std::{io::Write, mem},
77
test_programs::p3::{
8-
proxy::exports::wasi::http::handler::Guest as Handler,
98
wasi::http::{
109
handler,
1110
types::{ErrorCode, Headers, Request, Response},
@@ -15,11 +14,31 @@ use {
1514
wit_bindgen::StreamResult,
1615
};
1716

17+
wit_bindgen::generate!({
18+
path: "../wasi-http/src/p3/wit",
19+
world: "wasi:http/middleware",
20+
with: {
21+
"wasi:http/handler@0.3.0-rc-2026-01-06": test_programs::p3::wasi::http::handler,
22+
"wasi:http/types@0.3.0-rc-2026-01-06": test_programs::p3::wasi::http::types,
23+
"wasi:http/client@0.3.0-rc-2026-01-06": test_programs::p3::wasi::http::client,
24+
"wasi:random/random@0.3.0-rc-2026-01-06": test_programs::p3::wasi::random::random,
25+
"wasi:random/insecure@0.3.0-rc-2026-01-06": test_programs::p3::wasi::random::insecure,
26+
"wasi:random/insecure-seed@0.3.0-rc-2026-01-06": test_programs::p3::wasi::random::insecure_seed,
27+
"wasi:cli/stdout@0.3.0-rc-2026-01-06": test_programs::p3::wasi::cli::stdout,
28+
"wasi:cli/stderr@0.3.0-rc-2026-01-06": test_programs::p3::wasi::cli::stderr,
29+
"wasi:cli/stdin@0.3.0-rc-2026-01-06": test_programs::p3::wasi::cli::stdin,
30+
"wasi:cli/types@0.3.0-rc-2026-01-06": test_programs::p3::wasi::cli::types,
31+
"wasi:clocks/monotonic-clock@0.3.0-rc-2026-01-06": test_programs::p3::wasi::clocks::monotonic_clock,
32+
"wasi:clocks/system-clock@0.3.0-rc-2026-01-06": test_programs::p3::wasi::clocks::system_clock,
33+
"wasi:clocks/types@0.3.0-rc-2026-01-06": test_programs::p3::wasi::clocks::types,
34+
},
35+
});
36+
1837
struct Component;
1938

20-
test_programs::p3::proxy::export!(Component);
39+
export!(Component);
2140

22-
impl Handler for Component {
41+
impl exports::wasi::http::handler::Guest for Component {
2342
/// Forward the specified request to the imported `wasi:http/handler`, transparently decoding the request body
2443
/// if it is `deflate`d and then encoding the response body if the client has provided an `accept-encoding:
2544
/// deflate` header.

crates/test-programs/src/bin/p3_http_middleware_with_chain.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ mod bindings {
66
package local:local;
77
88
world middleware-with-chain {
9-
include wasi:http/proxy@0.3.0-rc-2025-09-16;
9+
include wasi:http/service@0.3.0-rc-2026-01-06;
1010
1111
import chain-http;
1212
}
1313
1414
interface chain-http {
15-
use wasi:http/types@0.3.0-rc-2025-09-16.{request, response, error-code};
15+
use wasi:http/types@0.3.0-rc-2026-01-06.{request, response, error-code};
1616
1717
handle: async func(request: request) -> result<response, error-code>;
1818
}

crates/test-programs/src/bin/p3_http_outbound_request_content_length.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use futures::join;
2-
use test_programs::p3::wasi::http::handler;
2+
use test_programs::p3::wasi::http::client;
33
use test_programs::p3::wasi::http::types::{ErrorCode, Headers, Method, Request, Scheme, Trailers};
44
use test_programs::p3::{wit_future, wit_stream};
55
use wit_bindgen::{FutureReader, FutureWriter, StreamWriter};
@@ -47,7 +47,7 @@ impl test_programs::p3::exports::wasi::cli::run::Guest for Component {
4747
{
4848
let (request, mut contents_tx, trailers_tx, transmit) = make_request();
4949
let (handle, transmit, ()) = join!(
50-
async { handler::handle(request).await },
50+
async { client::send(request).await },
5151
async { transmit.await },
5252
async {
5353
let remaining = contents_tx.write_all(b"long enough".to_vec()).await;
@@ -64,7 +64,7 @@ impl test_programs::p3::exports::wasi::cli::run::Guest for Component {
6464
{
6565
let (request, mut contents_tx, trailers_tx, transmit) = make_request();
6666
let (handle, transmit, ()) = join!(
67-
async { handler::handle(request).await },
67+
async { client::send(request).await },
6868
async { transmit.await },
6969
async {
7070
let remaining = contents_tx.write_all(b"msg".to_vec()).await;
@@ -93,7 +93,7 @@ impl test_programs::p3::exports::wasi::cli::run::Guest for Component {
9393
{
9494
let (request, mut contents_tx, trailers_tx, transmit) = make_request();
9595
let (handle, transmit, ()) = join!(
96-
async { handler::handle(request).await },
96+
async { client::send(request).await },
9797
async { transmit.await },
9898
async {
9999
let remaining = contents_tx.write_all(b"more than 11 bytes".to_vec()).await;

crates/test-programs/src/bin/p3_http_outbound_request_missing_path_and_query.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use test_programs::p3::wasi::http::handler::handle;
1+
use test_programs::p3::wasi::http::client::send;
22
use test_programs::p3::wasi::http::types::{Fields, Method, Request, Scheme};
33
use test_programs::p3::wit_future;
44

@@ -18,7 +18,7 @@ impl test_programs::p3::exports::wasi::cli::run::Guest for Component {
1818
// Don't set path/query
1919
// req.set_path_with_query(Some("/")).unwrap();
2020

21-
let res = handle(req).await;
21+
let res = send(req).await;
2222
assert!(res.is_err());
2323
Ok(())
2424
}

crates/test-programs/src/bin/p3_http_proxy.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use {
22
test_programs::p3::{
3-
proxy::exports::wasi::http::handler::Guest as Handler,
3+
service::exports::wasi::http::handler::Guest as Handler,
44
wasi::http::{
5-
handler,
5+
client,
66
types::{ErrorCode, Fields, Request, Response, Scheme},
77
},
88
wit_future,
@@ -12,7 +12,7 @@ use {
1212

1313
struct Component;
1414

15-
test_programs::p3::proxy::export!(Component);
15+
test_programs::p3::service::export!(Component);
1616

1717
impl Handler for Component {
1818
// Forward the request body and trailers to a URL specified in a header.
@@ -42,7 +42,7 @@ impl Handler for Component {
4242
outgoing_request
4343
.set_authority(Some(url.authority()))
4444
.unwrap();
45-
handler::handle(outgoing_request).await?
45+
client::send(outgoing_request).await?
4646
} else {
4747
bad_request()
4848
},

0 commit comments

Comments
 (0)