test: error propagation through hooks and builders#38
Draft
Koan-Bot wants to merge 1 commit into
Draft
Conversation
Verify that exceptions (die) thrown inside any hook or builder propagate correctly to the caller rather than being swallowed: - _build_* dies → propagates through lazy getter, no stale cache - _before_*, _validate_*, _after_* die → propagates through setter - build()/initialize() die → propagates through new() - _before_build/_after_build die → propagates through new() - with() on missing module → propagates require error - Object state integrity after hook exceptions - Re-entrancy guard cleanup after exception (local) 25 new tests covering all error paths. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
What
25 new tests validating that exceptions thrown inside hooks and builders propagate correctly to callers.
Why
All existing tests verify the happy path of hooks (return true/false to allow/block). No test verified that
dieinside a hook or builder reaches the caller intact. This matters because:_build_*that dies need the error, not silence_before_*would make setters silently succeed when they shouldn'tlocal-based guard cleanup after exceptions is a subtle correctness propertyHow
Inline test packages with hooks/builders that
dieon specific inputs. Each error path tested:_build_*,_before_*,_validate_*,_after_*in setter and constructorbuild(),initialize(),_before_build,_after_buildinnew()with()on a missing moduleTesting
prove -lv t/19-error-propagation.t— 25 tests, full suite green.🤖 Generated with Claude Code
Quality Report
Changes: 1 file changed, 226 insertions(+)
Code scan: clean
Tests: passed (OK)
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline