Repository navigation
fix: harden eager builder execution and cleanup - #299
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.