Skip to content

stream: avoid mutable push in writable end callbacks - #67751

Open
rozzilla wants to merge 1 commit into
nodejs:mainfrom
rozzilla:streams-writable-onfinished-no-push
Open

rozzilla wants to merge 1 commit into
nodejs:mainfrom
rozzilla:streams-writable-onfinished-no-push

Conversation

@rozzilla

Copy link
Copy Markdown
Contributor

Similar to this PR, Writable.prototype.end() queued its callback with .push() on a private array, which looks up Array.prototype.push at call time. Replacing that method from user code made end() throw or drop the callback. Use an indexed assignment instead.

@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 Node.js streams. labels Nov 24, 2026
Writable.prototype.end() queued its callback with .push() on a private
array, which looks up Array.prototype.push at call time. Replacing that
method from user code made end() throw or drop the callback. Use an
indexed assignment instead.

Signed-off-by: Roberto Bianchi <roberto.bianchi@spendesk.com>
@rozzilla
rozzilla force-pushed the streams-writable-onfinished-no-push branch from d8822ce to 01ec4e5 Compare November 24, 2026 15:36
@codecov

codecov Bot commented Nov 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.54%. Comparing base (a055d9f) to head (01ec4e5).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #67751      +/-   ##
==========================================
+ Coverage   90.52%   90.54%   +0.02%     
==========================================
  Files         803      803              
  Lines      285110   285110              
  Branches    55037    55029       -8     
==========================================
+ Hits       258101   258163      +62     
+ Misses      17143    17091      -52     
+ Partials     9866     9856      -10     
Files with missing lines Coverage Δ
lib/internal/streams/writable.js 98.17% <100.00%> (ø)

... and 36 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 Node.js streams.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants