Skip to content

ROX-31229: add Profile type column to compliance CSV report#19945

Draft
guzalv wants to merge 1 commit intomasterfrom
gualvare/ROX-31229-csv-report-profile-type
Draft

ROX-31229: add Profile type column to compliance CSV report#19945
guzalv wants to merge 1 commit intomasterfrom
gualvare/ROX-31229-csv-report-profile-type

Conversation

@guzalv
Copy link
Copy Markdown
Contributor

@guzalv guzalv commented Apr 10, 2026

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 OperatorKind enum 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

  • the change is production ready: the change is GA, or otherwise the functionality is gated by a feature flag
  • CI results are inspected

Automated testing

  • modified existing tests

How I validated my change

  • Built image, deployed to a live cluster with CO installed
  • Created scan config mixing a regular profile (ocp4-cis) and a tailored profile (tp-all-clusters-exact-copies)
  • Generated a CSV report via the download API and verified:
    • New "Profile type" column appears at position 4 (after "Profile(version)")
    • 93 rows show "Profile", 3 rows show "Tailored Profile"
    • All other columns unchanged

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".
@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Apr 10, 2026

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 10, 2026

Codecov Report

❌ Patch coverage is 88.88889% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 49.56%. Comparing base (38c2fdc) to head (8660e40).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
...or/v2/report/manager/results/results_aggregator.go 88.23% 2 Missing ⚠️
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     
Flag Coverage Δ
go-unit-tests 49.56% <88.88%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 10, 2026

🚀 Build Images Ready

Images are ready for commit 8660e40. To use with deploy scripts:

export MAIN_IMAGE_TAG=4.11.x-622-g8660e40fdd

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 10, 2026

📝 Walkthrough

Summary by CodeRabbit

Release Notes

  • New Features
    • Enhanced compliance reports with a new "Profile Type" column that identifies whether each compliance profile is a standard profile or a tailored profile. This addition provides clearer distinction between profile types for improved compliance tracking and analysis.

Walkthrough

This pull request extends the compliance report data model by adding a ProfileType field that captures the profile's operator kind ("Profile" or "Tailored Profile") derived from profile metadata, and includes this field in CSV exports.

Changes

Cohort / File(s) Summary
Data Model
central/complianceoperator/v2/report/result.go
Added ProfileType string field to ResultRow struct.
Results Aggregation
central/complianceoperator/v2/report/manager/results/results_aggregator.go, results_aggregator_test.go
Implemented operatorKindToHumanReadable helper to map profile OperatorKind to human-readable profile type strings; AggregateResults now populates row.ProfileType from profile data, returning DATA_NOT_AVAILABLE when profiles are absent.
CSV Formatting
central/complianceoperator/v2/report/manager/format/formatter.go, formatter_test.go
Added Profile type column header to CSV report schema; generateRecord populates the new column from row.ProfileType.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'ROX-31229: add Profile type column to compliance CSV report' clearly and concisely summarizes the main change: adding a new Profile type column to the CSV report.
Description check ✅ Passed The PR description provides a detailed explanation of the change, includes testing validation on a live cluster, and follows the repository template with completed sections for testing quality and validation approach.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch gualvare/ROX-31229-csv-report-profile-type

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 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 to newCSVWriter and 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

📥 Commits

Reviewing files that changed from the base of the PR and between 2948960 and 8660e40.

📒 Files selected for processing (5)
  • central/complianceoperator/v2/report/manager/format/formatter.go
  • central/complianceoperator/v2/report/manager/format/formatter_test.go
  • central/complianceoperator/v2/report/manager/results/results_aggregator.go
  • central/complianceoperator/v2/report/manager/results/results_aggregator_test.go
  • central/complianceoperator/v2/report/result.go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant