ReviewOS

home-lang/home

Bun.Transpiler.transform: own typed-array input across async work

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

Follow-up to #66, found in the unchanged pinned Bun transpiler corpus at source pin 4982b91e3702094330f3be3883354c52b8c01323.

Async Bun.Transpiler.transform() must retain an owned copy of Uint8Array input before dispatching work. Detaching and reusing the caller buffer while the task is in flight currently lets worker parsing observe replacement bytes.

The logical upstream behavior is represented by Bun commit cd1ad59994: copy buffer input before the worker hop, account the owned memory, release the protected caller buffer, and let the async task own the encoded slice.

Acceptance: the unchanged test transform() result is unaffected by detaching the input ArrayBuffer while the task is in flight passes, repeated detached-input stress stays deterministic, synchronous transform remains unchanged, and the full transpiler corpus gains one pass without filtering or test edits.

10 days ago

Resolved by 597c8e1515e4a43ca7ebeab61ff8f3c3b2359ef4.

The async transform entry point now ports the owned-buffer handoff from upstream Bun commit cd1ad59994: copy typed-array bytes before worker dispatch, account the owned memory, release the protected caller buffer, and transfer the encoded slice to the task.

Validation:

  • unchanged transform() result is unaffected by detaching the input ArrayBuffer while the task is in flight: 1 pass / 188 filtered / 0 fail
  • 16-iteration detached-and-reused-buffer stress regression: pass
  • unchanged js/bun/transpiler directory: 46/46
  • complete runtime regression aggregate: 61/61

Sign in to comment on this issue.