-
Notifications
You must be signed in to change notification settings - Fork 4
refactor: implement interface-oriented architecture (IOA) for maintainability and tests #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit introduces the foundation for a full Interface-Oriented Architecture (IOA) using a hexagonal/ports & adapters pattern. It establishes a clear separation between domain logic and infrastructure concerns through well-defined interfaces. Key additions: - Domain models: Added User, SSH, Firewall, and DNS models - Domain services: Created service interfaces with pure business logic - Port definitions: Defined repository interfaces for infrastructure needs - Adapters: Implemented adapters for file system, command execution, etc. - Application services: Added orchestration layer for use cases - Infrastructure: Service factory for dependency injection The architecture is designed as vertical slices: - Completed User Management vertical slice - Added SSH configuration vertical slice - Added Firewall configuration vertical slice - Added DNS configuration vertical slice This is the first phase in a gradual migration strategy, with feature toggles for incremental adoption. The new architecture improves testability, maintainability, and flexibility while enabling easier extension to new features in the future. Benefits: - Clean domain model without infrastructure dependencies - Proper dependency inversion (dependencies point inward) - Enhanced testability through interface-based design - Component isolation for better maintainability - Flexible implementation swapping without domain changes
This commit refactors the menu system to leverage the Interface-Oriented Architecture pattern. Rather than directly calling package functions, menus now operate through the application service layer. Key changes: - Create object-oriented MainMenu and UserMenu classes - Implement MenuManager in application layer for menu operations - Add menu factory for dependency injection - Maintain the same UI experience with improved architectural underpinnings This change enables a gradual transition from the current functional style to a more maintainable and testable object-oriented approach while preserving the user experience. Each submenu can now be refactored incrementally while the system remains fully operational. Part of the ongoing effort to implement a full hexagonal architecture.
This commit continues the migration to Interface-Oriented Architecture (IOA) by implementing several key menu components and the package management functionality: - Create object-oriented menu classes for Firewall, DNS, Linux and Python packages - Implement domain model and service interface for package management - Add OSPackageRepository to handle OS-specific package operations - Update ServiceFactory and MenuFactory to wire dependencies properly - Extend MenuManager with package management functionality - Update main menu to use the new menu classes This change maintains the same UI experience while providing a more maintainable and testable architecture with clear separation of concerns. The new architecture can be enabled with the --use-new-arch flag, allowing for incremental adoption. Part of the ongoing effort to implement a full hexagonal architecture.
Add comprehensive unit tests for all domain service implementations: - BackupService: Test file operations, cleanup, config management - UserService: Test user creation, SSH key management, sudo configuration - SSHService: Test SSH configuration across different OS types - PackageService: Test package installation and repository management - LogsService: Test log retrieval and configuration - FirewallService: Test rule management, profile handling, state management - EnvironmentService: Test sudo preservation settings - DNSService: Test nameserver configuration Each test file implements thorough test coverage using mock repositories to isolate service logic and verify correct behavior for success paths, error handling, and edge cases.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit refactors
hardnfrom a procedural codebase to a modern, interface-oriented architecture while improving maintainability, testability, and extensibility.This refactoring ensures sustainable long-term maintenance and simplifies future feature development.