You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
streams: push() marks a Readable disturbed (isDisturbed/readableDidRead true before any read) — undici body.text() rejects 'unusable' #11212
In Perry, a producer-side push() marks a Readable as disturbed. stream.isDisturbed(r) and r.readableDidRead become true as soon as data is pushed. In Node both stay false until a consumer reads (read(), 'data', pipe, async iteration).
This is the next undici blocker (#11046), after #11197 (PR #11207). With #11194, #11198 and #11207 applied, the real undici 8.9.0 fixture's request() now resolves for GET, POST and 404. Every response.body.text() / .json() then rejects with TypeError: unusable. undici's consume() checks isUnusable(body) → util.isDisturbed(body) → stream.isDisturbed(body). Perry reports the body as disturbed because undici's onData has already push()ed the response chunk into it, so the body is treated as already consumed.
Repro (no packages)
import{Readable,isDisturbed}from"node:stream";classBodyextendsReadable{constructor(){super({autoDestroy: true,read(){},highWaterMark: 64*1024});}}constb: any=newBody();console.log("fresh:",isDisturbed(b),b.readableDidRead);b.push(Buffer.from("hello"));console.log("after push:",isDisturbed(b),b.readableDidRead);constp: any=newReadable({read(){}});p.push("x");console.log("plain after push:",isDisturbed(p),p.readableDidRead);
Node 26.5.1:
fresh: false false
after push: false false
plain after push: false false
Perry (main8708312 + #11207, perry-dev, Linux x64, PERRY_NO_AUTO_OPTIMIZE=1):
fresh: false false
after push: true true
plain after push: true true
Where
crates/perry-runtime/src/node_stream.rsappend_readable_output_chunk (and unshift_chunk) call mark_disturbed(stream) for every pushed chunk. In Node, kIsDisturbed / readableDidRead are set on the consumer side: in Readable.prototype.read and in 'data' emission.
undici fixture result for reference: undici 8.9.0, a local Node 26.5.1 HTTP server, auto-optimize ON, PERRY_WORKSPACE_ROOT set.
Activity