Skip to content

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

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

streamIssues and PRs related to Node.js streams.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions