ReviewOS

home-lang/home

Bun parity: preserve consumed ReadableStream body errors

#382
Closed chris opened this 10 days ago ·
10 days ago

Parent: #66 Predecessor: #381

Frontier: js/web/streams/readable-stream-blob-consumed.test.ts at corpus position 4181, copied unchanged from ~/Code/bun.

Current failure: ReadableStream.blob() rejects after the stream body has already been consumed, but the rejection is missing Bun’s ERR_BODY_ALREADY_USED code.

Scope:

  • Centralize consumed/locked ReadableStream body validation for blob() and related body conversion methods.
  • Preserve a stable TypeError code plus operation/phase context and useful stack information.
  • Ensure failed conversion does not crash or mutate stream lifecycle state.
  • Add a permanent native regression, run the exact copied corpus file, run the full Zig build, and update #66 with exact counts.
10 days ago

Completed in 392a4f8 (fix(streams): preserve consumed body diagnostics) and pushed to main.

Verified contracts:

  • copied Bun corpus position 4181 passes unchanged: 1 file, 1 passed, 0 failed, 0 todo, 0 unsupported;
  • stream body conversions become disturbed exactly once instead of replaying captured bytes;
  • owner and direct consumption reject asynchronously with TypeError, ERR_BODY_ALREADY_USED, operation/phase context, a cause, and composed stack context;
  • unrelated active-reader locking remains distinct as ERR_BODY_STREAM_STATE with phase locked;
  • failed conversions do not crash or reacquire the stream;
  • permanent consumed/locked regression passes;
  • full zig build --cache-dir /private/tmp/home-zig-abi-cache passes.

This advances parent #66 from predecessor #381 through corpus position 4181.

Sign in to comment on this issue.