Overview
Refactor src/application/command_handlers to reduce code duplication, improve maintainability, enhance testability, and standardize patterns across all command handlers while preserving existing behavior.
Refactoring Plan
See detailed refactoring plan: docs/refactors/plans/command-handlers-refactoring.md
The plan identifies key code quality issues and proposes 7 improvements organized in 3 phases:
- Phase 0: Extract common helpers (failure context builder, state persistence, step result type)
- Phase 1: Standardize error handling with
.help() methods and remove test exposure
- Phase 2: Improve consistency (logging patterns, method ordering)
Target Files
src/application/command_handlers/provision/handler.rs
src/application/command_handlers/configure/handler.rs
src/application/command_handlers/destroy/handler.rs
src/application/command_handlers/create/handler.rs
src/application/command_handlers/test.rs
Implementation Plan
Phase 0: Quick Wins (High Impact, Low Effort)
Phase 1: Structural Improvements (High Impact, Medium Effort)
Phase 2: Consistency & Polish (Medium Impact, Low Effort)
Acceptance Criteria
Quality Checks:
Refactoring Criteria:
Success Metrics
- Lines of code reduced: Target 150-200 lines
- Duplication eliminated: Target 80%+
- Test coverage: Maintain 100% of current coverage
- Build time: No degradation
- All linters pass with no new warnings
Timeline
- Estimated Duration: 2-3 weeks
- Target Completion: Mid-November 2025
Related
Overview
Refactor
src/application/command_handlersto reduce code duplication, improve maintainability, enhance testability, and standardize patterns across all command handlers while preserving existing behavior.Refactoring Plan
See detailed refactoring plan: docs/refactors/plans/command-handlers-refactoring.md
The plan identifies key code quality issues and proposes 7 improvements organized in 3 phases:
.help()methods and remove test exposureTarget Files
src/application/command_handlers/provision/handler.rssrc/application/command_handlers/configure/handler.rssrc/application/command_handlers/destroy/handler.rssrc/application/command_handlers/create/handler.rssrc/application/command_handlers/test.rsImplementation Plan
Phase 0: Quick Wins (High Impact, Low Effort)
Phase 1: Structural Improvements (High Impact, Medium Effort)
Phase 2: Consistency & Polish (Medium Impact, Low Effort)
Acceptance Criteria
Quality Checks:
./scripts/pre-commit.shRefactoring Criteria:
Success Metrics
Timeline
Related