Skip to content

[v26.x] Revert parked transform write changes - #66914

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

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

Conversation

@mcollina

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):

Conflicts with later commits are resolved by keeping their state record classes (TransformStreamState now carries backpressureChange again), the kParkedAlgorithmResult handling still used by ReadableStream.from(), and the kResolvedPromise import used by resolvedStartAlgorithm (3c9f878). 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.

Alternative: #66915 (draft) backports the fix from #66907 instead, with a promise fallback for --no-async-context-frame. Only one of the two should land.

Refs: #66906
Refs: #66907
Refs: #66913

🤖 Generated with Claude Code

https://claude.ai/code/session_01LGUJ9PwPYkYJiCpUEsr7KJ

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. v26.x Issues that can be reproduced on v26.x or PRs targeting the v26.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.75%. Comparing base (ca26282) to head (ac998a5).
⚠️ Report is 1275 commits behind head on v26.x-staging.

Additional details and impacted files
@@                Coverage Diff                @@
##           v26.x-staging   #66914      +/-   ##
=================================================
+ Coverage          90.24%   90.75%   +0.51%     
=================================================
  Files                729      775      +46     
  Lines             242760   273391   +30631     
  Branches           46044    52520    +6476     
=================================================
+ Hits              219073   248117   +29044     
- Misses             15133    16144    +1011     
- Partials            8554     9130     +576     
Files with missing lines Coverage Δ
lib/internal/webstreams/transformstream.js 98.60% <100.00%> (+0.03%) ⬆️

... and 414 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 f81a148.

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 9ec9383.

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-v26.x branch from ac998a5 to 2463b52 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. v26.x Issues that can be reproduced on v26.x or PRs targeting the v26.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