ROX-31229: add Profile type column to compliance CSV report#19945
ROX-31229: add Profile type column to compliance CSV report#19945
Conversation
Add a new column after "Profile(version)" that shows whether the profile is a regular "Profile" or a "Tailored Profile". The value is derived from the profile's OperatorKind enum stored in the database. UNSPECIFIED kind (should not occur in practice) renders as "Data Not Available" rather than defaulting to "Profile".
|
Skipping CI for Draft Pull Request. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #19945 +/- ##
==========================================
- Coverage 49.56% 49.56% -0.01%
==========================================
Files 2764 2764
Lines 208351 208369 +18
==========================================
+ Hits 103269 103270 +1
- Misses 97430 97445 +15
- Partials 7652 7654 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🚀 Build Images ReadyImages are ready for commit 8660e40. To use with deploy scripts: export MAIN_IMAGE_TAG=4.11.x-622-g8660e40fdd |
📝 WalkthroughSummary by CodeRabbitRelease Notes
WalkthroughThis pull request extends the compliance report data model by adding a Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
central/complianceoperator/v2/report/manager/format/formatter_test.go (1)
146-146: Add an explicit assertion for CSV header order.These fixture updates cover row content, but they still won’t fail if
"Profile type"shifts to the wrong position in the header. Consider capturing the header passed tonewCSVWriterand asserting index/order in at least one test case.As per coding guidelines, "Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity."
Also applies to: 318-328
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@central/complianceoperator/v2/report/manager/format/formatter_test.go` at line 146, Add an explicit assertion that the CSV header order includes "Profile type" at the expected position by capturing the header passed into newCSVWriter in the formatter_test.go tests; modify the test(s) that call newCSVWriter (or the helper that constructs it) to expose or return the header slice and assert the index/order of "Profile type" (e.g., using strings or slice index) alongside existing row content assertions so the test fails if the header column order changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@central/complianceoperator/v2/report/manager/format/formatter_test.go`:
- Line 146: Add an explicit assertion that the CSV header order includes
"Profile type" at the expected position by capturing the header passed into
newCSVWriter in the formatter_test.go tests; modify the test(s) that call
newCSVWriter (or the helper that constructs it) to expose or return the header
slice and assert the index/order of "Profile type" (e.g., using strings or slice
index) alongside existing row content assertions so the test fails if the header
column order changes.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Central YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro
Run ID: b54b4042-fa58-4d2f-98bf-50a3454a93ad
📒 Files selected for processing (5)
central/complianceoperator/v2/report/manager/format/formatter.gocentral/complianceoperator/v2/report/manager/format/formatter_test.gocentral/complianceoperator/v2/report/manager/results/results_aggregator.gocentral/complianceoperator/v2/report/manager/results/results_aggregator_test.gocentral/complianceoperator/v2/report/result.go
Description
Add a "Profile type" column to the compliance scan CSV report, placed after the existing "Profile(version)" column. The column shows whether each check result comes from a regular "Profile" or a "Tailored Profile", derived from the profile's
OperatorKindenum in the database.PROFILE→ "Profile"TAILORED_PROFILE→ "Tailored Profile"OPERATOR_KIND_UNSPECIFIED→ "Data Not Available" (should not occur in practice)User-facing documentation
Testing and quality
Automated testing
How I validated my change
ocp4-cis) and a tailored profile (tp-all-clusters-exact-copies)