ReviewOS

home-lang/home

Bun parity: honor transferred buffers in TextDecoderStream

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

Tracks the first copied Bun corpus failure at position 4100: js/web/encoding/text-decoder-stream.test.ts.

Home currently retains bytes from an ArrayBuffer transferred through MessageChannel in the corpus runtime, so TextDecoderStream emits stale data from a detached Uint8Array view. The port should model transfer ownership centrally and make stream decoding treat transferred ArrayBuffer/ArrayBufferView chunks as empty, while preserving normal ArrayBuffer and SharedArrayBuffer streaming behavior.

Green prefix before this gap:

  • 4097 encode-bad-chunks.test.ts: 6 passed
  • 4098 text-decoder-cjk.test.ts: 30 passed
  • 4099 text-decoder-single-byte.test.ts: 13 passed
10 days ago

Implemented and pushed in 206c26bdc (fix(streams): honor transferred decoder chunks).

The corpus runtime now records ArrayBuffer ownership transfer at the MessagePort boundary and makes TextDecoderStream treat transferred ArrayBuffer/ArrayBufferView chunks as detached and empty. SharedArrayBuffer streaming remains unchanged.

Verification:

  • encode-bad-chunks.test.ts: 6 passed
  • text-decoder-cjk.test.ts: 30 passed
  • text-decoder-single-byte.test.ts: 13 passed
  • text-decoder-stream.test.ts: 39 passed
  • combined new prefix: 88 passed, 0 failed, 0 unsupported
  • permanent HTTP/web tail queue: passed
  • clean zig build --cache-dir /private/tmp/home-zig-abi-cache: passed

Sign in to comment on this issue.