Skip to content

stream: reject nested async streamables in from()#64352

Open
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:stream-iter-from-async-generator
Open

stream: reject nested async streamables in from()#64352
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:stream-iter-from-async-generator

Conversation

@trivikr

@trivikr trivikr commented Jul 8, 2026

Copy link
Copy Markdown
Member

Fixes: #64351

This updates stream/iter.from() so the sync-iterable fallback rejects
nested async-only streamables. When from() consumes a sync iterable, nested
async iterables and toAsyncStreamable values now throw
ERR_INVALID_ARG_TYPE instead of being consumed.

Promise values yielded by sync iterables are still awaited.


Assisted-by: openai:gpt-5.5

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
@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 Jul 8, 2026
@trivikr trivikr added the request-ci Add this label to start a Jenkins CI on a PR. label Jul 8, 2026
@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.77778% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.23%. Comparing base (8e1ab55) to head (2e3bde5).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
lib/internal/streams/iter/from.js 77.77% 4 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #64352   +/-   ##
=======================================
  Coverage   90.23%   90.23%           
=======================================
  Files         741      741           
  Lines      240979   240988    +9     
  Branches    45395    45409   +14     
=======================================
+ Hits       217450   217464   +14     
  Misses      15112    15112           
+ Partials     8417     8412    -5     
Files with missing lines Coverage Δ
lib/internal/streams/iter/from.js 88.25% <77.77%> (+0.16%) ⬆️

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

@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 8, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

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.

stream/iter: from() accepts async-only nested values from sync iterables

3 participants