Fix compliance check through compliance profiles returning incorrect result when rule is removed - #1375
Open
klaraf755 wants to merge 22 commits into
Open
Fix compliance check through compliance profiles returning incorrect result when rule is removed#1375klaraf755 wants to merge 22 commits into
klaraf755 wants to merge 22 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes stale compliance results when a rule is removed from a compliance profile by proactively removing “orphaned” rule references from persisted compliance results, preventing removed rules from continuing to influence object compliance.
Changes:
- Update compliance profile rule patching to remove orphaned internal/provider rule UUIDs from stored compliance results when rules are removed from profiles.
- Add native repository update queries to prune removed rule UUIDs from JSON compliance results across affected resource types.
- Extend test coverage to validate compliance results are cleaned up after rule removal.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/java/com/czertainly/core/service/compliance/ComplianceServiceTest.java | Extends compliance checks to include SECRET resources in the test flow. |
| src/test/java/com/czertainly/core/service/compliance/ComplianceProfileServiceV2Test.java | Adds a test ensuring orphaned rules are removed from persisted compliance results after rule removal. |
| src/main/java/com/czertainly/core/service/v2/impl/ComplianceProfileServiceImpl.java | On rule removal, triggers repository cleanup to remove orphaned rule UUIDs from compliance results. |
| src/main/java/com/czertainly/core/dao/repository/SecretRepository.java | Adds native updates to remove internal/provider rule UUIDs from secret.compliance_result. |
| src/main/java/com/czertainly/core/dao/repository/CryptographicKeyItemRepository.java | Adds native updates to remove internal/provider rule UUIDs from cryptographic_key_item.compliance_result. |
| src/main/java/com/czertainly/core/dao/repository/CertificateRequestRepository.java | Adds native updates to remove internal/provider rule UUIDs from certificate_request.compliance_result. |
| src/main/java/com/czertainly/core/dao/repository/CertificateRepository.java | Adds native updates to remove internal/provider rule UUIDs from certificate.compliance_result and adjusts entity graph loading. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
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
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.



Fixes #1365