Skip to content

CABI: refactor/simplify stream/future logic; fix delivery of DROPPED/CANCELLED - #719

Merged
lukewagner merged 2 commits into
mainfrom
more-simplify
Sep 15, 2026
Merged

lukewagner merged 2 commits into
mainfrom
more-simplify

Conversation

@lukewagner

Copy link
Copy Markdown
Member

This PR factors out the first commit of #717, since it's pretty nice on its own and can be merged earlier since it's just behavior-preserving refactoring, except for fixing a spec bug (where DROPPED wasn't being delivered promptly even though the other side had dropped) that now matches wasmtime.

The PR is able to remove 125 lines (!) from definitions.py by merging future+stream and read+write definitions that were formerly separate. The key simplification was removing the intermediate shared object that both the readable/writable ends point to. Previously, this shared object seemed necessary to serve as the host/guest abstract interface, but as this PR shows, a better alternative is to instead say that the host owns and uses a readable/writable end directly (as if it was a component with its own handles table), and thus the two ends can just point to each other directly with no intermediate object.

@lukewagner lukewagner changed the title CABI: refactor/simplify stream/future logic; fix delivery of DROPPED CABI: refactor/simplify stream/future logic; fix delivery of DROPPED/CANCELLED Sep 14, 2026
@lukewagner

Copy link
Copy Markdown
Member Author

More testing showed another related case of spec/wasmtime divergence where I think Wasmtime is right: after a stream.cancel-{read,write}, the CANCELLED CopyResult takes precedence over COMPLETED (so you either get CANCELLED or DROPPED). Incidentally, some of the existing WASTs already tested this behavior; updated commit now includes several more.

dicej added a commit to dicej/wasmtime that referenced this pull request Sep 15, 2026
WebAssembly/component-model#719 adds some new tests that
assert certain behavior when the guest has been notified that the other end of a
stream or future has been dropped (e.g. trapping if the guest tried to keep
using the handle), and this commit updates Wasmtime to match.

As of this writing, that PR has not yet been merged, so I'm not updating the
`tests/component-model` submodule yet, but I've verified that the tests on the
PR branch pass locally.

@dicej dicej left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

bytecodealliance/wasmtime#14342 addresses the failing tests for Wasmtime.

pull Bot pushed a commit to langyo/wasmtime that referenced this pull request Sep 15, 2026
WebAssembly/component-model#719 adds some new tests that
assert certain behavior when the guest has been notified that the other end of a
stream or future has been dropped (e.g. trapping if the guest tried to keep
using the handle), and this commit updates Wasmtime to match.

As of this writing, that PR has not yet been merged, so I'm not updating the
`tests/component-model` submodule yet, but I've verified that the tests on the
PR branch pass locally.
@lukewagner
lukewagner merged commit a53b241 into main Sep 15, 2026
2 checks passed
@lukewagner
lukewagner deleted the more-simplify branch September 15, 2026 21:29
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.

2 participants