Validate a writable chunk's size only when it is enqueued - #7507
Merged
Merged
Conversation
Contributor
|
I'm Bonk, and I've done a quick review of your PR. Updates writable chunk-size validation timing and adds after-close regression coverage.
|
guybedford
approved these changes
Sep 24, 2026
guybedford
left a comment
Contributor
There was a problem hiding this comment.
LGTM. Verified the new test fails on main (uncaught RangeError) and passes here across the TS and C++ writable configs; //src/wpt:streams-ts@ still passes. The check now sits where EnqueueValueWithSize makes it, and controllerWrite has a single caller so nothing bypasses it.
GetChunkSize rejected a NaN, negative or infinite size() result by erroring the stream, even for a write made after close() that the state checks were about to reject. The close then rejected with the RangeError, and an earlier queued write rejected with it too, without reaching the sink. The range check moves to controllerWrite, where the spec's EnqueueValueWithSize makes it. A write after close() now rejects alone and the close completes; a live write with an invalid size errors the stream as before. C++ rejects the late write with its conversion TypeError and, with an earlier write queued, rejects the close too (ledger #9). Behind the experimental typescript_implemented_streams flag.
jasnell
force-pushed
the
jasnell/ts-streams-writable-late-size
branch
from
September 25, 2026 04:24
3f0f536 to
0a3c563
Compare
jasnell
enabled auto-merge
September 25, 2026 04:25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GetChunkSize rejected a NaN, negative or infinite size() result by erroring the stream, even for a write made after close() that the state checks were about to reject. The close then rejected with the RangeError, and an earlier queued write rejected with it too, without reaching the sink.
The range check moves to controllerWrite, where the spec's EnqueueValueWithSize makes it. A write after close() now rejects alone and the close completes; a live write with an invalid size errors the stream as before.
C++ rejects the late write with its conversion TypeError and, with an earlier write queued, rejects the close too (ledger #9). Behind the experimental typescript_implemented_streams flag.