ReviewOS

home-lang/home

Bun parity: implement StreamWrap, ShutdownWrap, and js_stream_socket

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

Tracks the three genuine test-stream-wrap*.js failures from #66.

Required contracts:

  • internalBinding stream_wrap ShutdownWrap
  • internal/js_stream_socket default and named StreamWrap exports
  • _handle.shutdown completion exactly once, negative after destroy
  • deferred shutdown while a write is pending, followed by drain, write callback, and shutdown completion ordering
  • forwarding detection for StringDecoder and objectMode with exact ERR_STREAM_WRAP errors
  • Duplex high-water-mark, queued-length, needDrain, drain, decoder, and object-mode state needed by these tests

Acceptance criteria:

  • add the bindings and modules without filename-specific behavior
  • centralize pending-write and shutdown ownership
  • pass all three byte-identical copied tests in a dedicated maintained tranche
  • add focused exactly-once and error-state regressions
  • track deeper net.Socket handle/libuv compatibility as follow-up if not completed here

Parent tracker: #66

10 days ago

Completed by 0be19c718 and the published internal-module exposure checkpoint e6aacc5adfadc9465d5f4fc062edebe3d08f11cf.

Current-head verification against Bun pin 4982b91e3702094330f3be3883354c52b8c01323:

  • All three maintained upstream sources are byte-identical to the pin:
    • test-stream-wrap.js: ddb14300d07f0442418577816e9a2b99502f857ec64827ff6d093ecd4959276d
    • test-stream-wrap-drain.js: 4a8c48bc117831dfb5e85ebf683200cb29455be5f320502575d564422db8b480
    • test-stream-wrap-encoding.js: d25a88944970b83846ea6173af589245476a0c9f274e47af67af11b9abff4d6f
  • The dedicated exact three-file corpus gate passes with no failures, TODOs, or unsupported cases.
  • The generic handle-backed net.Socket/JSStreamSocket ownership gate passes, covering pending writes, deferred shutdown, negative cancellation, drain and exactly-once close/completion.
  • The native ShutdownWrap/WriteWrap regression passes with JSC exception checks and forced VM destruction enabled.
  • The internal specifiers are explicitly gated by --expose-internals; ordinary user resolution remains rejected.

This satisfies #430’s binding, module, queue ownership, error-state, and maintained-test acceptance criteria. Closing this tracker; broader stream and runtime parity remains in #66.

Sign in to comment on this issue.