plans/2025-09-27-AppConfigRepository_Implementation-v1.md
Create a new AppConfigRepository following the established repository pattern in the codebase, and update all direct AppConfig usage to use the new repository pattern instead of the current AppConfigService implementation.
Create AppConfigRepository trait in forge_services/src/infra.rs
Create AppConfigRepositoryImpl in forge_infra crate
Update forge_infra/src/database/mod.rs
Update ForgeInfra struct
Update ForgeConfigService implementation
Update Services trait integration
Update Authenticator class
Update forge_api implementations
Update UI components
Update authentication service
Create comprehensive unit tests
Create integration tests
Update existing tests
Remove deprecated direct usage
Add documentation
Verify consistency
Breaking Existing Functionality Mitigation: Maintain the AppConfigService interface and gradually migrate internal implementations while preserving public APIs
File System Access Complexity Mitigation: Reuse existing file infrastructure patterns from ForgeConfigService and follow the same error handling approach
Testing Integration Points Mitigation: Create mock implementations for testing and follow the established testing patterns used for ConversationRepository
Async Trait Complexity Mitigation: Follow the exact same async trait patterns used in ConversationRepository and other existing repositories
Direct Migration: Completely replace AppConfigService with repository pattern in one step Trade-offs: Higher risk but simpler final architecture
Adapter Pattern: Create an adapter that wraps the current service Trade-offs: Lower risk but adds an extra abstraction layer
Hybrid Approach: Keep both patterns and gradually deprecate the service Trade-offs: Maintains maximum backward compatibility but increases code complexity