Skip to content

stream: validate fromWritable() options before cache#63278

Open
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:stream-iter-from-writable-cache-options
Open

stream: validate fromWritable() options before cache#63278
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:stream-iter-from-writable-cache-options

Conversation

@trivikr
Copy link
Copy Markdown
Member

@trivikr trivikr commented May 13, 2026

Fixes stream/iter fromWritable() cache handling so later options are
validated and applied correctly.

Previously, fromWritable(writable) cached a strict writer, and later calls
such as fromWritable(writable, { backpressure: 'drop-newest' }) returned that
cached strict writer before validating or applying the new options. This also
meant invalid later options did not throw.

This updates fromWritable() to validate options before cache lookup and cache
writers by both Writable instance and backpressure policy.

Fixes: #63277


Assisted-by: openai:gpt-5.5

@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/streams

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. stream Issues and PRs related to the stream subsystem. labels May 13, 2026
Validate options before returning a cached fromWritable() adapter so
invalid later options still throw.

Cache adapters by backpressure policy as well as Writable instance,
since the policy changes write behavior.

Fixes: nodejs#63277

Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: openai:gpt-5.5
@trivikr trivikr force-pushed the stream-iter-from-writable-cache-options branch from 2785bd3 to eb326fb Compare May 13, 2026 07:56
@trivikr trivikr self-assigned this May 13, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.03%. Comparing base (78bbee3) to head (eb326fb).
⚠️ Report is 18 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #63278      +/-   ##
==========================================
- Coverage   90.04%   90.03%   -0.02%     
==========================================
  Files         713      714       +1     
  Lines      225003   225250     +247     
  Branches    42536    42576      +40     
==========================================
+ Hits       202606   202805     +199     
- Misses      14177    14218      +41     
- Partials     8220     8227       +7     
Files with missing lines Coverage Δ
lib/internal/streams/iter/classic.js 89.44% <100.00%> (+0.09%) ⬆️

... and 43 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@trivikr trivikr added the request-ci Add this label to start a Jenkins CI on a PR. label May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run. request-ci Add this label to start a Jenkins CI on a PR. stream Issues and PRs related to the stream subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

stream/iter: fromWritable() cache ignores later options

2 participants