Skip to content

stream: use validateBuffer for BYOB reader view - #65046

Open
greenheadHQ wants to merge 1 commit into
nodejs:mainfrom
greenheadHQ:readablestream-validate-buffer
Open

stream: use validateBuffer for BYOB reader view#65046
greenheadHQ wants to merge 1 commit into
nodejs:mainfrom
greenheadHQ:readablestream-validate-buffer

Conversation

@greenheadHQ

Copy link
Copy Markdown
Contributor

ReadableStreamBYOBReader.prototype.read() open-codes the check that validateBuffer performs, while ReadableStreamBYOBRequest.prototype.respondWithNewView() a few hundred lines above already calls validateBuffer(view, 'view') for the same argument. Both build ERR_INVALID_ARG_TYPE from the same name and type list, so the rejection is unchanged.

No new test: readable-byte-streams/general.any.js already covers read() with a non-view argument.

The same check is already spelled validateBuffer(view, 'view') in
ReadableStreamBYOBRequest.respondWithNewView(), and the thrown error is
unchanged.

Signed-off-by: greenhead <shren0812@gmail.com>
@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. web streams labels Aug 5, 2026
@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.29%. Comparing base (3e6cca0) to head (7002d14).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #65046      +/-   ##
==========================================
- Coverage   90.30%   90.29%   -0.01%     
==========================================
  Files         759      759              
  Lines      247612   247602      -10     
  Branches    46686    46681       -5     
==========================================
- Hits       223604   223579      -25     
- Misses      15460    15462       +2     
- Partials     8548     8561      +13     
Files with missing lines Coverage Δ
lib/internal/webstreams/readablestream.js 98.16% <100.00%> (-0.01%) ⬇️

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

@greenheadHQ

Copy link
Copy Markdown
Contributor Author

The aarch64-darwin: with shared libraries failure is unrelated to this change. It is parallel/test-stream-pipeline-http2, which is listed as flaky in nodejs/reliability#1622. The same commit passes on every other platform, including x86_64-darwin, and the test does not touch web streams.

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. web streams

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants