镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Tracking: Effect framework end-to-end compat (post-#309 / #310) #321

Closed

Description

@proggeramlug

Goal

Get Effect (effect@3.21.2 and later) to compile + link + run end-to-end via perry compile with perry.compilePackages: ["effect"]. This validates Perry on one of the largest pure-TypeScript libraries in the ecosystem (~150 modules, ~30k LOC for Effect.ts alone) and proves Perry can handle the heavy-generics / heavy-closures / fiber-runtime patterns that mid-to-large TS apps use.

Status snapshot (perry 0.5.405)

✅ Module collection — 362 modules collected (#310 closed: namespace re-exports traverse correctly)
✅ Codegen completes — no OOM, codegen runs to completion (#309 closed: was 34 GB RSS / 7m SIGKILL)
🔴 Codegen produces 26 module failures — see sub-issues
🔴 Link fails — 901 missing-symbol references resolving to ~5 distinct root causes

Sub-issues blocking end-to-end

# Issue Modules affected Severity
#318 closure-collector dead arms (use of undefined value '@perry_closure_*') 17 largest — single fix flips many modules
#314 closure-call arity ceiling at 5 args 5 high — easy to bump constant if runtime supports it
#320 ReadableStream / Web Streams stdlib not implemented needed by Stream module medium — requires new stdlib work
#319 string self-append: local N not in scope 1 low — likely subsumed by #318
#315 String.startsWith 2-arg form 1 low
#316 String.slice() 0-arg form 1 low
#317 String.matchAll codegen 1 low

Reproducible test bed

mkdir effect-compat && cd effect-compat
cat > package.json <<'JSON'
{
  "name": "effect-compat",
  "version": "0.0.0",
  "type": "module",
  "perry": { "compilePackages": ["effect"] }
}
JSON
bun add effect
// test_minimal.ts
import { Effect } from "effect";
const program = Effect.succeed(42);
const result = Effect.runSync(program);
console.log("result:", result);
perry compile test_minimal.ts -o /tmp/out
# Expected eventually: "result: 42"
# Today: link fails (post-#309/#310)

Recommended fix order (by leverage)

  1. perry-codegen: closure-collector misses HIR variants — use of undefined value '@perry_closure_*' on Effect #318 — closure-collector walker fix is the biggest win and prevents this bug class from recurring on any future package. Recommend the v0.5.329 Tier 1.1 pattern (centralize via perry_hir::walker::walk_expr_children).
  2. perry-codegen Phase D.1: closure-call arity ceiling at 5 args blocks Effect #314 — single-line fix if the runtime already supports up to 16 args (it does).
  3. perry-codegen: String.startsWith 2-arg form (with position) unsupported #315 + perry-codegen: String.slice() 0-arg form unsupported #316 + perry-codegen Phase 2: String.matchAll codegen not implemented #317 — small focused fixes in lower_string_method.rs, can land as one PR.
  4. perry-codegen: string self-append: local 441 not in scope on Effect's internal/channel.ts #319 — recheck after perry-codegen: closure-collector misses HIR variants — use of undefined value '@perry_closure_*' on Effect #318; likely subsumed.
  5. perry-stdlib: ReadableStream / Web Streams API not implemented #320 — biggest scope; can be deferred until everything else is done since Effect's Stream is one of many features users want, but other Effect parts (Effect.gen, Layer, Schedule, etc.) work without it.

Definition of done

The minimal repro above produces a binary that prints result: 42 and exits 0. Bonus: Effect.gen + Effect.runPromise of an async program also works.

Backlog beyond the link errors

Even after #314-#320 are fixed, two pre-existing categorical gaps will surface in user code that touches Effect deeply:

  • arguments magic object — Effect's dual() helper uses it 148 times to implement data-first / data-last API duality. Already documented in docs/src/language/limitations.md. Workaround: keep using "unknown identifier 'arguments'" warnings for now; long-term, support arguments or land a dual() shim.
  • Intl.* — DateTime / Schedule / Duration formatting. Adjacent to existing perry-runtime i18n work.

Cross-references: #309 (OOM, fixed), #310 (silent-zero, fixed).

Activity

  1. added 7 commits that reference this issue on Apr 30, 2026
  2. proggeramlug commented on Apr 30, 2026

    @proggeramlug
    ContributorAuthor

    All seven sub-issues called out in the tracking table are now closed:

    # Issue Closed in
    #318 closure-collector dead arms v0.5.408
    #314 closure-call arity ceiling at 5 args v0.5.409
    #320 ReadableStream / Web Streams stdlib v0.5.410
    #319 string self-append: local N not in scope v0.5.411
    #315 String.startsWith / endsWith 2-arg form v0.5.414
    #317 String.matchAll codegen v0.5.415
    #316 String.slice() 0-arg form v0.5.424

    The remaining work to close this umbrella is the Definition of Done smoke test — the 4-line Effect.runSync(Effect.succeed(42)) repro from this issue's body should compile, link, and print result: 42. Recommend running that on a fresh checkout of main (≥ v0.5.424) and closing once verified.

    Backlog notes in the issue body about arguments magic object (Effect's dual() helper, 148 sites) and Intl.* formatting still apply as separate follow-up work for users compiling Effect deeply.

  3. proggeramlug commented on Apr 30, 2026

    @proggeramlug
    ContributorAuthor

    Status update — perry 0.5.424

    All 7 original sub-issues (#314–#320) are closed. Re-running the minimal repro on v0.5.424:

    Phase v0.5.405 v0.5.424
    Modules collected 362 ✅ 362 ✅
    Codegen failures 26 10
    Missing-symbol references 901 419
    Final state link fail still link fail

    Roughly 60% reduction in failure surface, but the binary still doesn't link. Three new failure modes have surfaced from the residual tail and are filed as new sub-issues:

    # Issue Modules affected
    #336 @perry_class_keys_<module>__<ClassName> collisions on same-named classes in different scopes 7 (Refinement×3, Class×2, SingleShotGen×2)
    #337 @__perry_wrap_perry_unknown_func referenced in IR but never defined 2
    #338 Residual closure-collector miss (post-#318) — undefined @perry_closure_..._SchemaAST_ts__142 1

    Plus #320 (ReadableStream / Web Streams stdlib) is still the largest stdlib gap.

    Updated checklist

    End-to-end definition of done (binary prints result: 42 and exits 0) requires #336 + #337 + #338 + #320.

  4. added 2 commits that reference this issue on Apr 30, 2026
  5. proggeramlug commented on May 1, 2026

    @proggeramlug
    ContributorAuthor

    Status update post-v0.5.464:

    The smaller sub-issues called out in this umbrella are all closed (#314, #315, #316, #317, #318, #319, #320 — all per the changelog). However, the end-to-end Effect.runSync(Effect.succeed(42)) repro from this issue's "definition of done" still fails at link with 248 unresolved @perry_closure_* symbol references across multiple Effect modules.

    This is the same closure-collector walker bug class that #318 closed — but for closure shapes the v0.5.408 fix didn't yet enumerate. Each new shape needs another pass through collectors.rs::collect_closures_in_expr's walker delegation or a new Expr variant added to the centralized walker.

    Leaving this open as the umbrella tracking issue. The hot-fix pattern is: rerun the Effect compile, find the closure ID symbol mentioned in the linker error, find its source HIR site, identify which Expr variant the codegen-emit path is descending through but the collector isn't, fix the walker.

  6. proggeramlug commented on May 3, 2026

    @proggeramlug
    ContributorAuthor

    Re-tested perry 0.5.495 against Effect 3.21.2 (same minimal repro from this issue). Two new sub-issues blocking the link:

    Status snapshot at v0.5.495:

    Once #431 and #432 land, expect the same minimal repro (Effect.runSync(Effect.succeed("hi"))) to be the next thing to test end-to-end. If it links, the next likely runtime layer (generators / Effect.gen / yield* delegation) hasn't been exercised yet.

  7. added a commit that references this issue on May 4, 2026
  8. 79 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugConfirmed defect or regression

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions