Implement object lifecycle hooks (on_create, on_destroy, on_load, on_object_save) #86

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

Metadata

  • Commit Message: feat(lifecycle): add object lifecycle hooks
  • Branch: feature/m1-lifecycle-hooks

Background and Context

Object lifecycle hooks fire when game objects are created, destroyed, loaded from
storage, or saved. Event sourcing depends on on_create and on_destroy to emit
corresponding ES commands, and on_load for auto-heal verification.

Expected Behavior

  • on_create fires in Manager#create_object after the object is added to Gary
  • on_destroy fires in Manager#delete_object before removal
  • on_load fires when an object is deserialized from GDBM
  • on_object_save fires when an individual object is persisted

Acceptance Criteria

  • Hook emission points added to Manager and StorageMachine methods
  • Each hook's HookEvent includes the game object and operation context
  • BDD scenarios verify all four hooks fire correctly

Subtasks

  • Add on_create emission to Manager#create_object
  • Add on_destroy emission to Manager#delete_object
  • Add on_load emission to StorageMachine load path
  • Add on_object_save emission to StorageMachine store path
  • Write Cucumber feature file and step definitions

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 object lifecycle hooks` - **Branch**: `feature/m1-lifecycle-hooks` ## Background and Context Object lifecycle hooks fire when game objects are created, destroyed, loaded from storage, or saved. Event sourcing depends on `on_create` and `on_destroy` to emit corresponding ES commands, and `on_load` for auto-heal verification. ## Expected Behavior - `on_create` fires in `Manager#create_object` after the object is added to Gary - `on_destroy` fires in `Manager#delete_object` before removal - `on_load` fires when an object is deserialized from GDBM - `on_object_save` fires when an individual object is persisted ## Acceptance Criteria - Hook emission points added to Manager and StorageMachine methods - Each hook's `HookEvent` includes the game object and operation context - BDD scenarios verify all four hooks fire correctly ## Subtasks - [ ] Add `on_create` emission to `Manager#create_object` - [ ] Add `on_destroy` emission to `Manager#delete_object` - [ ] Add `on_load` emission to StorageMachine load path - [ ] Add `on_object_save` emission to StorageMachine store path - [ ] Write Cucumber feature file and step definitions ## 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:05 +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#86
No description provided.