Skip to content

wasi-shims: loopback integration gate — a real guest drives wasi:sockets TCP end to end - #126

Merged
lannbot merged 1 commit into
mainfrom
tcp-loopback-integration
Aug 13, 2026
Merged

wasi-shims: loopback integration gate — a real guest drives wasi:sockets TCP end to end#126
lannbot merged 1 commit into
mainfrom
tcp-loopback-integration

Conversation

@lannbot

@lannbot lannbot commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

The decision

The composed-path gap noted on #125 closes in-repo instead of waiting for a consumer smoke: a real guest component linking the REAL wasi:sockets@0.3.0 (WIT vendored verbatim from upstream — the revision the iroh/wosh family links) drives the à la carte provider over live loopback sockets, through the full stack:

guest wit-bindgen calls → plan dispatch → conventions adapter
(A12 future results, A13 resource-element streams) → sockets provider
→ Deno sockets → real TCP → back

The two legs (tests/integration_sockets_test.ts + examples/guests/tcp-echo)

Clientecho-client is the wosh listener's exact driving shape (create/connect/send-stream/receive-stream, transcribed from listener-core/src/tcp.rs). An 8 KiB patterned payload round-trips byte-identical through a host echo server; the onCall log reads back the guest wire's exact sequence — the polymorph-iroh#69 exam idiom, now in-repo.

Serverstart-echo-server binds 127.0.0.1:0, listens, reports the ephemeral port, then serves two connections from a detached guest task: no export call is in flight while the dials echo, so the A11 settlement pump is what drives the accepts. stream<tcp-socket> elements arrive in the guest as live resources; completion rides a guest-created future<u32>. Teardown is the full A13 chain observed from the OS: guest drops its accept stream → pump cancellation hook → provider closes the listener → the port refuses a fresh dial (raw ECONNREFUSED).

Both legs pass under the seeded-shuffle scheduler (DELTIC_SCHED_SEED=1, =4242).

Skip-if-absent on the shim + fixture corpus, same as the runtime's embedder tests; CI core builds both before test-wasi-shims, so the gate is live there.

Gates

just test-wasi-shims (111, +2), examples (new fixture builds + validates), publish-check, test-sockets-node. No src changes — fixture + tests + docs only.

Refs #4.

…ets TCP end to end

The tcp-echo fixture (examples/guests/tcp-echo; wasi:sockets@0.3.0 +
wasi:clocks@0.3.0 WIT vendored verbatim from upstream — the revision the
iroh/wosh consumer family links) closes the composed-path gap the
provider and runtime suites approximated from either side:

  guest wit-bindgen calls -> plan dispatch -> conventions adapter
  (A12 future results, A13 resource-element streams) -> the a la carte
  sockets provider -> Deno sockets -> real loopback TCP -> back

Two legs (wasi-shims/tests/integration_sockets_test.ts; skip-if-absent
on the shim + fixture corpus, like the runtime's embedder tests):

- client: echo-client is the wosh listener's exact driving shape
  (create / connect / send-stream / receive-stream). An 8 KiB patterned
  payload round-trips byte-identical through a host echo server, and the
  onCall log reads back the guest wire's exact sequence — the
  polymorph-iroh#69 exam idiom, now in-repo.

- server: start-echo-server binds 127.0.0.1:0, listens, reports the
  ephemeral port, and serves two connections from a DETACHED guest task
  — no export call in flight while the dials echo, so the A11
  settlement pump is what drives the accepts. stream<tcp-socket>
  elements arrive in the guest as live resources (accept -> receive ->
  send per connection); the completion rides a guest-created
  future<u32>. Teardown is the full A13 chain observed from the OS: the
  guest drops its accept stream -> the pump's producer-cancellation
  hook -> the provider closes the listener -> the port refuses a fresh
  dial (ECONNREFUSED, raw).

Both legs also pass under the seeded-shuffle scheduler
(DELTIC_SCHED_SEED=1, =4242).

Gates: test-wasi-shims (111, +2), examples, publish-check,
test-sockets-node.
@lannbot
lannbot enabled auto-merge August 13, 2026 12:22
@lannbot
lannbot merged commit 356384a into main Aug 13, 2026
4 checks passed
@lannbot
lannbot deleted the tcp-loopback-integration branch August 23, 2026 16:51
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