Trivikram Kamat
fb6693eeaa
stream: preserve push signal abort reason
...
Pass the stream-wide signal reason directly to writer.fail() so valid
non-Error abort reasons are not replaced with an AbortError.
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: codex:gpt-5.6-sol
PR-URL: https://github.com/nodejs/node/pull/64798
Fixes: https://github.com/nodejs/node/issues/64797
Reviewed-By: Aviv Keller <me@aviv.sh >
2026-08-04 04:58:22 +00:00
Trivikram Kamat
d2e4682d56
stream: skip zero-byte broadcast writes
...
Zero-byte writes append entries to the broadcast buffer without
increasing bufferedBytes. This allows write('') and writev([]) to
bypass backpressure and grow the buffer without bound.
Treat zero-byte batches as successful no-ops, matching push streams,
and add coverage for the synchronous and asynchronous writer methods.
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: codex:gpt-5.6-sol
PR-URL: https://github.com/nodejs/node/pull/64772
Fixes: https://github.com/nodejs/node/issues/64771
Reviewed-By: Aviv Keller <me@aviv.sh >
2026-08-03 05:29:58 +00:00
Trivikram Kamat
bb76938e24
stream: honor AbortSignal in Writer.end()
...
Reject Writer.end() when its signal is already aborted without
closing the writer. For push writers, reject the pending operation
if the signal aborts while buffered data drains, while allowing the
graceful close to continue.
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: codex:gpt-5.6-sol
PR-URL: https://github.com/nodejs/node/pull/64727
Fixes: https://github.com/nodejs/node/issues/64726
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day >
2026-08-02 00:11:19 +00:00
Jungwon Sohn
8dce37c06f
stream: use validateString for consumer encoding
...
Replace the manual `options.encoding` type check in stream iterator
consumers with the shared validator. Add coverage for non-string values
in the async and sync text consumers.
Signed-off-by: sjungwon03 <sjungwon03@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/64754
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com >
2026-08-01 01:00:20 +00:00
Trivikram Kamat
7bee75438f
stream: abort pending single-source merge reads
...
Make the single-source merge path abort-aware so signal cancellation
rejects a pending read and closes the active source iterator.
Handle synchronous iterator return values when marking aborted cleanup
as handled.
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
PR-URL: https://github.com/nodejs/node/pull/64445
Fixes: https://github.com/nodejs/node/issues/64444
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
2026-07-24 05:08:09 +00:00
Trivikram Kamat
e383a1da48
stream: use RangeError for broadcast overflow
...
Reject strict-backpressure writes with a RangeError when the broadcast
pending writes queue is full.
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
PR-URL: https://github.com/nodejs/node/pull/64420
Fixes: https://github.com/nodejs/node/issues/64419
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
2026-07-24 02:44:32 +00:00
Trivikram Kamat
68dc116f34
stream: skip null output from stateful transforms
...
Treat null yielded by sync and async stateful transforms as no output,
consistent with transform normalization semantics.
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
PR-URL: https://github.com/nodejs/node/pull/64462
Fixes: https://github.com/nodejs/node/issues/64461
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
2026-07-23 23:32:17 +00:00
Archkon
de6eeece8f
zlib: validate pledgedSrcSize as a safe integer
...
pledgedSrcSize represents an exact byte count. Reject values that are
not non-negative safe integers instead of silently ignoring or coercing
them through IntegerValue().
Apply the same validation to zlib/iter and retain a native validation
check for internal callers.
Signed-off-by: Archkon <180910180+Archkon@users.noreply.github.com >
PR-URL: https://github.com/nodejs/node/pull/64604
Fixes: https://github.com/nodejs/node/issues/64603
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
Reviewed-By: Jan Martin <jan.krems@gmail.com >
2026-07-23 22:17:50 +00:00
James M Snell
64c115072e
stream, quic: update iterable streams backpressure
...
Signed-off-by: James M Snell <jasnell@gmail.com >
Assisted-by: Opencode/Opus
PR-URL: https://github.com/nodejs/node/pull/64464
Reviewed-By: Tim Perry <pimterry@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
2026-07-23 05:19:45 -07:00
James M Snell
b9ed467618
stream: update iterable streams to use budget backpressure
...
Updates the implementation to use the updated backpressure
model that landed here: https://github.com/WinterTC55/iter-streams/pull/23
Signed-off-by: James M Snell <jasnell@gmail.com >
Assisted-by: Opencode/Opus
PR-URL: https://github.com/nodejs/node/pull/64464
Reviewed-By: Tim Perry <pimterry@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
2026-07-23 05:19:44 -07:00
Trivikram Kamat
4991131590
stream: fix drop-newest behavior in share()
...
Discard upstream pull results when the shared buffer has reached its
highWaterMark instead of allowing the buffer to grow beyond its limit.
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
PR-URL: https://github.com/nodejs/node/pull/64417
Fixes: https://github.com/nodejs/node/issues/64416
Reviewed-By: James M Snell <jasnell@gmail.com >
2026-07-21 00:52:34 +00:00
Mahin Anowar
39f427d3cc
stream: resume flow when an errored pipe destination is removed
...
When a source is piped to multiple destinations and one destination
errors synchronously in `_write()`, `write()` returns false without
setting `needDrain` (since the "avoid unnecessary drain for sync
stream" change). The pipe cleanup only re-invoked the source's drain
handler when the destination still had `needDrain` set, so the errored
destination was never removed from the source's `awaitDrainWriters`
set. The source stayed paused forever and any remaining healthy
destination stopped receiving data.
Always invoke the drain handler during cleanup. `pipeOnDrain` only
removes this destination from the awaiting-drain set and resumes the
source once nothing else is awaiting a drain, so it is safe to call
unconditionally and no-ops when this destination was not awaiting a
drain.
Fixes: https://github.com/nodejs/node/issues/53185
Signed-off-by: Mahin Anowar <86069420+MahinAnowar@users.noreply.github.com >
PR-URL: https://github.com/nodejs/node/pull/64310
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2026-07-18 19:08:26 +00:00
Trivikram Kamat
874e96ee4c
stream: validate writer options signal
...
Validate options.signal for stream/iter writer write(), writev(),
and end() methods across push, broadcast, and fromWritable.
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/64385
Fixes: https://github.com/nodejs/node/issues/64384
Reviewed-By: James M Snell <jasnell@gmail.com >
2026-07-16 06:41:15 +00:00
Trivikram Kamat
608112affa
stream: reject push iterator.throw() with error
...
Keep the existing consumer cancellation side effects, but
reject the iterator.throw() call with the supplied error
instead of resolving with done: true.
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/64380
Fixes: https://github.com/nodejs/node/issues/64378
Reviewed-By: James M Snell <jasnell@gmail.com >
2026-07-16 03:43:34 +00:00
Livia Medeiros and louiellan
727e2bce8e
lib,tools: add node-core/func-name-matching lint rule
...
And rename functions accordingly.
Signed-off-by: LiviaMedeiros <livia@cirno.name >
Co-authored-by: louiellan <louie.lou.llaneta@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/57901
Refs: https://github.com/nodejs/node/issues/57899
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2026-07-14 15:30:56 +02:00
Trivikram Kamat
14166a59cc
stream: validate writevSync chunks before queuing
...
Ensure writevSync() validates every chunk before handing the batch to
the push queue. Invalid chunks now throw ERR_INVALID_ARG_TYPE without
leaving data readable from the failed write.
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/64300
Fixes: https://github.com/nodejs/node/issues/64299
Reviewed-By: James M Snell <jasnell@gmail.com >
2026-07-12 04:01:07 +00:00
Trivikram Kamat
6eff6797be
stream: copy SAB-backed chunks in iter consumers
...
Ensure bytes() copies single chunks backed by SharedArrayBuffer so
arrayBuffer() and arrayBufferSync() return ArrayBuffer instances as
specified.
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/64382
Fixes: https://github.com/nodejs/node/issues/64381
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Mattias Buelens <mattias@buelens.com >
2026-07-11 04:48:55 +00:00
Trivikram Kamat
4140d4c2c8
stream: reject nested async streamables in from()
...
Reject nested async iterables and toAsyncStreamable values when from()
is consuming a sync iterable source. Promise values are still awaited.
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/64352
Fixes: https://github.com/nodejs/node/issues/64351
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2026-07-10 07:01:45 +00:00
Trivikram Kamat
0032189dbe
stream: avoid draining merged iter sources
...
Defer reading the next value from each source in merge() until the
merged consumer resumes after receiving the previous value.
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/64293
Fixes: https://github.com/nodejs/node/issues/63566
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day >
2026-07-08 23:01:52 +00:00
Yagiz Nizipli
f653d84fcd
stream: hoist repeated loads in readable paths
...
fromList() re-read state.length and each chunk's length several times
per call and re-loaded buffer[idx] around every copy, and read() loaded
state.length three times in its read(0) check; the engine cannot fold
these loads across the intervening copy and slice calls. Cache them in
locals instead. Ported from Bun's fork of the same functions
(src/js/internal/streams/readable.ts fromList/read), which carries
these hoists on top of the shared readable-stream lineage.
benchmark/compare.js against the unmodified baseline (60-run capture
plus an independent 30-run repeat, Welch t-test):
streams/readable-unevenread +0.65% (p=4.3e-4) / +0.59% (p=5.9e-3) and
streams/pipe.js +0.74% (p=2.0e-4) / +0.52% (p=8.8e-3), with no
significant regression across the captured streams benchmarks.
Refs: https://github.com/oven-sh/bun/blob/main/src/js/internal/streams/readable.ts
Signed-off-by: Yagiz Nizipli <yagiz@nizipli.com >
Assisted-by: Grok (Grok Build)
PR-URL: https://github.com/nodejs/node/pull/64312
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2026-07-08 15:05:43 +00:00
Trivikram Kamat
91b65a4fe8
stream: prefer sync iterator in fromSync
...
When an input provides Symbol.iterator, fromSync() should consume the
synchronous iterator instead of rejecting the input because it also
exposes an asynchronous or promise-like protocol.
Continue rejecting async-only iterables and promise/thenable-only
inputs, but allow sync iterables that also define Symbol.asyncIterator
or then().
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/64294
Fixes: https://github.com/nodejs/node/issues/64292
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2026-07-08 07:06:40 +00:00
Efe
6adfff9d5f
stream: preserve half-open duplexes in async iteration
...
Signed-off-by: Efe Karasakal <hi@efe.dev >
PR-URL: https://github.com/nodejs/node/pull/64275
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com >
2026-07-06 15:15:59 +00:00
Trivikram Kamat
b59def5e81
stream: reject iter consumers on abort
...
Make stream/iter async consumers observe abort signals while waiting
for a pending async iterator read. This lets bytes(), text(),
arrayBuffer(), and array() reject promptly with the abort reason
instead of waiting for another batch.
Move the shared abort-aware iterator wrapper to stream/iter utils so
pull and consumers use the same helper.
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/64066
Fixes: https://github.com/nodejs/node/issues/64065
Reviewed-By: James M Snell <jasnell@gmail.com >
2026-07-04 22:12:51 +00:00
Trivikram Kamat
b09d07df10
stream: fix merge abort for pending sources
...
Wake the multi-source merge loop when its abort signal fires so a
pending read rejects instead of waiting for another source to settle.
When the primary error is the abort reason, do not await iterator
cleanup because sources may already be stuck in pending next() calls.
Fixes: https://github.com/nodejs/node/issues/64012
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/64013
Fixes: https://github.com/nodejs/node/issues/64012
Reviewed-By: James M Snell <jasnell@gmail.com >
2026-07-04 19:47:30 +00:00
Trivikram Kamat
f2f241a40f
stream: normalize Broadcast.from() byte inputs
...
Route non-Broadcastable inputs through from(). This makes strings
and ArrayBuffer views byte inputs instead of generic iterables.
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/64082
Fixes: https://github.com/nodejs/node/issues/64081
Reviewed-By: James M Snell <jasnell@gmail.com >
2026-06-30 06:25:00 +00:00
Daijiro Wachi
07e27ad5e6
stream: proxy first own method in Readable.wrap()
...
The method-proxying loop in Readable.prototype.wrap() started at
index 1, silently skipping streamKeys[0] and leaving a method at the
first own-enumerable key unproxied.
This was introduced in ee9e2a2eb6 when ArrayPrototypeForEach(
ObjectKeys(stream), ...) — which iterates from index 0 — was
rewritten as a manual for loop for performance. The faithful
translation starts at 0; a sibling loop converted in the same commit
correctly does so. The bug stayed hidden because keys[0] is usually
_events (a non-function), which the loop's typeof guard skips anyway.
Signed-off-by: Daijiro Wachi <daijiro.wachi@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/64048
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Mattias Buelens <mattias@buelens.com >
2026-06-23 15:24:34 +00:00
Trivikram Kamat
a0263feb16
stream: observe abort while awaiting pipeTo source
...
Use the abort-aware iterator wrapper in the no-transform pipeTo()
path so a pending source read does not block AbortSignal handling.
Fixes: https://github.com/nodejs/node/issues/64014
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/64015
Fixes: https://github.com/nodejs/node/issues/64014
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
2026-06-22 07:47:40 +00:00
Trivikram Kamat
0dbb5df1fe
stream: respect iter consumer abort signals
...
Delegate broadcast.push() and share.pull() calls with per-consumer
AbortSignals through pull(), so pending next() calls reject when the
signal aborts.
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/63997
Fixes: https://github.com/nodejs/node/issues/63302
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
2026-06-22 07:47:25 +00:00
Matteo Collina
07fb744b99
stream: handle setEncoding after buffered data
...
Signed-off-by: Matteo Collina <hello@matteocollina.com >
PR-URL: https://github.com/nodejs/node/pull/63973
Refs: https://github.com/nodejs/node/pull/63570
Refs: https://github.com/nodejs/undici/issues/5002
Reviewed-By: Jithil P Ponnan <jithil@outlook.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2026-06-20 09:35:34 +00:00
Daijiro Wachi
9fa6e8a516
stream: fix Utf8Stream stall after full write of multi-byte data
...
Signed-off-by: Daijiro Wachi <daijiro.wachi@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/63964
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2026-06-20 16:12:16 +09:00
Trivikram Kamat
d1eaaf60c3
stream: keep overlapping broadcast reads pending
...
Broadcast consumers may receive overlapping next() calls on the same
iterator. Queue those reads so chunks satisfy them in call order.
A single written chunk should resolve the earliest pending next();
later next() calls remain pending until more data is written or the
broadcast completes.
Fixes: https://github.com/nodejs/node/issues/63499
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/63500
Fixes: https://github.com/nodejs/node/issues/63499
Reviewed-By: James M Snell <jasnell@gmail.com >
2026-06-20 04:04:08 +00:00
James M Snell
b03e6e0997
stream: refine the stream/iter backpressure
...
In `Writer`, there are two queues that matter: the slot queue
and the pending queue. The sync `writeSync`/`writevSync` only
use the slot queue. If writes cannot be accepted directly into
slots, they return `false`. The sync methods *never* enqueue
into the pending queue. The async `write`/`writev` will first
attempt to add to the slot queue; if it is full, then it will
attempt to add to the pending queue; if that is also full, the
backpressure policy kicks in.
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/63697
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day >
2026-06-17 16:08:46 +00:00
Daijiro Wachi
6e8c1717e2
stream: fix dropped first chunk in Utf8Stream buffer mode
...
Signed-off-by: Daijiro Wachi <daijiro.wachi@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/63833
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Mattias Buelens <mattias@buelens.com >
2026-06-16 02:30:51 +00:00
Trivikram Kamat
9d2db708ca
stream: remove transform-writer handling in pipeTo
...
The pipeTo() and pipeToSync() argument parser already requires the
destination argument to be a writer. Remove the later transform-writer
handling so writer objects with a transform() method are treated only
as destinations.
Fixes: https://github.com/nodejs/node/issues/63683
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/63684
Fixes: https://github.com/nodejs/node/issues/63683
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2026-06-15 03:49:40 +00:00
Antoine du Hamel
1778eeb6e4
lib: add lint rule to enforce use of kEmptyObject
...
Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/63790
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2026-06-10 10:56:56 +00:00
Daijiro Wachi
549833792e
stream: check done before backpressure in stream reader
...
Signed-off-by: Daijiro Wachi <daijiro.wachi@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/63699
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2026-06-09 04:53:54 +00:00
Trivikram Kamat
696030d7a1
stream: fix pipeToSync byte accounting
...
Stop pipeToSync() from counting chunks when writeSync() or writevSync()
returns false without accepting the data. Preserve writers that use
false as an accepted backpressure signal.
Fixes: https://github.com/nodejs/node/issues/63562
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/63564
Fixes: https://github.com/nodejs/node/issues/63562
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2026-06-08 22:45:07 +00:00
Trivikram Kamat
822ef3afb6
stream: reject pull() reads on abort
...
Make pull() race pending source reads against the provided AbortSignal
so aborting can reject a pending next() even when the source is waiting
before yielding data.
Fixes: https://github.com/nodejs/node/issues/63497
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/63498
Fixes: https://github.com/nodejs/node/issues/63497
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2026-06-07 19:16:05 +00:00
Trivikram Kamat
5f727fdc89
stream: fast-path stateless transform flush results
...
Avoid generator-based normalization for common flush result types in
fused stateless stream/iter transforms. This keeps the corrected flush
ordering while reducing overhead for already-normalized batches and
primitive byte outputs.
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/63605
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2026-06-04 05:38:18 +00:00
Trivikram Kamat
37779fdf1c
stream: handle falsy push writer fail reasons
...
Reject reads based on writer state so explicit falsy fail reasons do
not leave reads pending.
Fixes: https://github.com/nodejs/node/issues/63568
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/63569
Fixes: https://github.com/nodejs/node/issues/63568
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2026-06-01 23:18:12 +00:00
Trivikram Kamat
c126cbfd9b
stream: handle sync writev completion in pipeTo
...
Treat writer.writev() returning undefined as synchronous success to
match the existing write() fallback behavior for duck-typed writers.
This avoids calling Promise.prototype.then on undefined after a batch
write has already been accepted.
Fixes: https://github.com/nodejs/node/issues/63560
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/63561
Fixes: https://github.com/nodejs/node/issues/63560
Reviewed-By: James M Snell <jasnell@gmail.com >
2026-06-01 17:03:09 +00:00
Trivikram Kamat
040c51c98f
stream: settle pending broadcast reads on return
...
Resolve pending next() calls when broadcast consumers are returned,
so the promise does not remain pending after iterator cleanup.
Fixes: https://github.com/nodejs/node/issues/63519
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/63603
Fixes: https://github.com/nodejs/node/issues/63519
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2026-05-31 07:59:42 +00:00
Antoine du Hamel
27199ee190
stream: switch to internal sleep binding
...
Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/63611
Reviewed-By: Mattias Buelens <mattias@buelens.com >
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2026-05-30 09:05:09 +00:00
Trivikram Kamat
40dc5a1dc4
stream: use data listener for compose forwarding
...
Forward Node.js tail stream data through a pipe-style data listener
instead of manually draining readable events. This keeps compose closer
to the stream pipe hot path while preserving backpressure with pause
and resume.
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/63593
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
2026-05-29 07:59:57 +00:00
Trivikram Kamat
5174c66ca9
stream: serialize concurrent share consumer reads
...
Ensure overlapping next() calls on a single share() consumer resolve
in the same order they were requested.
Fixes: https://github.com/nodejs/node/issues/63477
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/63478
Fixes: https://github.com/nodejs/node/issues/63477
Reviewed-By: James M Snell <jasnell@gmail.com >
2026-05-28 15:43:50 +00:00
Antoine du Hamel
2cdea86b49
stream: fix lint error ( #63598 )
...
Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/63598
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Mattias Buelens <mattias@buelens.com >
2026-05-27 13:38:22 +02:00
Trivikram Kamat
7dbded23af
stream: reject pending reads on iterator throw
...
Settle reads that are already waiting when a push stream iterator is
returned or thrown. This prevents next() promises from hanging after
consumer cancellation.
Fixes: https://github.com/nodejs/node/issues/63554
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/63555
Fixes: https://github.com/nodejs/node/issues/63554
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2026-05-27 08:14:13 +00:00
Trivikram Kamat
92f48f43fe
tools: enforce iterator result property order
...
Add a custom ESLint rule requiring iterator result objects to place
`done` before `value`, and update existing lib iterator result objects
to follow the rule.
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/63526
Reviewed-By: Mattias Buelens <mattias@buelens.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2026-05-26 17:19:42 +00:00
Trivikram Kamat
8c495c8030
stream: wait for push writer end fallback to drain
...
When endSync() returns -1 after buffered writes, a follow-up end()
should stay pending until the readable side drains the queued data.
Do not make duplex channel close() wait for that drain, since close()
only needs to signal EOF to the peer. Waiting there can deadlock when
the peer starts reading only after close() resolves.
Fixes: https://github.com/nodejs/node/issues/63502
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/63503
Fixes: https://github.com/nodejs/node/issues/63502
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2026-05-25 06:50:32 +00:00
Trivikram Kamat
837910d298
stream: flush each fused stateless transform
...
Ensure consecutive stateless stream/iter transforms each receive a
final null flush after upstream flush output has been processed.
Fixes: https://github.com/nodejs/node/issues/63467
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com >
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/63468
Fixes: https://github.com/nodejs/node/issues/63467
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2026-05-23 21:43:57 +00:00