ReviewOS

home-lang/home

Bun parity: finish TransformStream method and pipeline contracts

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

Parent: #66 Predecessor: #383

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

Current result: 0 passed / 1 failed / 1 unsupported. The first failure is TransformStream: undefined is not an object (evaluating this.encoder.encode), showing that transformer methods lose their receiver. A later async pipeline path is still classified unsupported.

Scope:

  • Preserve transformer start, transform, and flush receiver identity and lifecycle ordering.
  • Port readable/writable pipeline behavior used by the full copied file, including async settlement and errors.
  • Add structured operation/phase/cause/stack diagnostics at transform boundaries without replacing user-thrown identity where the platform contract requires it.
  • Add permanent regressions, run the exact corpus file and full Zig build, then update #66 with exact counts.
10 days ago

Completed and pushed to main in 5ab1a5c.

Ported the full js/web/streams/streams.test.js contract at corpus position 4183:

  • TransformStream start/transform/flush receiver identity, async start gating, termination, and rejection identity
  • ReadableStream values(), async-iterator cancellation, readMany(), closed promises, and releaseLock ownership
  • direct-stream flush batching without regressing reusable pull-buffer bounds
  • BYOB EOF buffer return versus cancellation semantics
  • Blob/BunFile empty streams and structured Bun.file stream-open failures
  • ArrayBufferSink start/flush/end lifecycle and bounded high-water-mark allocation
  • raw multipart-boundary support in Bun.readableStreamToFormData and FormData.from
  • fs.ReadStream async iteration and early-break cleanup
  • exact JS SHA-1 fallback around the native deferred-GC allocation trap

Verification:

  • exact upstream file: 71 passed, 1 platform todo, 0 failed, 0 unsupported
  • permanent focused regression: 6 passed
  • existing focused stream/runtime regressions: all passed
  • zig fmt --check packages/home_test/src/corpus_runner.zig
  • git diff --check
  • zig build --cache-dir /private/tmp/home-zig-abi-cache

Cumulative corpus ledger: 524 files, 7,898 passed, 312 todo, 172 allowed-empty, 0 failed, 0 unsupported.

Parent: #66. Predecessor: #383.

Sign in to comment on this issue.