FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

stream: prefer sync iterator in fromSync by trivikr · Pull Request #64294 · nodejs/node · GitHub

/ node Public

stream: prefer sync iterator in fromSync - #64294

Merged
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
trivikr:stream-iter-fromsync-iter
Jul 8, 2026
Merged

stream: prefer sync iterator in fromSync#64294
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
trivikr:stream-iter-fromsync-iter

Conversation

trivikr commented Jul 4, 2026
edited
Loading

Copy link
Copy Markdown
Member

Fixes: #64292

stream/iter's fromSync() rejected any input that exposed
Symbol.asyncIterator, even when the same input also exposed
Symbol.iterator.

This updates fromSync() to reject only inputs without a synchronous
iteration path, allowing dual sync/async iterables and thenable sync
iterables to be consumed through their synchronous iterator.


Assisted-by: openai:gpt-5.5

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/streams

nodejs-github-bot added needs-ci PRs that need a full CI run. stream Issues and PRs related to the stream subsystem. labels Jul 4, 2026
trivikr added the request-ci Add this label to start a Jenkins CI on a PR. label Jul 4, 2026
Comment thread lib/internal/streams/iter/from.js Outdated

mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

lgtm

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

This comment was marked as outdated.

trivikr force-pushed the stream-iter-fromsync-iter branch from 1e713e7 to f21d604 Compare July 6, 2026 06:17
trivikr requested a review from aduh95 July 6, 2026 06:20
trivikr added the request-ci Add this label to start a Jenkins CI on a PR. label Jul 6, 2026
github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 7, 2026

This comment was marked as outdated.

This comment was marked as outdated.

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
trivikr force-pushed the stream-iter-fromsync-iter branch from f21d604 to ce6448e Compare July 8, 2026 00:38

This comment was marked as outdated.

trivikr added the request-ci Add this label to start a Jenkins CI on a PR. label Jul 8, 2026

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.25%. Comparing base (4ee2117) to head (ce6448e).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #64294      +/-   ##
==========================================
+ Coverage   90.23%   90.25%   +0.01%     
==========================================
  Files         741      741              
  Lines      240979   240984       +5     
  Branches    45401    45409       +8     
==========================================
+ Hits       217449   217500      +51     
+ Misses      15112    15068      -44     
+ Partials     8418     8416       -2     
Files with missing lines Coverage Δ
lib/internal/streams/iter/from.js 88.18% <100.00%> (+0.09%) ⬆️

... and 30 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 Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 8, 2026

Copy link
Copy Markdown
Collaborator

trivikr added author ready PRs that have at least one approval, no outstanding review comments, and a CI started. commit-queue Add this label to land a pull request using GitHub Actions. labels Jul 8, 2026
nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jul 8, 2026
nodejs-github-bot merged commit 91b65a4 into nodejs:main Jul 8, 2026
76 checks passed

Copy link
Copy Markdown
Collaborator

Landed in 91b65a4

trivikr deleted the stream-iter-fromsync-iter branch July 13, 2026 05:14
aduh95 pushed a commit that referenced this pull request Jul 21, 2026
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: #64294
Fixes: #64292
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
RafaelGSS pushed a commit that referenced this pull request Jul 29, 2026
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: #64294
Fixes: #64292
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
aduh95 pushed a commit that referenced this pull request Aug 6, 2026
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: #64294
Fixes: #64292
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no outstanding review comments, and a CI started. 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: fromSync() rejects dual sync/async iterables instead of using Symbol.iterator

5 participants


Back | FazBrowse Home | New Git URL