Skip to content

Queue the chunk before filling reads with released bytes - #7479

Merged
jasnell merged 1 commit into
mainfrom
jasnell/ts-streams-released-bytes-with-chunk
Sep 24, 2026
Merged

jasnell merged 1 commit into
mainfrom
jasnell/ts-streams-released-bytes-with-chunk

Conversation

@jasnell

@jasnell jasnell commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator

When enqueue() met a released partial read's bytes, TS filled pending
reads from them before queuing the chunk, so a waiting read(view) got
only the released bytes. The spec queues both first (steps 8.5 and 10),
so it takes the bytes and the chunk together.

enqueue() now keeps the released bytes in the cursor's prefix, with one
reader or several, and lets the chunk's notify() fill read(view)s from
both. A waiting auto-allocated default read takes the released bytes
alone, whole (step 9.1), before the step 9.3 shortcut can hand it the
chunk. drainNoneDescriptors is gone.

Stacked on #7478

@jasnell
jasnell added this pull request to stack #7480 September 22, 2026 21:23
@jasnell
jasnell requested review from a team as code owners September 22, 2026 21:24
@ask-bonk

ask-bonk Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

LGTM

github run

@jasnell
jasnell force-pushed the jasnell/ts-streams-released-bytes-with-chunk branch from b66f174 to a9ac572 Compare September 24, 2026 03:15
Base automatically changed from jasnell/ts-streams-held-byob-request-across-tee to main September 24, 2026 04:00
When enqueue() met a released partial read's bytes, TS filled pending
reads from them before queuing the chunk, so a waiting read(view) got
only the released bytes. The spec queues both first (steps 8.5 and 10),
so it takes the bytes and the chunk together.

enqueue() now keeps the released bytes in the cursor's prefix, with one
reader or several, and lets the chunk's notify() fill read(view)s from
both. A waiting auto-allocated default read takes the released bytes
alone, whole (step 9.1), before the step 9.3 shortcut can hand it the
chunk. drainNoneDescriptors is gone.

C++ fills the read with the released bytes alone: readable-byte ledger
#32. Behind the experimental typescript_implemented_streams flag.
@jasnell
jasnell force-pushed the jasnell/ts-streams-released-bytes-with-chunk branch from a9ac572 to 1ff0fd7 Compare September 24, 2026 04:00
@jasnell
jasnell merged commit 6b39c33 into main Sep 24, 2026
22 checks passed
@jasnell
jasnell deleted the jasnell/ts-streams-released-bytes-with-chunk branch September 24, 2026 04:50
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