Skip to content

馃搩 docs: Propose owned failures and cleanup for all - #7

Draft
Snowflyt wants to merge 2 commits into
mainfrom
design/owned-failures-and-cleanup
Draft

Snowflyt wants to merge 2 commits into
mainfrom
design/owned-failures-and-cleanup

Conversation

@Snowflyt

@Snowflyt Snowflyt commented Oct 19, 2026 •

Copy link
Copy Markdown
Owner

Summary

Propose routing effectify failures back through their suspended generators and giving Effected.all explicit ownership of child outcomes, sibling exit, and draining.

The design follows the official Koka implementation at 198fc3bbd158246e7604210ee6692ee72c2d9c50, with source-linked mappings for await ownership, the resumption queue, cancellation, outstanding children, and error selection. It calls out the JavaScript adaptations explicitly:

  • Each child receives its own rejection and can recover before all chooses failure.
  • The coordinator remains alive until all owned children reach terminal outcomes.
  • A close request is issued once per child, and already-queued stale body wakeups are invalidated. Both are deliberate differences from the pinned Koka cancellation behavior.
  • Native finally cannot provide an unconditional shielding guarantee. It can already be running when cancellation arrives, or even override an incoming return and execute ordinary code afterward.

Included

  • A design proposal with concrete compatibility decisions and staged implementation dependencies.
  • A Node 24.19 standalone regression oracle with seven cases and current / proposed expectations; the same entry point always runs seven independent JavaScript iterator-protocol controls.

This is a design-stage draft for review and archival. It does not change the runtime implementation, and the proposed regression expectations do not pass yet.

Validation

On tinyeffect 0.3.4 / 0a867fe930c86a2b16432581440468af0da1c129:

  • Current-behavior oracle: 7/7 passed.
  • Proposed-behavior oracle: 0/7 passed, intentionally reproducing the outstanding failures.
  • Iterator protocol controls: 7/7 passed.
  • The full npm run lint entry point passes with the existing typed ESLint configuration and default-project limit, with no lint errors or warnings.
  • TypeScript 5.8.2 strict/no-emit check of the script and its imported source passes.
  • Both proposed files pass the existing Prettier configuration.
  • The script uses controlled in-memory Promises and verifies imported source hashes remain unchanged.
  • No Koka compiler execution, external I/O cancellation test, or runtime fix is claimed.

The standalone script requires Node 24.19 synchronous module hooks and native TypeScript support; these requirements do not expand the library's Node support requirements.

Related drafts

This proposal follows the narrower, independent drafts below. They establish prerequisites and context; this design-stage PR does not include their runtime changes.

The owned-outcome and drain contract here is the next coordinated design step, rather than a replacement for those isolated fixes.

Full lint entry-point correction

The initial two-script layout exceeded the existing type-aware lint default-project limit when the full npm run lint command loaded nine files. The protocol controls now share the single reproducer entry point, leaving eight files. No ESLint configuration or limit is relaxed. Both oracle modes report protocolControls separately from the library cases.

CI

CI run 39264096136 passed for 18a4b1994fb766ffe504cd8055ef416a3100a039: the full lint entry point, typecheck, and existing type-proof/runtime tests on Node 18, 20, and 22. The proposed-behavior oracle remains an intentionally failing standalone diagnostic until the runtime design is implemented.

@Snowflyt
Snowflyt force-pushed the design/owned-failures-and-cleanup branch from afd1f9d to 10f3843 Compare October 19, 2026 13:42
@Snowflyt Snowflyt changed the title 馃摑 docs: Propose owned failures and cleanup for all 馃搩 docs: Propose owned failures and cleanup for all Oct 19, 2026
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.

1 participant