Skip to content

[v24.x] Revert parked transform write changes - #66913

Open
mcollina wants to merge 2 commits into
nodejs:v24.x-stagingfrom
mcollina:revert-webstreams-parked-write-v24.x
Open

mcollina wants to merge 2 commits into
nodejs:v24.x-stagingfrom
mcollina:revert-webstreams-parked-write-v24.x

Conversation

@mcollina

@mcollina mcollina commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Reverts the two commits that moved parked TransformStream writes off the [[backpressureChangePromise]] reaction, which regressed AsyncLocalStorage propagation into transform() / flush() (#66906):

The fix on main (#66907) relies on AsyncContextFrame alone, which doesn't cover --no-async-context-frame / the async_hooks-based AsyncLocalStorage that v24.x still has, so reverting is the safer option for the release line.

Conflicts with later commits are resolved by keeping their state record classes (TransformStreamState now carries backpressureChange again) and the kParkedAlgorithmResult handling still used by ReadableStream.from(). test-whatwg-transformstream-parked-write-error.js is kept: it covers spec behavior and passes on the reverted code. The pipe-through benchmark is kept too.

Verified locally on this branch:

repro (issue):                  a:writer b:writer c:writer d:writer e:writer flush:writer
repro, --no-async-context-frame: a:writer b:writer c:writer d:writer e:writer flush:writer
reverse (reader in als.run):     a:none b:none c:none flush:none   (both modes)

The regression test from #66907 passes in both modes; whatwg/webstream tests, WPT streams, async-local-storage and async-hooks suites pass.

Refs: #66906
Refs: #66907


AI-generated, reviewed by me.

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. v24.x Issues that can be reproduced on v24.x or PRs targeting the v24.x-staging branch. web streams Issues and PRs related to the Web Streams API. labels Oct 22, 2026
@codecov

codecov Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.28%. Comparing base (9e39360) to head (beeec2e).
⚠️ Report is 615 commits behind head on v24.x-staging.

Additional details and impacted files
@@                Coverage Diff                @@
##           v24.x-staging   #66913      +/-   ##
=================================================
- Coverage          90.31%   90.28%   -0.03%     
=================================================
  Files                711      718       +7     
  Lines             228425   238195    +9770     
  Branches           43160    45293    +2133     
=================================================
+ Hits              206293   215055    +8762     
- Misses             14090    14637     +547     
- Partials            8042     8503     +461     
Files with missing lines Coverage Δ
lib/internal/webstreams/transformstream.js 98.58% <100.00%> (+0.02%) ⬆️

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

This reverts commit bbb0055.

A parked TransformStream write was resumed from the read that lifted
the backpressure, so transform(), the writes queued behind it and
flush() ran in the reader's async context instead of the writer's,
losing AsyncLocalStorage state.

The parked write error test is kept, as it covers spec behavior that
still holds after the revert.

Refs: nodejs#65625
Refs: nodejs#66906

Signed-off-by: Matteo Collina <hello@matteocollina.com>
This reverts commit 86d1196.

Resolving a parked write from the readable side ran the first parked
transform() in the reader's async context. Conflicts with later
commits are resolved by keeping their state record classes and the
kParkedAlgorithmResult check used by ReadableStream.from().

Refs: nodejs#65143
Refs: nodejs#66906

Signed-off-by: Matteo Collina <hello@matteocollina.com>
@mcollina
mcollina force-pushed the revert-webstreams-parked-write-v24.x branch from fe6db5d to beeec2e Compare October 22, 2026 15:50
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. v24.x Issues that can be reproduced on v24.x or PRs targeting the v24.x-staging branch. web streams Issues and PRs related to the Web Streams API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants