ReviewOS

home-lang/home

Bun parity: deterministically drain async ReadableStream pull bodies

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

Upstream gap

At copied corpus position 4114 (js/web/fetch/body-clone.test.ts), a finite ReadableStream whose async pull() awaits a microtask remains pending in the JSC corpus host. The test runner reports a generic event-loop-support failure instead of draining the body.

Required parity

  • Drive finite async pull(controller) sources on reader demand without relying on an external event-loop turn.
  • Preserve chunk order and mixed string/ArrayBuffer/typed-array conversion for stream, Bun helper, Response, and Request consumers.
  • Preserve locked/cancel/close state and cloning behavior.
  • Propagate thrown/rejected pull failures with structured operation/cause stacks rather than treating them as EOF.
  • Pass all 25 upstream body-clone tests and the surrounding queue.

Tracked under #66; validated alongside #339-#344.

10 days ago

Completed in add6ef2.\n\nThe runner now drains async ReadableStream pull sources sequentially on reader demand, records replayable chunks, enforces a bounded pull count, handles cancel/close correctly, and reports pull failures as ERR_READABLE_STREAM_PULL with operation/pullCount/cause/composed stack metadata rather than swallowing them.\n\nVerified by js/web/fetch/body-clone.test.ts (25 passing) and the permanent focused clone regression.

Sign in to comment on this issue.