Skip to content

node:stream: implement real Node/WHATWG stream adapters #2521

@andrewtdiz

Description

@andrewtdiz

Summary

Perry exposes the classic node:stream Web-stream adapter methods, but they currently return shape stubs rather than real adapters. This is separate from #1545, which tracks the node:stream/web submodule constructors themselves.

Affected surface

  • stream.Readable.fromWeb(readableStream[, options])
  • stream.Readable.toWeb(streamReadable[, options])
  • stream.Writable.fromWeb(writableStream[, options])
  • stream.Writable.toWeb(streamWritable)
  • stream.Duplex.fromWeb(pair[, options])
  • stream.Duplex.toWeb(streamDuplex[, options])

Evidence

  • Closed node:stream — implement Web-stream interop (Readable.toWeb/fromWeb, Writable.toWeb/fromWeb) #1540 made the helper names exist, but the current implementation still documents that real bidirectional adapters are tracked separately.
  • js_node_stream_to_web returns a generic Web-stream-shaped object with both getReader and getWriter stubs; data is not forwarded between the Node and WHATWG stream universes (crates/perry-runtime/src/node_stream_constructors.rs:829-873).
  • js_node_stream_from_web returns a fresh Duplex stub for either direction instead of adapting the supplied Web stream (crates/perry-runtime/src/node_stream_constructors.rs:876-881).
  • docs/runtime-parity-gaps.md still lists the classic stream Web adapter APIs in the node:stream gap set (docs/runtime-parity-gaps.md:987-991).

Expected Node-compatible behavior

The adapters should bridge data, errors, close/cancel/abort behavior, and backpressure between Node classic streams and WHATWG streams. toWeb should return direction-correct Web stream objects, and fromWeb should expose Node stream instances that consume/produce data from the provided Web stream.

Duplicate check

Searched issues and PRs for stream fromWeb toWeb Web Stream interop and stream compose duplexPair fromWeb toWeb data. No open tracker was found. Closed #1540 covered helper presence/shape only; open #1545 covers the separate node:stream/web submodule constructors.

Verification note

I could not run a fresh local Perry parity probe in this workspace because there is no local perry binary. This issue is based on committed parity metadata and current source inspection.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions