ReviewOS

home-lang/home

Bun parity: finish pipeTo AbortSignal lifecycle cleanup

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

Parent: #66 Predecessor: #380

Frontier: js/web/streams/pipeTo-signal-leak.test.ts at corpus position 4180, copied unchanged from ~/Code/bun.

Current blocker: pending async test promise in aborting signal still works and cleans up after pipe completes via abort; Home reports that the path requires event-loop support.

Scope:

  • Port ReadableStream.pipeTo { signal } abort behavior and settlement ordering.
  • Detach abort listeners after normal completion and abort to prevent retained signals/listeners.
  • Preserve source cancel/destination abort options and reason identity.
  • Provide structured operation/phase/cause/stack diagnostics for lifecycle failures.
  • Add permanent regressions for completion, abort, cleanup, and listener counts; update #66 with exact counts.
10 days ago

Completed in c95902f (fix(streams): complete pipeTo abort lifecycle) and pushed to main.

Verified contracts:

  • copied Bun corpus position 4180 passes unchanged: 1 file, 2 passed, 0 failed, 0 todo, 0 unsupported;
  • 200 sequential abort cycles now settle instead of hanging;
  • abort preserves exact reason identity through pipe rejection, source cancellation, and destination abortion;
  • the signal listener is detached exactly once and the readable lock is released;
  • controller capture now preserves the underlying source cancel hook;
  • abort owns settlement, so a cancellation-resolved read cannot race the pipe into fulfillment;
  • invalid signals reject with ERR_INVALID_ARG_TYPE, operation = readableStream.pipeTo, and phase = validate-signal, while releasing the reader;
  • permanent lifecycle regression passes;
  • full zig build --cache-dir /private/tmp/home-zig-abi-cache passes.

This advances parent #66 from predecessor #380 through corpus position 4180.

Sign in to comment on this issue.