Implement cancellable hook mechanism and error isolation #87

Open
opened 2026-03-15 04:13:06 +00:00 by freemo · 0 comments
Owner

Metadata

  • Commit Message: feat(lifecycle): add hook cancellation and error isolation
  • Branch: feature/m1-lifecycle-hooks

Background and Context

The specification requires that hooks support cancellation (a handler can prevent
downstream handlers from running) and error isolation (one failing handler must not
crash the server or prevent other handlers from executing).

Expected Behavior

  • A handler can call event.cancel! to set cancelled = true
  • Subsequent handlers in the same hook see event.cancelled? and can choose to skip
  • The emit method wraps each handler in a begin/rescue block, logging errors at
    Logger::Medium without re-raising
  • Cancellation and errors are tracked in the HookEvent for diagnostic purposes

Acceptance Criteria

  • HookEvent#cancel! and HookEvent#cancelled? methods
  • LifecycleHooks.emit respects cancellation flag
  • Error isolation with logging for each handler invocation
  • BDD scenarios for cancellation and error recovery

Subtasks

  • Add cancel! and cancelled? to HookEvent
  • Update emit to check cancellation between handlers
  • Wrap handler calls in error isolation
  • Write Cucumber scenarios for cancellation and error cases

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • A Git commit is created where the first line of the commit message matches the
    Commit Message in Metadata exactly.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata.
  • The commit is submitted as a pull request to master, reviewed, and merged.
## Metadata - **Commit Message**: `feat(lifecycle): add hook cancellation and error isolation` - **Branch**: `feature/m1-lifecycle-hooks` ## Background and Context The specification requires that hooks support cancellation (a handler can prevent downstream handlers from running) and error isolation (one failing handler must not crash the server or prevent other handlers from executing). ## Expected Behavior - A handler can call `event.cancel!` to set `cancelled = true` - Subsequent handlers in the same hook see `event.cancelled?` and can choose to skip - The `emit` method wraps each handler in a `begin/rescue` block, logging errors at `Logger::Medium` without re-raising - Cancellation and errors are tracked in the `HookEvent` for diagnostic purposes ## Acceptance Criteria - `HookEvent#cancel!` and `HookEvent#cancelled?` methods - `LifecycleHooks.emit` respects cancellation flag - Error isolation with logging for each handler invocation - BDD scenarios for cancellation and error recovery ## Subtasks - [ ] Add `cancel!` and `cancelled?` to HookEvent - [ ] Update `emit` to check cancellation between handlers - [ ] Wrap handler calls in error isolation - [ ] Write Cucumber scenarios for cancellation and error cases ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata. - The commit is submitted as a **pull request** to `master`, reviewed, and **merged**.
freemo added this to the v1.3.0 milestone 2026-03-15 04:13:06 +00:00
freemo self-assigned this 2026-03-15 04:25:23 +00:00
freemo modified the milestone from v1.3.0 to v1.0.0 2026-03-16 00:27:58 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference: aethyr/Aethyr#87
No description provided.