Skip to content

Rename Application Commands to Command Handlers - #27

Merged
josecelano merged 3 commits into
mainfrom
copilot/rename-app-commands
Oct 22, 2025
Merged

josecelano merged 3 commits into
mainfrom
copilot/rename-app-commands

Conversation

Copilot AI commented Oct 22, 2025 •

Copy link
Copy Markdown
Contributor

Overview

This PR refactors the terminology in the Application Layer to distinguish between UI commands (future Clap subcommands) and Application Layer command handlers (DDD business logic). This establishes clear separation as we introduce UI-level commands in the parent epic (#10 - UI Layer Destroy Command).

Problem Statement

Currently, both concepts are called "commands" which creates ambiguity:

  • UI Commands: Clap subcommands that handle user input (e.g., destroy, provision)
  • Command Handlers: DDD Application Layer components that orchestrate business logic

As we introduce Clap subcommands to the CLI, we need clear terminology to avoid confusion between the user-facing interface and the internal business logic layer.

Changes

Directory Structure

  • Renamed src/application/commands/ → src/application/command_handlers/

Core Components Renamed

// Before
pub struct DestroyCommand { ... }
pub enum DestroyCommandError { ... }

// After
pub struct DestroyCommandHandler { ... }
pub enum DestroyCommandHandlerError { ... }

All four command handlers were renamed consistently:

  • DestroyCommand → DestroyCommandHandler
  • ProvisionCommand → ProvisionCommandHandler
  • ConfigureCommand → ConfigureCommandHandler
  • TestCommand → TestCommandHandler

Comprehensive Updates

  • Updated all module exports and imports across the codebase
  • Updated all test builders (*TestBuilder → *HandlerTestBuilder)
  • Updated all documentation, comments, and rustdoc
  • Updated E2E test files and binary files
  • Applied consistent code formatting

Verification

All quality checks pass:

  • ✅ 829 unit tests passing
  • ✅ All linters (clippy, rustfmt) passing
  • ✅ All builds successful
  • ✅ Zero references to old naming remain

Impact

No functional changes - this is purely a naming refactoring to improve code clarity and prepare for future UI layer implementation.

Rationale

This change follows Domain-Driven Design naming conventions where:

  • Command: Represents the intent/message (future Clap subcommands)
  • Command Handler: Processes the command and executes business logic (current Application Layer)

This clear distinction will enable clean implementation of the UI layer in subsequent issues (#23 and beyond) while maintaining well-organized, maintainable code.

Related Issues

Original prompt

This section details on the original issue you should resolve

<issue_title>Rename App Commands to Command Handlers</issue_title>
<issue_description># Rename App Commands to Command Handlers

Type: Task
Priority: High
Parent Epic: #10 - UI Layer Destroy Command
Estimated Effort: 2-3 hours


📋 Issue Overview

Refactor terminology to distinguish between UI commands (Clap) and Application Layer commands (DDD). This provides clear separation as we introduce UI-level commands.

🎯 Problem Statement

As we introduce UI-level commands (Clap subcommands), we need clear terminology to avoid confusion:

  • UI Command: Clap subcommand (e.g., destroy, provision)
  • Command Handler: DDD Application Layer command (e.g., DestroyCommand, ProvisionCommand)

Currently, both concepts are called "commands" which creates ambiguity.

🎯 Goals

Establish clear naming conventions that distinguish between:

  • UI Layer: Clap subcommands that handle user input
  • Application Layer: DDD command handlers that orchestrate business logic

📦 Scope

Files to Update

  • Rename structs/modules in src/application/commands/ for clarity
  • Update documentation to use "command handler" terminology
  • Ensure consistent naming across the codebase

Expected Renaming Pattern

// BEFORE (Current)
pub struct DestroyCommand { /* ... */ }
pub struct ProvisionCommand { /* ... */ }

// AFTER (Proposed) - Choose one approach:

// Option A: Add Handler suffix
pub struct DestroyCommandHandler { /* ... */ }
pub struct ProvisionCommandHandler { /* ... */ }

// Option B: Use Handler prefix
pub struct DestroyHandler { /* ... */ }
pub struct ProvisionHandler { /* ... */ }

Documentation Updates

Update all references in:

  • Code comments
  • Module documentation
  • Architecture documentation
  • Contributing guidelines

✅ Acceptance Criteria

  • Command handlers renamed consistently across the codebase
  • Documentation updated with new "command handler" terminology
  • No breaking changes to functionality
  • All tests pass after refactoring
  • Code follows project conventions
  • Clear distinction between UI commands (Clap) and command handlers (DDD)
  • Module exports updated to reflect new naming
  • Import statements updated throughout the codebase

Testing Requirements

  • All existing unit tests pass
  • All existing integration tests pass
  • All E2E tests pass
  • No functionality changes, only naming

🔍 Implementation Strategy

  1. Choose naming convention (Handler suffix vs Handler prefix)
  2. Update struct definitions in src/application/commands/
  3. Update module exports in mod.rs files
  4. Update imports throughout the codebase
  5. Update documentation and code comments
  6. Run full test suite to verify no breakage

🔗 Related Issues

📚 Related Documentation


Full specification: See docs/issues/rename-app-commands-to-command-handlers.md</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #22


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits October 22, 2025 15:11
- Renamed directory from `commands` to `command_handlers`
- Renamed all command structs: DestroyCommand -> DestroyCommandHandler, etc.
- Renamed all error types: DestroyCommandError -> DestroyCommandHandlerError, etc.
- Updated all imports throughout the codebase
- Updated all comments and documentation references
- All tests and builds passing

Co-authored-by: josecelano <[email protected]>
- Fixed all remaining comment references
- Applied code formatting with cargo fmt
- All linters passing

Co-authored-by: josecelano <[email protected]>
Copilot AI changed the title [WIP] Rename app commands to command handlers Rename Application Commands to Command Handlers Oct 22, 2025
Copilot AI requested a review from josecelano October 22, 2025 15:24
@josecelano
josecelano marked this pull request as ready for review October 22, 2025 16:17
@josecelano

Copy link
Copy Markdown
Member

ACK 369ee07

@josecelano
josecelano merged commit 069efc4 into main Oct 22, 2025
@josecelano
josecelano deleted the copilot/rename-app-commands branch April 15, 2026 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rename App Commands to Command Handlers

2 participants