Skip to content

wasi-sockets: Align stream tests with current P3 spec#12600

Open
badeend wants to merge 7 commits intobytecodealliance:mainfrom
badeend:tcp-streams-once
Open

wasi-sockets: Align stream tests with current P3 spec#12600
badeend wants to merge 7 commits intobytecodealliance:mainfrom
badeend:tcp-streams-once

Conversation

@badeend
Copy link
Member

@badeend badeend commented Feb 16, 2026

Aside from test_tcp_read_cancellation, all other P3 TCP stream tests were transliterated from their P2 counterpart. Some of those ex-P2 tests were testing the interaction between the old tcp-socket::shutdown method and its effect of the input/output streams. In P3, shutdown is called automatically when the stream is dropped, so that test code is not really relevant in P3.

This PR:

  • Rewrites/renames/removes some existing tests.
  • Adds test_tcp_send_drops_stream_when_remote_shutdown: The SendStreamConsumer did not handle EPIPE correctly yet.
  • Adds test_tcp_stream_lifetimes to test the new behavior from Async write prevents Rust bindings and component composition WebAssembly/WASI#870
  • Adds test_tcp_receive_once & test_tcp_send_once. Because tcp-socket::send/receive may be called successfully at most once.
    • To make this work, I've refactored the Connected, Receiving & P2Streaming states into one.

Aside from `test_tcp_read_cancellation`, all other tests were ported directly from their P2 counterpart. However, many of those P2 tests were testing semantics that are not relevant in P3. For example, they were testing the interaction between the old `tcp-socket::shutdown` method and its effect of the input/output streams. In P3, `shutdown` is called automatically when the stream is dropped
…n operational even after the socket that spawned them has been dropped.
@badeend badeend requested review from a team as code owners February 16, 2026 19:32
@badeend badeend requested review from alexcrichton and removed request for a team February 16, 2026 19:32
@github-actions github-actions bot added the wasi Issues pertaining to WASI label Feb 16, 2026
@alexcrichton alexcrichton added this pull request to the merge queue Feb 17, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wasi Issues pertaining to WASI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants