Skip to content

fix(ext/web): expose stream state to node:stream helpers on ReadableStream - #37156

Open
RaxRai wants to merge 1 commit into
denoland:mainfrom
RaxRai:fix/readable-stream-node-state
Open

RaxRai wants to merge 1 commit into
denoland:mainfrom
RaxRai:fix/readable-stream-node-state

Conversation

@RaxRai

@RaxRai RaxRai commented Nov 10, 2026

Copy link
Copy Markdown

Fixes #37150

isDisturbed / Readable.isDisturbed, isErrored and isReadable from node:stream read Symbol.for("nodejs.stream.disturbed"), "nodejs.stream.errored" and "nodejs.stream.readable" from the stream (ext/node/polyfills/internal/streams/utils.js). Node's web ReadableStream defines getters for these keys (lib/internal/webstreams/readablestream.js), but Deno's didn't, so for a web stream the helpers returned false, false and null whatever its state.

This adds the three getters to ReadableStream in ext/web/06_streams.js, reading the state the stream already tracks:

  • disturbed → [_disturbed]
  • errored → [_state] === "errored"
  • readable → [_state] === "readable"

These match Node's definitions. The keys are symbols, so webidl.configureInterface leaves them non-enumerable.

With the issue's repro, the output now matches Node.js:

fresh   false false true
read    true false false
errored false true false
cancel  true

Tests

Added isDisturbed, isErrored and isReadable on web streams to tests/unit_node/stream_test.ts. It covers a fresh stream, a stream after a read, an errored stream and a cancelled stream.

AI disclosure

I used an AI assistant (Claude) to help investigate the issue and draft this change. I reviewed and tested it.

…tream

`isDisturbed`, `isErrored` and `isReadable` from `node:stream` read
`Symbol.for("nodejs.stream.{disturbed,errored,readable}")` from the
stream. Node's web ReadableStream defines getters for these keys, but
Deno's did not, so the helpers ignored the state of a web stream.

Fixes denoland#37150

This branch has not been deployed

No deployments
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.

node:stream: isDisturbed, isErrored and isReadable ignore the state of a web ReadableStream

1 participant