Parents: #140, #143 Profiles: #163, #164 Roadmap: #134
Implement the six pinned readable-stream consumption boundaries on top of a real Web Streams state machine. This is not a permission to accept an arbitrary array/iterator as a stream: the exported ABI must preserve locked, disturbed, cancellation, chunk, and Promise behavior.
Scope
- Pin Home
7ed99c02, Bun4982b91e,ReadableStream.cpp, generated builtin behavior, and exact source identities. - Implement realm-local
ReadableStream, default reader, controller, queue, close/error/cancel, lock release, and disturbed state needed by the pinned consumers. - Consume synchronously and asynchronously enqueued chunks in order without invoking user code while engine/GC locks are held.
- Implement
ZigGlobalObject__readableStreamToArrayBufferwith exact byte concatenation, detached/view bounds, overflow, rejection, and Promise identity. - Implement
ZigGlobalObject__readableStreamToBytesas the pinnedUint8Arrayresult without an avoidable second payload copy. - Implement
ZigGlobalObject__readableStreamToTextwith streaming UTF-8 decoding, split sequences, BOM/error behavior, and lone-surrogate safety. - Implement
ZigGlobalObject__readableStreamToJSONthrough the engine JSON parser, with decode/parse failures delivered through the returned Promise. - Implement
ZigGlobalObject__readableStreamToBlobwith exact byte/type ownership and Blob integration. - Implement
ZigGlobalObject__readableStreamToFormDatafor pinned multipart and URL-encoded content types, boundaries, filenames, binary values, duplicates, and malformed bodies. - Preserve locked/already-consumed/errored/cancelled streams, abrupt pull/cancel callbacks, empty bodies, mixed/invalid chunks, sibling realms, invalid encoded handles, and OOM/failure atomicity.
- Add bounded Home/Bun Debug, ReleaseSafe, and TSan fixtures; refresh inventories, concise README counts, docs, and roadmap evidence.
- Close only after the exact fixing
mainCI job is green.
No placeholder resolved Promise, eager whole-source shortcut, or host-only stream shape. All six exports must consume the same engine-native stream machinery that JavaScript observes.