Skip to content

Conversation

@ritwik-g
Copy link
Contributor

Related Issues

Fixes #4

Changes Made

  • Added new ConfigMetadata class for handling configuration metadata
  • Fixed PathData.get_value() to maintain original behavior of returning None
  • Updated tests to match expected behavior
  • Added ADR for sensitive value storage
  • Updated schema and documentation
  • Updated tasks.md to mark completed items

Testing Done

  • Added unit tests
    • Added tests for ConfigMetadata class
    • Updated tests for PathData class
    • Added tests for Value class with sensitive values
  • Manually tested
  • Updated test documentation

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
  • Refactoring
  • CI/CD
  • Other

Breaking Change

  • No
  • Yes

Additional Information

This PR focuses on refactoring the metadata handling in the codebase by introducing a dedicated ConfigMetadata class and ensuring proper error handling. The changes maintain backward compatibility while improving code organization and maintainability.

- Add ConfigMetadata class for handling configuration metadata
- Fix PathData.get_value() to maintain original behavior of returning None
- Update tests to match expected behavior
- Add ADR for sensitive value storage
- Update schema and documentation
- Mark PathData metadata handling as complete
- Add ConfigMetadata section with completed tasks
- Update testing and documentation sections
- Move required value validation into PathData.validate() loop
- Add environment context to validation error messages
- Add tests for PathData serialization methods
- Mark ADR-005 (Unified Backend Approach) as Accepted
- Mark ADR-007 (Sensitive Value Storage) as Accepted
- Fix ADR-007 number in title
- Update README.md to reflect ADR status changes

This change improves error messages by including environment context
and keeps validation close to the data it validates. PathData now
has 100% test coverage.
- Add debug logs for set_value and get_value methods
- Fix type hint for create_value_fn using Callable from typing
- Format function signature for better readability

The debug logs follow the Helm plugin convention and provide
better observability for value operations. Type hints now
properly specify the function signature for create_value_fn.
@sonarqubecloud
Copy link

- Changed all relative imports (using . and ..) to absolute imports
- Follows Python's official style guide (PEP 8)
- More explicit and readable import paths
- All tests passing
- Add back path validation to ensure value.path matches PathData.path
- Add error logging for path mismatch
- Update docstring to document ValueError
- Improve code organization with proper error handling

This ensures data consistency by preventing values with mismatched
paths from being added to a PathData instance.
- Add back input validation for data type and required keys
- Restore error logging for invalid input
- Add debug logging for value creation
- Add tests for validation and error handling:
  - Test invalid data type
  - Test missing required keys
  - Test value path mismatch

This ensures proper error handling and logging when creating
PathData instances from dictionaries, with full test coverage.
- Update test_validate_path_mismatch to check validation in set_value
- Fix test_from_dict_missing_keys to be order-independent
- Maintain test coverage and error checking
- Follow clean code principles with clear test names and assertions

This ensures tests are robust and won't fail due to implementation
details like set ordering.
- Return Value object instead of resolved string value
- Remove resolve parameter as it's now handled by Value.get()
- Update tests to verify Value object return
- Maintain proper logging

This provides better control over value resolution and access
to Value object features, especially for sensitive values.
@sonarqubecloud
Copy link

@ritwik-g ritwik-g merged commit 034a4d4 into main Feb 16, 2025
9 checks passed
@ritwik-g ritwik-g deleted the 4-metadata-refactor branch February 16, 2025 12:58
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.

Add base classes to represent the yaml structure (without the secrets)

2 participants