Skip to content

test: error propagation through hooks and builders#38

Draft
Koan-Bot wants to merge 1 commit into
masterfrom
koan.atoomic/test-error-propagation
Draft

test: error propagation through hooks and builders#38
Koan-Bot wants to merge 1 commit into
masterfrom
koan.atoomic/test-error-propagation

Conversation

@Koan-Bot

@Koan-Bot Koan-Bot commented May 1, 2026

Copy link
Copy Markdown
Collaborator

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 die inside a hook or builder reaches the caller intact. This matters because:

  • Users debugging a _build_* that dies need the error, not silence
  • A swallowed exception in _before_* would make setters silently succeed when they shouldn't
  • local-based guard cleanup after exceptions is a subtle correctness property

How

Inline test packages with hooks/builders that die on specific inputs. Each error path tested:

  • _build_*, _before_*, _validate_*, _after_* in setter and constructor
  • build(), initialize(), _before_build, _after_build in new()
  • with() on a missing module
  • Object state integrity and guard cleanup after exceptions

Testing

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

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>
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