Implement Middleware base class and MiddlewarePipeline executor with priority ordering #105
Labels
No labels
Blocked
Duplicate
MoSCoW/Could Have
MoSCoW/Must Have
MoSCoW/Should Have
Points/1
Points/13
Points/2
Points/21
Points/3
Points/5
Points/8
Priority/Backlog
Priority/Critical
Priority/High
Priority/Low
Priority/Medium
State/Completed
State/In progress
State/In review
State/Paused
State/Unverified
State/Verified
State/Wont Do
Type/Bug
Type/Epic
Type/Feature
Type/Legendary
Type/Task
Type/Testing
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Reference: aethyr/Aethyr#105
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Metadata
feat(dispatch): implement Middleware base and pipeline executorfeature/m1-middleware-pipelineBackground
The
Middlewarebase class defines the interface for all middleware.MiddlewarePipelinemanages registered middleware and executes them in priority order around the action.Expected Behavior
Middlewarebase class withregisterclass method andcall(action, context)instance methodMiddlewarePipeline.execute(action)runs before_action chain, then action, then after_action:haltto stop the chainAcceptance Criteria
Subtasks
registerandcallDefinition of Done
This issue is complete when:
Implementation Notes
Files Created
lib/aethyr/core/commands/middleware.rb— Middleware base class with priority ordering (default 500), phase designation (:before_action/:after_action),call(action, context)interface (raises NotImplementedError), and class-levelregistermethod.lib/aethyr/core/commands/middleware_pipeline.rb— MiddlewarePipeline executor with Mutex-protected registry, priority-sorted before/after phases,throw(:halt)chain interruption mechanism, andreset!for testing.tests/unit/middleware_pipeline.feature— 19 Cucumber BDD scenarios covering execution order, halt behavior, argument validation, context passing, class-level registration, and edge cases.tests/unit/step_definitions/middleware_pipeline_steps.rb— Step definitions using Test::Unit::Assertions with TestTrackingMiddleware and MockPipelineAction test doubles.Design Decisions
snapshot_middlewareextracts before/after lists under the lock, then execution proceeds without holding the lock.VALID_PHASESis frozen. Priority and phase are set at construction time.# typed: strictwith fullsigannotations.snapshot_middlewareprivate method to keepexecuteunder the Metrics/AbcSize threshold.Quality Gates