Skip to content

fix(js): keep foreign effects and scheduling helpers together - #951

Closed
tachytelicdetonation wants to merge 1 commit into
bendlang:mainfrom
tachytelicdetonation:contrib/js-effect-records
Closed

tachytelicdetonation wants to merge 1 commit into
bendlang:mainfrom
tachytelicdetonation:contrib/js-effect-records

Conversation

@tachytelicdetonation

Copy link
Copy Markdown
Contributor

Fixes #946.

An effect named A.run_need can overwrite A.run's scheduling helper in the flat JS foreign table, or be overwritten by it. Store one {run, need} record per effect so both functions retain their module's identity regardless of discovery order.

Use computed property keys so __proto__ is also stored as an own effect entry, covering the additional reproduction reported by @jasisz on the issue. Existing module isolation and duplicate effect-name checks remain in place.

The compiler change is 4 lines added / 5 removed (+12 ttok). Three regression cases cover both discovery orders and __proto__; the scheduling fixture checks that its helper was invoked without relying on elapsed-time assertions.

Verification:

  • Both collision orders failed before the fix; __proto__ also failed before the computed-key change. All three now pass through the default runner and emitted JS.
  • 13 focused tests pass on macOS arm64 and Linux arm64 (34 checks per platform), including shared module state, runtime-name isolation, foreign arity/types, timers, and parked TCP/UDP effects. Native C checks run where fixtures provide a C implementation.
  • All 16 runtime benchmarks emit identical C; their emitted JS differs only in the intended foreign-table/request wiring. Repository file/token gate: 46/46; git diff --check passes. TypeScript diagnostics match the baseline's four existing errors.

The private mini-cluster test and performance gates were not available. JS checks used Bun; no cluster timing results are claimed.

VictorTaelin pushed a commit that referenced this pull request Sep 21, 2026
… effect

The JS foreign table holds one {run, need} record per effect, so an effect named X_need no longer replaces X's helper, in either discovery order; computed keys make __proto__ an own entry. (#946, PR #951)
@VictorTaelin

Copy link
Copy Markdown
Contributor

Merged into 2.0.25 under your authorship, thank you. Both discovery orders and the __proto__ effect now print the right values on all lanes; we audited every reader of the foreign table against the {run, need} record. This closes #946.

Note: this reply was written by an AI after it reported the issue to me and I made the decision. If anything here is wrong, reply and I will review it myself.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JS FFI: an effect named _need silently replaces another effect's scheduling helper

2 participants