ReviewOS

home-lang/home

Port Bun socket and listener lifecycle matrices

#146
Closed chris opened this 10 days ago ·
10 days ago

Scope

Port the remaining Bun native network corpus cluster currently hidden behind TODO rewrites:

  • js/bun/net/named-pipe-listen-error.test.ts
  • js/bun/net/socket-retention.test.ts
  • js/bun/net/socket.test.ts
  • js/bun/net/tcp-server.test.ts
  • js/bun/net/unix-socket-unlink.test.ts

Initial evidence

The platform-specific named-pipe file reaches its upstream-declared todo on macOS. Removing the other four suppressions exposes integration gaps:

  • socket-retention.test.ts: Bun.connect does not create the server-side peer/open lifecycle in the corpus runtime;
  • tcp-server.test.ts: connected socket metadata and duplex delivery are incomplete;
  • unix-socket-unlink.test.ts: listeners do not create/remove Unix socket paths;
  • socket.test.ts: validation, connection errors, duplex lifecycle, reload, timeout, TLS upgrade, and subprocess coverage remain to activate.

The full native Home runtime already passes a direct loopback address probe. This issue tracks logically porting the corpus runtime network model and fixing any native gaps that exact direct probes uncover.

Acceptance

  • Port general Bun-compatible listener/socket behavior, not fixture-specific pass-throughs.
  • Preserve structured native errors and source stacks.
  • Remove all five native TODO rewrites.
  • Exact corpus runs pass with upstream-declared platform skips/todos only.
  • Debug build and full home_test gate pass.
  • Land on main with conventional commits and reference the result from #66.
10 days ago

Completed in d5adc91 (fix(runtime): port Bun socket lifecycle matrices) and pushed directly to main.

What landed:

  • replaced the five native TODO rewrites with execution of the byte-identical upstream Bun files
  • added paired TCP/TLS/Unix socket lifecycle behavior, fd peer-close propagation, listener reload/stop/fd state, structured connect/listen errors, and Unix path collision/unlink handling
  • added a Zig std.Io.net listener bridge for real subprocess reachability, with runtime-owned cleanup
  • preserved Bun error stacks through normal Error objects with code, errno, syscall, address, and port
  • loaded the exact checked-in Bun TLS credentials for real child-process coverage
  • fixed relative file-URL resolution and corpus child-script path canonicalization without changing upstream fixtures
  • added durable unit coverage preventing these matrices from returning to native TODO rewrites

Exact upstream acceptance sweep (all files byte-identical to ~/Code/bun):

  • named-pipe-listen-error.test.ts: 0 pass / 0 fail / 0 unsupported / 1 upstream platform TODO
  • socket-retention.test.ts: 4 / 0 / 0 / 0
  • socket.test.ts: 37 / 0 / 0 / 1 upstream platform TODO
  • tcp-server.test.ts: 8 / 0 / 0 / 0
  • unix-socket-unlink.test.ts: 8 / 0 / 0 / 1 upstream platform TODO

Total: 57 passed, 0 failed, 0 unsupported, 3 upstream platform TODOs.

Full gate: ./pantry/.bin/zig build test -Dfilter=home_test --summary failures passed (exit 0; 1,106 tests).

Sign in to comment on this issue.