← Back to Pull requests

fs: read data when highWaterMark is 0 #67669

Closed
unknown closed this pull request without merging on Nov 23, 2026 07:13 UTC
View on GitHub
unknown unknown commented on Nov 21, 2026 07:02 UTC
Author

ReadStream.prototype._read() ended the stream when it was asked for 0 bytes, so an fs.ReadStream with highWaterMark: 0 emitted 'end' without any data. Since #66956 this also hits every fs.ReadStream after stream.setDefaultHighWaterMark(false, 0).

When the requested size is 0, read 64 KiB, the fs.ReadStream default, instead. The size passed to _read() is only advisory, and getDefaultHighWaterMark() can't be used here because it also returns 0 after setDefaultHighWaterMark(false, 0). The start/end limits still apply.

This fixes flowing mode ('data', pipe()). Consuming such a stream with toArray() or for await also needs the fix for #67668, because fs.ReadStream uses construct().

Fixes: https://github.com/nodejs/node/issues/67667
Refs: https://github.com/nodejs/node/pull/66956

Testing: the new test/parallel/test-fs-read-stream-hwm-zero.js fails without the fix and passes with it. The related fs, stream, readline, zlib and webstreams tests pass, the full parallel and sequential suites pass locally with both PRs applied, and make lint-js is clean.

AI disclosure: I used AI coding agents to help investigate the bug and write the fix and the tests. I reviewed the change, reproduced the bug on v24.22.0 and main, and checked the test results above.

Diff: 170 lines (+127 / -43) across 2 files Reviewer: christianaurichzm Review duration: 2890m
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.35) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.35 · 170 lines diff across 2 files
0.35
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.308
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #67669"
general weight: 0.35
Assignees
Unassigned
Labels
risk: low confidence: 60.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 35.2% (MEDIUM) · Higher = larger blast radius
35.2%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 60.5% · Lower = rushed or shallow review
60.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 13.9% · Safe to merge
13.9%
Repository