Modern Command Dispatch Architecture #97

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

Background and Context

The specification (§ Command Dispatch Router, § Action Middleware Pipeline) describes a
modern command dispatch system that replaces the current Wisper pub/sub fan-out pattern
with a trie-based command router and composable middleware pipeline.

Currently, player input is broadcast to ALL subscribed CommandHandler instances via
Wisper's :player_input event. Each handler independently regex-matches the input.
This is O(n) in the number of handlers and provides no centralized middleware for
cross-cutting concerns like permission checks, balance validation, or logging.

The specified architecture uses:

  1. Trie-based router — O(k) lookup where k = command length, with self-registration
  2. Middleware pipeline — before_action/after_action filters with priority ordering

Expected Behavior

All player commands dispatch through CommandRouter with O(k) lookup. Cross-cutting
concerns are handled by middleware rather than duplicated in each handler.

Acceptance Criteria

  • Trie-based CommandRouter replaces Wisper fan-out for command dispatch
  • Middleware pipeline handles permission, balance, position, cooldown checks
  • EventSourcingMiddleware centralizes ES event emission
  • All existing commands migrated to new registration pattern
  • All child Epics completed

Subtasks

  • Complete Epic: Trie-based Command Dispatch Router
  • Complete Epic: Action Middleware Pipeline

Definition of Done

This Legendary is complete when all child Epics are closed and their acceptance
criteria are satisfied.

## Background and Context The specification (§ Command Dispatch Router, § Action Middleware Pipeline) describes a modern command dispatch system that replaces the current Wisper pub/sub fan-out pattern with a trie-based command router and composable middleware pipeline. Currently, player input is broadcast to ALL subscribed `CommandHandler` instances via Wisper's `:player_input` event. Each handler independently regex-matches the input. This is O(n) in the number of handlers and provides no centralized middleware for cross-cutting concerns like permission checks, balance validation, or logging. The specified architecture uses: 1. **Trie-based router** — O(k) lookup where k = command length, with self-registration 2. **Middleware pipeline** — before_action/after_action filters with priority ordering ## Expected Behavior All player commands dispatch through `CommandRouter` with O(k) lookup. Cross-cutting concerns are handled by middleware rather than duplicated in each handler. ## Acceptance Criteria - Trie-based CommandRouter replaces Wisper fan-out for command dispatch - Middleware pipeline handles permission, balance, position, cooldown checks - EventSourcingMiddleware centralizes ES event emission - All existing commands migrated to new registration pattern - All child Epics completed ## Subtasks - [ ] Complete Epic: Trie-based Command Dispatch Router - [ ] Complete Epic: Action Middleware Pipeline ## Definition of Done This Legendary is complete when all child Epics are closed and their acceptance criteria are satisfied.
freemo self-assigned this 2026-03-15 04:25:24 +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#97
No description provided.