Parent
Problem
The runtime-portable readBoundedSource implementation retains caller-owned Uint8Array views until iteration completes. An async source may reuse or mutate a yielded backing buffer before the reader assembles the payload, overwriting earlier bytes and producing malformed or semantically different JSON.
Scope
- Snapshot every caller-owned binary chunk before requesting the next async-iterator item. String chunks produced by the reader remain owned and need no redundant copy.
- Preserve the exact byte ceiling, strict UTF-8/JSON behavior, abort behavior, Buffer-free runtime portability, and existing
ClusterRequestError contracts.
- Add a regression test whose async source reuses and mutates one backing
Uint8Array across yields; assert the originally yielded bytes are decoded.
- Cover a subarray/shared-backing-buffer case so retaining a view cannot regress.
- Avoid unrelated changes and do not modify the known unrelated E2E cleanup-race tests.
Delivery
Target the existing PR #891 head branch through a dependent PR whose base is zeroshot/platinum-forest-30. Parent PR #891 remains paused until this fix lands and all required checks pass.
Parent
Problem
The runtime-portable
readBoundedSourceimplementation retains caller-ownedUint8Arrayviews until iteration completes. An async source may reuse or mutate a yielded backing buffer before the reader assembles the payload, overwriting earlier bytes and producing malformed or semantically different JSON.Scope
ClusterRequestErrorcontracts.Uint8Arrayacross yields; assert the originally yielded bytes are decoded.Delivery
Target the existing PR #891 head branch through a dependent PR whose base is
zeroshot/platinum-forest-30. Parent PR #891 remains paused until this fix lands and all required checks pass.