Skip to content

Stream parity: default high-water marks, stream.duplexPair, and readable.wrap - #3538

Open
ctate wants to merge 18 commits into
mainfrom
ctate/stream-parity-default-9447f5
Open

ctate wants to merge 18 commits into
mainfrom
ctate/stream-parity-default-9447f5

Conversation

@ctate

@ctate ctate commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator
  • Moves six stream matrix rows to supported (get/setDefaultHighWaterMark in both sections, readable.wrap, stream.duplexPair) and records Node's prose highWaterMark-after-setEncoding() note as not-applicable.
  • Implements the per-isolate byte/object defaults, the connected DuplexSide pair, and the old-style-source adapter natively, with five new differential corpus programs covering success, ordering, and error shapes.
  • Adds the typed and checked-dynamic lowerings, the ambient declarations, the compatibility entries and detail strings, and the docs limitations text.

getDefaultHighWaterMark/setDefaultHighWaterMark hold per-isolate
byte-mode and object-mode defaults that every constructor resolves at
construction time, with the setter's integer and range validation.
stream.duplexPair builds Node's connected DuplexSide pair, and
readable.wrap answers for an old-style source with the push-over-the-
high-water-mark pause and the error/close/destroy paths. The typed and
checked-dynamic lowerings, ambient declarations, compatibility rows,
and docs limitations text follow.

Callback slots in the stream state now unlink before releasing what
they held. A closure's teardown can run the cycle collector, and a pass
that found the released closure still linked would walk an edge whose
reference was just given up, leaving a denominator the trial
decrement cannot balance and pinning the cycle.
@vercel

vercel Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
scriptc Ready Ready Preview, v0 Nov 13, 2026 2:36am UTC

Comment on lines +96 to +99
void scr_stream_set_default_hwm(bool object_mode, double value) {
if (!scr_stream_check_default_hwm(value)) return;
if (object_mode) scr_stream_default_hwm_object = value;
else scr_stream_default_hwm_bytes = value;

@vercel vercel Bot Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After setDefaultHighWaterMark(true, value), Duplex.from(asyncFunction) still uses a high-water mark of 16, ignoring the new object-mode default.

Fix on Vercel

Comment thread packages/runtime/src/scr_stream.c Resolved
@vercel-internal-security-reviewer

Copy link
Copy Markdown

Security review details

Comment thread packages/runtime/src/scr_stream_web.c Resolved
Comment thread packages/runtime/src/scr_stream_web.c Resolved
Comment on lines +4499 to +4506
const literal = constArrayLiteral(lowerer, node);
if (literal !== null) {
// A spread element's stages are only known at run time.
const elements = literal.elements.nodes;
if (elements.some((e) => ts.isSpreadElement(e) || ts.isOmittedExpression(e)))
return { kind: "dynamic", node };
return { kind: "list", stages: elements };
}

@vercel vercel Bot Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passing a const stage array to pipeline still re-reads its initializer references rather than the stored elements, so reassigned stage variables or changed properties pipe different streams.

Fix on Vercel

Comment on lines +3190 to +3192
const encoding = opts.encodingValue ? hidden("%encoding", opts.encodingValue) : null;
const signal = opts.signal ? hidden("%signal", opts.signal) : null;
let out: IrExpr = built;

@vercel vercel Bot Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Readable.from still reads runtime encoding and signal options before evaluating a web ReadableStream source argument, so source-side updates to those values are ignored.

Fix on Vercel

This branch was successfully deployed

1 active deployment
Preview — b2073803 Deployed Nov 13, 2026 by vercel[bot]
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.

1 participant