Skip to content

auto-optimize: @effect/platform Socket.ts link fails on undefined js_ws_connect_start despite external-ws-pump enabled (links fine on plain runtime) #6439

Description

@proggeramlug

Summary

Compiling an @effect/platform module that pulls in Socket.ts links fine against the plain release runtime, but fails to link against the auto-optimized runtime with undefined js_ws_connect_start — even though auto-optimize selected the external-ws-pump feature.

Repro

Sources: https://github.com/bjacobso/effect-compiled-experiment

git clone https://github.com/bjacobso/effect-compiled-experiment && cd effect-compiled-experiment
npm install
perry compile src/effect/api.ts -o dist/api      # auto-optimize ON → link error
auto-optimize: rebuilding runtime+stdlib (panic=abort,
  features=async-runtime,bundled-streams,crypto,external-http-client-pump,
           external-http-server-pump,external-ws-pump,web-fetch)
...
Undefined symbols for architecture arm64:
  "_js_ws_connect_start", referenced from:
      _perry_closure_node_modules__effect_platform_src_Socket_ts__30 in 3231ef5708f5779f.o
ld: symbol(s) not found for architecture arm64
Error: Linking failed

Also undefined in the same link: _toUnixTimestamp, _uint8ArrayToBuffer.

Why this looks like an auto-optimize feature-selection bug, not a missing impl

  • The same api.ts, same commit, same module set (311 modules) links cleanly against the plain (non-auto-optimized) release runtime — producing a 42 MB binary with zero undefined symbols.
  • external-ws-pump is in the selected feature list, yet js_ws_connect_start is still absent from the rebuilt runtime.
  • src/effect/web.ts (a superset — 371 modules, also reaching Socket.ts) does link under auto-optimize. So the failure depends on the module set in a way that looks like feature/symbol selection, not on whether Socket.ts is reachable.

That combination (links plain, fails auto-opt, feature nominally enabled) points at the auto-optimize runtime rebuild dropping an FFI symbol the compiled code still emits a callsite for — the same shape as the previously-seen "auto-opt rebuilt the lib set and dropped symbols → link fail" class.

Environment

  • Perry 889f39eda (v0.5.1258), macOS arm64
  • Coherent full cargo build --release beforehand

Note

api.ts is a module-only entry (no top-level main) — it's the natural minimal repro because it reaches Socket.ts through @effect/platform's barrel without pulling the full server graph. If a module-only entry is considered out of scope, the same feature-selection question still stands for any program whose module set lands in this shape.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions