Epic: Trie-based Command Dispatch Router #98

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

Metadata

  • Commit Message: feat(dispatch): implement trie-based command router
  • Branch: feature/command-router

Background and Context

The specification describes a CommandRouter backed by a trie data structure for
O(k) command lookup. Each CommandAction subclass self-registers via a
register_command class macro. The router supports exact match, prefix match,
and regex fallback for pattern-based commands.

Expected Behavior

Commands are registered at load time and dispatched in O(k) where k is the command
length. Ambiguous prefixes are detected and reported. Admin commands use a / prefix.
Regex fallback handles pattern-based commands (emotes, etc.).

Acceptance Criteria

  • TrieNode data structure with insertion and longest-prefix lookup
  • RouteEntry data model with command class, priority, and metadata
  • CommandRouter.register API for static registration
  • CommandRouter.dispatch(player, input) as the single dispatch entry point
  • Self-registration via register_command class macro
  • Regex fallback for commands not matched by the trie
  • All existing commands migrated
  • BDD test coverage

Subtasks

  • Implement TrieNode and RouteEntry
  • Implement CommandRouter.register and dispatch
  • Add self-registration class macro
  • Migrate existing commands
  • Add regex fallback

Definition of Done

This Epic is complete when all child issues are closed and all acceptance criteria
are satisfied.

## Metadata - **Commit Message**: `feat(dispatch): implement trie-based command router` - **Branch**: `feature/command-router` ## Background and Context The specification describes a `CommandRouter` backed by a trie data structure for O(k) command lookup. Each `CommandAction` subclass self-registers via a `register_command` class macro. The router supports exact match, prefix match, and regex fallback for pattern-based commands. ## Expected Behavior Commands are registered at load time and dispatched in O(k) where k is the command length. Ambiguous prefixes are detected and reported. Admin commands use a `/` prefix. Regex fallback handles pattern-based commands (emotes, etc.). ## Acceptance Criteria - `TrieNode` data structure with insertion and longest-prefix lookup - `RouteEntry` data model with command class, priority, and metadata - `CommandRouter.register` API for static registration - `CommandRouter.dispatch(player, input)` as the single dispatch entry point - Self-registration via `register_command` class macro - Regex fallback for commands not matched by the trie - All existing commands migrated - BDD test coverage ## Subtasks - [ ] Implement TrieNode and RouteEntry - [ ] Implement CommandRouter.register and dispatch - [ ] Add self-registration class macro - [ ] Migrate existing commands - [ ] Add regex fallback ## Definition of Done This Epic is complete when all child issues are closed and all acceptance criteria are satisfied.
freemo added this to the (deleted) milestone 2026-03-15 04:13:12 +00:00
freemo self-assigned this 2026-03-15 04:25:23 +00:00
freemo modified the milestone from (deleted) to v1.0.0 2026-03-16 00:28:01 +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#98
No description provided.