test: pin the rejection semantics of a piped upstream body that ends inline

Closed
RO
5d ago
+53-5

Follow-up to #36939, from review of that PR.

#36939 fixed a double release when a native ByteStream request body ends inline, which also made the error path's semantics reachable for the first time: a downstream fetch() whose piped upstream body was truncated rejects with the upstream TypeError (code: "ECONNRESET"). The fixture swallowed every rejection with a bare catch {}, so those semantics were pinned nowhere, and the only coverage of the path was ASAN-gated.

  • The fixture now asserts every rejection's shape (TypeError / ECONNRESET, rethrowing anything else) and reports the count; the test asserts rejected=100.
  • New non-ASAN companion test drives the truncated-upstream pipe deterministically and asserts the rejection shape. The rejection is identical whether the error reaches the ByteStream before the native sink wires (the EndedInline path) or after (end_from_stream), so the assertion holds on either side of that race and cannot flake.

Verification: bun bd test test/js/web/fetch/fetch-abort-stream-body.test.ts 5/5 runs, 6 pass / 0 fail (1 pre-existing skip). Test-only change; no fail-before claim since the behavior it pins landed with #36939.


no test proof · iteration 1 · Platform-specific test-only change; deferring to CI.