Implement EventSourcingMiddleware (after_action, priority 900) #110

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

Metadata

  • Commit Message: feat(dispatch): add event sourcing middleware
  • Branch: feature/m1-middleware-pipeline

Background and Context

The specification (§ EventSourcingMiddleware) describes an after_action middleware at
priority 900 that centralizes ES event emission. It checks if the action class defines
event_source_command, constructs a Sequent command, and dispatches it. Errors are
logged and swallowed to never crash the game loop.

Expected Behavior

  • Checks ServerConfig[:event_sourcing_enabled] && defined?(Sequent)
  • Checks action.class.respond_to?(:event_source_command)
  • Calls action.class.event_source_command(action, context) to get the command
  • Dispatches via Sequent.command_service.execute_commands(command)
  • All errors logged at Logger::Medium and swallowed

Acceptance Criteria

  • EventSourcingMiddleware at after_action priority 900
  • Guard checks for ES enabled and Sequent defined
  • Introspection of action class for opt-in
  • Error isolation (never re-raises)
  • BDD scenarios for emission and error cases

Subtasks

  • Implement EventSourcingMiddleware
  • Add guard checks and introspection
  • Add error isolation
  • Write Cucumber scenarios

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(dispatch): add event sourcing middleware` - **Branch**: `feature/m1-middleware-pipeline` ## Background and Context The specification (§ EventSourcingMiddleware) describes an after_action middleware at priority 900 that centralizes ES event emission. It checks if the action class defines `event_source_command`, constructs a Sequent command, and dispatches it. Errors are logged and swallowed to never crash the game loop. ## Expected Behavior - Checks `ServerConfig[:event_sourcing_enabled] && defined?(Sequent)` - Checks `action.class.respond_to?(:event_source_command)` - Calls `action.class.event_source_command(action, context)` to get the command - Dispatches via `Sequent.command_service.execute_commands(command)` - All errors logged at Logger::Medium and swallowed ## Acceptance Criteria - EventSourcingMiddleware at after_action priority 900 - Guard checks for ES enabled and Sequent defined - Introspection of action class for opt-in - Error isolation (never re-raises) - BDD scenarios for emission and error cases ## Subtasks - [ ] Implement EventSourcingMiddleware - [ ] Add guard checks and introspection - [ ] Add error isolation - [ ] Write Cucumber scenarios ## 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 (deleted) milestone 2026-03-15 04:13:18 +00:00
freemo self-assigned this 2026-03-15 04:25:24 +00:00
freemo modified the milestone from (deleted) to v1.0.0 2026-03-16 00:28:05 +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#110
No description provided.