Skip to content

stream/iter: consecutive stateless stream/iter transforms lose downstream flush output #63467

@trivikr

Description

@trivikr

Version

26.2.0

Platform

macOS 26.5.0

Subsystem

stream

What steps will reproduce the bug?

import { from, pull, text } from 'node:stream/iter';

const enc = new TextEncoder();

const addAOnFlush = (chunks) => chunks === null ? [enc.encode('-A')] : chunks;
const addBOnFlush = (chunks) => chunks === null ? [enc.encode('-B')] : chunks;

console.log(await text(pull(from('x'), addAOnFlush, addBOnFlush)));

How often does it reproduce? Is there a required condition?

Always

What is the expected behavior? Why is that the expected behavior?

x-A-B

Each stateless transform in the chain should receive a final null flush signal after all upstream data, including data emitted by earlier flushes, has been processed. Therefore transform B should first process A’s -A trailer and then receive its own flush signal, producing x-A-B.

What do you see instead?

x-A

Additional information

No response

Metadata

Metadata

Assignees

Labels

streamIssues and PRs related to the stream subsystem.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions