generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 10
[WIP] Refactor data model #149
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
Open
bluesentinelsec
wants to merge
13
commits into
develop
Choose a base branch
from
refactor_data_model
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
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
- Create ArtifactType enum with REPOSITORY, CONTAINER, BINARY, ARCHIVE values
- Support string-to-enum conversion: ArtifactType("repository")
- Validate invalid inputs with ValueError (empty strings, invalid values)
- Add comprehensive test coverage with TDD approach
- Use C-style explicit error handling in tests for clarity
- Foundation for ScanConfig data model and strangler fig pattern
Files:
- entrypoint/entrypoint/data_model.py: Core ArtifactType enum
- entrypoint/tests/test_data_model.py: 7 tests covering all cases
- Add ArtifactType enum with REPOSITORY, CONTAINER, BINARY, ARCHIVE - Add ScanConfig class with from_args() conversion method - Replace string-based artifact type comparisons with type-safe enums - Integrate ScanConfig into orchestrator without breaking existing functionality - Add comprehensive test coverage (17 tests) following TDD approach Benefits: - Type safety prevents string comparison errors - IDE autocomplete and refactoring support - Foundation for further data model improvements - Zero breaking changes to existing functionality Strangler fig pattern successfully proven - old and new code coexist safely.
- Replace container platform check string comparison with enum comparison - Change `args.artifact_type == "container"` to `config.artifact_type == ArtifactType.CONTAINER` - Add comprehensive test coverage for enum comparisons and value access - Completes strangler fig migration of artifact type logic to type-safe enums This final change eliminates the last remaining string-based artifact type comparison in the container platform validation logic, completing the migration to type-safe enum comparisons throughout the orchestrator.
- Add sbomgen_version, timeout, platform, scanners, skip_scanners, skip_files fields - Implement parse_comma_list() helper for robust comma-separated string parsing - Add string-to-int conversion for timeout field - Add comprehensive test coverage for all new fields and helper function - ScanConfig now provides complete replacement for scanning-related args Features: - Type-safe field access with proper data conversion - Robust comma parsing with whitespace handling and empty string validation - 35 comprehensive tests ensuring reliability - Clean, readable code without syntactic sugar - Foundation ready for replacing args object usage in orchestrator This completes the core scanning configuration data model, enabling the next phase of strangler fig migration to extract services.
- Add VulnScanOutput class with structured vulnerability scan results - Include core scan fields: scan_success, return_code, scan_results_file_path - Add performance/timing data: scan_time, results_file_size - Include vulnerability counts by severity: critical, high, medium, low, other - Add structured error handling with error_message field
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.
No description provided.