ReviewOS

home-lang/home

Bun parity: finish CompressionStream and Brotli semantics

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

Parent: #66 Predecessor: #379

Frontier: js/web/streams/compression.test.ts at corpus position 4178, copied unchanged from ~/Code/bun.

Current failure: decompresses brotli data: The compressed data was invalid.

Scope:

  • Port CompressionStream/DecompressionStream algorithms and chunk/finalization behavior for gzip, deflate, deflate-raw, and Brotli.
  • Preserve readable/writable stream semantics, byte-exact round trips, format validation, and failure timing.
  • Diagnose the actual Brotli byte/bridge mismatch rather than bypassing the case.
  • Return structured operation/phase/format/cause diagnostics with composed stacks for compression failures.
  • Add permanent native regressions and advance #66 with exact counts.
10 days ago

Completed and pushed in 059bdea (feat(streams): port native Brotli decompression).

Verified unchanged Bun corpus:

  • Position 4178, js/web/streams/compression.test.ts: 11 pass, 0 fail/todo/unsupported.
  • Position 4179, js/web/streams/native-source-onclose-leak.test.ts: 4 pass, 0 fail/todo/unsupported.

Implementation:

  • Replaced the obsolete synthetic Brotli-envelope decoder with Homes native Brotli decompression bridge, matching the already-native compressor.
  • Preserves multi-chunk writer/finalization and reader behavior across Brotli, zstd, gzip, deflate, and deflate-raw.
  • Invalid decode failures now surface as TypeError with an own code plus operation=decompressionStream.decode, phase, format, cause, and composed stack.
  • Matches the Bun/Node malformed-Brotli contract: ERR__ERROR_FORMAT_PADDING_2 appears on both the surfaced error and cause.
  • Added a permanent native regression for split-input native round trips and the complete diagnostic contract.

Verification:

  • Focused corpus: 2 files, 15 pass, 0 fail, 0 todo, 0 unsupported.
  • Expanded focused native suite passes.
  • Full zig build --cache-dir /private/tmp/home-zig-abi-cache passes.

Cumulative contiguous ledger through position 4179: 520 files, 7,822 pass, 311 todo, 172 allowed-empty, 0 fail, 0 unsupported.

Next frontier: position 4180, js/web/streams/pipeTo-signal-leak.test.ts, currently blocked on a pending async abort/event-loop lifecycle.

Sign in to comment on this issue.