Skip to content

Conversation

@ritwik-g
Copy link
Contributor

Related Issues

No direct issues, part of the CLI command system implementation.

Changes Made

  1. Command Registry Implementation:

    • Added CommandRegistry class for managing commands
    • Implemented command registration and lookup functionality
    • Added support for dynamic command discovery
  2. Init Command Implementation:

    • Created InitCommand class for initializing new configurations
    • Added release name validation
    • Added configuration file creation with proper schema
    • Added lock file handling for thread safety
  3. CLI Integration:

    • Integrated command registry with CLI
    • Added init command to CLI interface
    • Added proper error handling and user feedback

Testing Done

  • Added unit tests
    • Added test_init_command.py for testing InitCommand
    • Added tests for configuration file creation
    • Added tests for release name validation
  • Added integration tests
    • Added end-to-end tests for init command
    • Verified command registration and execution
  • Manually tested
    • Verified init command creates proper configuration
    • Verified lock file handling
  • Updated test documentation
    • Updated tasks.md to mark command registry and init command as complete

Checklist

  • I have read the CONTRIBUTING guidelines
  • My code follows the project's style guidelines
  • I have added tests that prove my fix/feature works
  • I have updated the documentation accordingly
  • All new and existing tests passed
  • My commits follow the project's commit message convention

Type of Change

  • Feature
  • Bug Fix
  • Documentation
  • Performance Improvement
  • Code Style Update
  • Refactoring
  • CI/CD
  • Other

Breaking Change

  • No
  • Yes

Additional Information

This PR implements the command registry system and the first command (init) for the helm-values-manager plugin. The command registry provides a flexible foundation for adding more commands, while the init command gives users the ability to create new helm-values configurations.

1. Removed config_file option from init command
2. Converted test_base_command.py from class-based to function-based tests
3. Renamed TestCommand to DummyCommand in test_registry.py to avoid warnings
4. Updated test assertions to match new command output
1. Move command registry initialization into init function to fix test interference
2. Use tmp_path for better test isolation
3. Add proper validation for release name
4. Improve error handling and logging
5. Update tests to verify file creation and content
6. Update tasks.md to mark completed tasks
7. Fix linting issues:
   - Remove trailing whitespace
   - Fix docstring formatting
   - Remove unused imports

This change improves test reliability by:
- Moving command registration into init function to avoid test interference
- Using tmp_path for proper test isolation
- Adding better assertions for file operations
- Improving error handling and logging
1. Use Optional[HelmValuesConfig] for better type safety
2. Rename local config variable to new_config to avoid shadowing
3. Add missing typing import

This change improves code quality by:
- Using proper type hints for better IDE support
- Avoiding variable shadowing for better readability
- Following Python type hinting best practices
1. Remove command registry implementation
2. Update CLI to use direct command instantiation
3. Add ADR-008 documenting the decision
4. Update ADR index

This change simplifies our code by removing unnecessary abstraction.
See ADR-008 for detailed rationale.
1. Add test for empty release name error
2. Add test for already initialized error
3. Achieve 100% coverage for CLI error handling

This ensures all error paths are properly tested and
maintains our high test coverage standards.
@sonarqubecloud
Copy link

@ritwik-g ritwik-g merged commit c7a8dfd into main Feb 26, 2025
9 checks passed
@ritwik-g ritwik-g deleted the feature/command-registration branch February 26, 2025 18:26
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.

2 participants