What happened
After Effect compiles past codegen (post #309 / #310), the link step fails with:
Undefined symbols for architecture arm64:
"_js_readable_stream_new",
referenced from: <Effect's Stream module>
"_js_readable_stream_controller_close",
"_js_readable_stream_controller_enqueue",
"_js_readable_stream_controller_error",
These are 4 FFI symbols that perry-codegen emits calls to but perry-stdlib does not provide. They correspond to the WHATWG ReadableStream constructor + controller methods.
What you expected
Either:
- Implement
ReadableStream in perry-stdlib (alongside fetch, URL, etc. from the WHATWG family). Effect's Stream module — and any Node 18+ code touching fetch().body — needs this.
- Detect at codegen time that no implementation exists and either emit a clear "ReadableStream not yet supported" error at the call site, or fall through to a runtime stub that throws on use rather than producing a link error.
Likely fix site
- Codegen emits these symbols in
crates/perry-codegen/src/lower_call.rs (search for js_readable_stream_) and / or wherever ReadableStream resolves as a built-in.
- Implementation belongs in
crates/perry-stdlib/src/streams.rs (new file), modeled after fetch.rs / buffer.rs for the FFI shape.
- Real
ReadableStream implementation is non-trivial (backpressure, queuing strategies, async iteration). A minimum-viable implementation matching Node 18's node:stream/web surface is the right scope.
Minimal reproduction
const stream = new ReadableStream({
start(controller) {
controller.enqueue("hello");
controller.close();
}
});
console.log(stream);
perry compile repro.ts -o /tmp/out
# fails at link with: Undefined symbols: _js_readable_stream_new, ...
Environment
- Perry version: 0.5.405
- Host OS: macOS 26.4 (arm64)
- Target: native
- Effect version: 3.21.2 (where this surfaced)
Adjacent gaps to consider in the same fix
While doing the WHATWG-streams audit, also check:
Discovered as part of the #309 long tail.
What happened
After Effect compiles past codegen (post #309 / #310), the link step fails with:
These are 4 FFI symbols that perry-codegen emits calls to but perry-stdlib does not provide. They correspond to the WHATWG ReadableStream constructor + controller methods.
What you expected
Either:
ReadableStreamin perry-stdlib (alongsidefetch,URL, etc. from the WHATWG family). Effect's Stream module — and any Node 18+ code touchingfetch().body— needs this.Likely fix site
crates/perry-codegen/src/lower_call.rs(search forjs_readable_stream_) and / or whereverReadableStreamresolves as a built-in.crates/perry-stdlib/src/streams.rs(new file), modeled afterfetch.rs/buffer.rsfor the FFI shape.ReadableStreamimplementation is non-trivial (backpressure, queuing strategies, async iteration). A minimum-viable implementation matching Node 18'snode:stream/websurface is the right scope.Minimal reproduction
perry compile repro.ts -o /tmp/out # fails at link with: Undefined symbols: _js_readable_stream_new, ...Environment
Adjacent gaps to consider in the same fix
While doing the WHATWG-streams audit, also check:
WritableStream(likely emitted but unimplemented too)TransformStreamReadableStreamDefaultReader/ReadableStreamDefaultControllerpipeTo/pipeThroughResponse.body(currently unwired — see response.blob() drops body bytes — same shape as #227, needs Blob instance methods #234 follow-ups)Discovered as part of the #309 long tail.