Skip to content

fix: harden eager builder execution and cleanup - #299

Merged
dbrattli merged 1 commit into
mainfrom
fix/builder-execution-contract
Nov 11, 2026
Merged

dbrattli merged 1 commit into
mainfrom
fix/builder-execution-contract

Conversation

@dbrattli

Copy link
Copy Markdown
Owner

Custom synchronous builders could loop indefinitely when bind skipped its continuation, silently swallow StopIteration from builder hooks, or leave a suspended generator open after failure. Enforce a synchronous, single-use continuation and close the generator through evaluation and the final run hook. Only generator exhaustion now counts as normal completion, and zero() is only needed for empty computations.

Separate continuation handling, evaluation, and cleanup into named operations. Preserve built-in Option/Result/Seq behavior and document the eager execution contract, including the existing None and EffectError conventions. Deferred and branching builders remain unsupported; AsyncBuilder is unchanged.

Adds regression coverage for hook exceptions, invalid and retained continuations, cleanup, and stack safety.

Verification: just check (593 tests, lint, formatting, and strict typing). Energy State Analyzer clears both cognitive-complexity warnings; one coherence warning remains for the related interpreter outcome classes and legacy state.

@dbrattli
dbrattli merged commit 3bdf02f into main Nov 11, 2026
6 checks passed
@dbrattli
dbrattli deleted the fix/builder-execution-contract branch November 11, 2026 23:27
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