Skip to content

stream: validate streams in pipeline#62214

Open
efekrskl wants to merge 4 commits intonodejs:mainfrom
efekrskl:feat/validate-streams-in-pipeline
Open

stream: validate streams in pipeline#62214
efekrskl wants to merge 4 commits intonodejs:mainfrom
efekrskl:feat/validate-streams-in-pipeline

Conversation

@efekrskl
Copy link
Contributor

@efekrskl efekrskl commented Mar 11, 2026

Towards #55305

I still need to add the tests tests are added, but I'd appreciate some early feedback on the approach.

@nodejs-github-bot
Copy link
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 Mar 11, 2026
@Renegade334
Copy link
Member

For reviewers/releasers: all of the cases at #55305 lead to failure states, therefore this should not be a major change.

} else if (isIterable(stream) || isReadableNodeStream(stream) || isTransformStream(stream)) {
ret = stream;
} else {
ret = Duplex.from(stream);
Copy link
Member

Choose a reason for hiding this comment

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

why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As far as I see by validating and throwing early this becomes dead code. This is the branch for the "source stream" and the only case this was being used was a non-readable node stream which will now throw

}
ret = stream;
} else {
ret = Duplex.from(stream);
Copy link
Member

Choose a reason for hiding this comment

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

why?

Copy link
Contributor Author

@efekrskl efekrskl Mar 12, 2026

Choose a reason for hiding this comment

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

Similar to above, unless I'm missing something with the early validation this becomes dead code. I'm less confident on this one though 😅

@efekrskl efekrskl requested a review from mcollina March 12, 2026 16:53
@efekrskl efekrskl marked this pull request as ready for review March 17, 2026 21:29
@codecov
Copy link

codecov bot commented Mar 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.68%. Comparing base (ce6e451) to head (ca214e2).
⚠️ Report is 43 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #62214      +/-   ##
==========================================
+ Coverage   89.65%   89.68%   +0.02%     
==========================================
  Files         676      676              
  Lines      206578   206639      +61     
  Branches    39562    39581      +19     
==========================================
+ Hits       185216   185329     +113     
+ Misses      13475    13446      -29     
+ Partials     7887     7864      -23     
Files with missing lines Coverage Δ
lib/internal/streams/pipeline.js 96.26% <100.00%> (+1.14%) ⬆️

... and 47 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.

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. stream Issues and PRs related to the stream subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants