Repository navigation
Description
What version of Effect is running?
@effect/platform-node v4 source at discovery base 243c72f001dd87385839c057af48f346abcf480b; publication base: 243c72f001dd87385839c057af48f346abcf480b. Reproduced on Node v26.5.0 with Undici 8.10.0.
What steps can reproduce the bug?
Return binary bytes such as a PNG signature from an owned local HTTP server. Fetch through NodeHttpClient.layerNodeHttp or layerUndici, obtain response.text without running it, then read response.arrayBuffer.
Runnable regression and controls: accessing text does not change $name bytes and fresh arrayBuffer preserves $name, for PNG, BOM, and ASCII fixtures. Additional controls exercise consumption order and Node body limits. After branch push, run from its repository root:
pnpm test --run packages/platform/node/test/NodeHttpClient.responseBytes.test.ts packages/platform/node/test/NodeHttpClient.responseBytes.controls.test.ts packages/platform/node/test/NodeHttpClient.test.ts --reporter=verbose --maxWorkers=1 --no-file-parallelism --sequence.concurrent=falseWhat is the expected behavior?
The byte reader returns the received bytes regardless of text-getter access. Decoding text must not overwrite the original binary representation.
What do you see instead?
Invalid UTF-8 bytes become replacement-character encodings, and the Undici BOM fixture loses its BOM. Reading arrayBuffer on a fresh response preserves the bytes; ASCII controls also succeed.
Additional information
Both text getters install an array-buffer effect that re-encodes decoded text. NodeHttpIncomingMessage is also used for server requests. A raw-reader-based correction must retain existing BOM order behavior and apply Node's byte-sized MaxBodySize to received bytes, rather than preserving incidental replacement-character expansion as a limit policy.
All reproduction servers listen on owned ephemeral loopback ports. No external endpoint is needed. This is distinct from Undici's unsupported formData method.
Validation: Post-commit validation on 454ee9876595: 84 distinct tests passed, 0 failed, 0 skipped. All listed PR Verification test commands, root pnpm lint-fix, root pnpm check, and committed/worktree whitespace checks passed; the worktree remained clean. The frozen paired base run at 243c72f001dd has 6 failing and 22 passing matched cases for this fix. Another 56 passing adjacent tests were not represented in that base JSON. Only the selected test files were run; integration and cluster suites were disabled.
Audit
Runtime correctness audit; intended label: audit.
Activity