Repository navigation
Description
User Output Architecture Improvements
Issue: #102
Parent Epic: N/A (Standalone refactoring epic)
Roadmap: N/A (Code quality improvement)
Related: Refactoring Plan
Overview
This Epic refactors the UserOutput module (src/presentation/user_output.rs) to improve clarity, testability, maintainability, and sustainability. The current implementation mixes concerns (formatting, routing, verbosity control) and lacks extensibility for different output styles and destinations.
Refactoring Plan
See comprehensive refactoring plan: docs/refactors/plans/user-output-architecture-improvements.md
See detailed epic specification: docs/issues/102-epic-user-output-architecture-improvements.md
Goals
- Separate Concerns: Extract verbosity filtering, theme configuration, and formatting logic
- Simplify Testing: Improve test infrastructure and reduce duplication
- Enable Extensibility: Support different output styles (emoji, plain text, JSON) and destinations
- Improve Maintainability: Reduce code duplication and establish clear abstractions
- Maintain Quality: All refactorings must pass pre-commit checks and maintain test coverage
Proposals Summary
Phase 0: Quick Wins (High Impact, Low Effort)
- Proposal 0: Extract Verbosity Filtering Logic ✅
- Proposal 1: Simplify Test Infrastructure ✅
- Proposal 2: Add Theme/Configuration Support ✅
Phase 1: Strategic Improvements (High Impact, Medium Effort)
- Proposal 3: Use Message Trait for Extensibility ✅
- Proposal 5: Parameterized Test Cases ✅
Phase 2: Polish & Extensions (Medium Impact, Low-Medium Effort)
- Proposal 4: Add Alternative Formatters (optional enhancement) ✅
- Proposal 6: Type-Safe Channel Routing ⏳
- Proposal 7: Add Buffering Control
- Proposal 8: Builder Pattern for Complex Messages
- Proposal 9: Output Sink Abstraction
Key Architectural Decision
Trait-Based Message System: Each message type (ProgressMessage, SuccessMessage, etc.) implements the OutputMessage trait with its own formatting, verbosity requirements, and channel routing. This achieves true Open/Closed Principle - new message types can be added without modifying existing code.
Alternative Considered: Enum-based messages with centralized formatter. Discarded because pattern matching on enum variants requires modifying the formatter for each new message type, violating the Open/Closed Principle.
Implementation Strategy
Incremental Approach: Create subissues for each proposal as work progresses. This allows adapting the implementation to the current codebase state and adjusting for any discoveries made during implementation.
Sub-Tasks
Phase 0: Quick Wins
- Extract Verbosity Filtering Logic #103 - Proposal 0: Extract Verbosity Filtering Logic
- Simplify Test Infrastructure for UserOutput #123 - Proposal 1: Simplify Test Infrastructure
- Add Theme/Configuration Support for UserOutput #124 - Proposal 2: Add Theme/Configuration Support
Phase 1: Strategic Improvements
- Use Message Trait for Extensibility #127 - Proposal 3: Use Message Trait for Extensibility
- Parameterized Test Cases for User Output #128 - Proposal 5: Parameterized Test Cases
Phase 2: Polish & Extensions
- Add Formatter Override Support for Alternative Output Formats #133 - Proposal 4: Add Formatter Override Support
- Type-Safe Channel Routing for User Output #135 - Proposal 6: Type-Safe Channel Routing
Other Related Work
- Centralize UserOutput via Dependency Injection #107 - Centralize UserOutput via Dependency Injection
- Refactor user_output.rs Module to Folder Structure #149 - Refactor user_output.rs Module to Folder Structure
Future Subissues
Additional subissues for Phase 2 proposals (7, 8, 9) will be created as work progresses.
Progress
Completed: 6 out of 8 subissues (75%)
Remaining: 2 subissues (#135 - Type-Safe Channel Routing, #149 - Module Folder Structure)
Timeline
- Estimated Duration: 3-4 weeks (with parallel development possible)
- Target Completion: End of November 2025
Related Documentation
- Development Principles - Core principles including testability and maintainability
- Contributing Guidelines - General contribution process
- Module Organization - Code organization conventions
- Testing Conventions - Testing best practices
Activity
[-]User Output Architecture Improvements[/-][+][EPIC] User Output Architecture Improvements[/+]docs: add issue specifications for user output refactoring
chore: remove closed issue documentation files
Merge #111: Extract verbosity filtering logic into dedicated Verbosit…
docs: add Phase 0 issue specifications for user output refactoring
Merge #125: Centralize test infrastructure for UserOutput to eliminat…
Merge #126: Add Theme/Configuration Support for UserOutput
12 remaining items
josecelano commentedon Nov 4, 2025
Phase 2 Sub-Issues Created
Created three new sub-issues for the remaining Phase 2 proposals:
All proposals from the refactoring plan are now tracked as GitHub issues. Phase 0 and Phase 1 have been completed. Phase 2 work can now begin.
Status Update:
See updated tracking in docs/issues/102-epic-user-output-architecture-improvements.md
docs: add specifications for Phase 2 proposals and mark #135 complete
Merge #141: Add flush() method to UserOutput for explicit buffering c…
Merge #142: Add builder pattern for StepsMessage and InfoBlockMessage
Merge #143: Add OutputSink abstraction for multi-destination output
docs: [#149] update test organization to co-locate unit tests with code
Merge #151: Refactor user_output.rs into folder module structure
josecelano commentedon Nov 6, 2025
All subissues are complete.
chore: remove closed issue documentation files
docs: mark completed tasks in roadmap