Skip to content

Add CSV metadata minification migration - #2088

Open
joelanford wants to merge 1 commit into
operator-framework:masterfrom
joelanford:csv-metadata-minification
Open

joelanford wants to merge 1 commit into
operator-framework:masterfrom
joelanford:csv-metadata-minification

Conversation

@joelanford

@joelanford joelanford commented Sep 15, 2026

Copy link
Copy Markdown
Member

Summary

Minify CRD and APIService descriptions in olm.csv.metadata by retaining only the fields consumed by OLM's package server:

  • name
  • group, where applicable
  • version
  • kind
  • displayName
  • description

Minification occurs whenever CSVMetadata is marshaled, so newly constructed metadata is always minimized without requiring a separate opt-in migration.

The existing bundle-object-to-csv-metadata migration now also rewrites pre-existing olm.csv.metadata properties. This check occurs before the Image and CsvJSON early exits, allowing already-migrated bundles without CsvJSON to be minimized while leaving their other properties unchanged.

This matches the field filtering performed by OLM's package server:

https://github.com/operator-framework/operator-lifecycle-manager/blob/cf27af72356d95b33c2fcb38dcff4d9ca2e7d475/pkg/package-server/apis/operators/packagemanifest.go#L28-L35

For the Red Hat 4.22 catalog, this reduces the catalog size from 118,396 KiB to 47,200 KiB, approximately 60.1%.

Testing

go test ./alpha/property ./alpha/action/migrations ./alpha/action/...

Summary by CodeRabbit

  • Bug Fixes
    • Improved bundle migration when CSV metadata already exists, preserving the existing metadata while avoiding unnecessary changes.
    • CSV metadata is now minimized during serialization, retaining key identifying and descriptive information while omitting detailed resource, descriptor, deployment, and container data.
    • Improved handling of bundles containing existing CSV metadata without requiring additional CSV data.

@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 15, 2026
@coderabbitai

coderabbitai Bot commented Sep 15, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 0f73a4a8-18ad-4498-a63c-12587bbcaef7

📥 Commits

Reviewing files that changed from the base of the PR and between 7465ba8 and f52a458.

📒 Files selected for processing (4)
  • alpha/action/migrations/000_bundle_object_to_csv_metadata.go
  • alpha/action/migrations/migrations_test.go
  • alpha/property/property.go
  • alpha/property/property_test.go

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

Changes

CSV metadata migration

Layer / File(s) Summary
CSV metadata minification
alpha/property/property.go, alpha/property/property_test.go
CSVMetadata now removes detailed resource and descriptor fields from API service and custom resource definitions during JSON serialization. Tests verify the retained summary fields.
Existing metadata migration
alpha/action/migrations/000_bundle_object_to_csv_metadata.go, alpha/action/migrations/migrations_test.go
The migration now detects and rebuilds existing CSV metadata before returning. Tests verify that owned resource data is removed while the bundle retains its properties.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Suggested reviewers: grokspawn

Merge Risk: ⚪ Minimal · up to f52a4

The metadata minification retains API-service summary fields and no actionable merge-blocking issue was identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 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%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding CSV metadata minification through a migration.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@openshift-ci

openshift-ci Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign kevinrizza for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@codecov

codecov Bot commented Sep 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.65217% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.72%. Comparing base (7465ba8) to head (f52a458).

Files with missing lines Patch % Lines
...on/migrations/000_bundle_object_to_csv_metadata.go 83.33% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2088      +/-   ##
==========================================
+ Coverage   59.55%   59.72%   +0.16%     
==========================================
  Files          99       99              
  Lines        8157     8198      +41     
==========================================
+ Hits         4858     4896      +38     
- Misses       2724     2725       +1     
- Partials      575      577       +2     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@joelanford
joelanford force-pushed the csv-metadata-minification branch from 8fb9ff3 to 2630501 Compare September 15, 2026 13:04
Minify CRD and API service descriptions whenever olm.csv.metadata is marshaled, retaining only identifying and display fields.

Update the bundle object migration to rewrite existing CSV metadata properties before checking image or CsvJSON fields, while leaving other properties unchanged. Add coverage for metadata construction and migration without CsvJSON.
@joelanford
joelanford force-pushed the csv-metadata-minification branch from 2630501 to f52a458 Compare September 15, 2026 20:43
@joelanford
joelanford marked this pull request as ready for review September 15, 2026 20:48
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 15, 2026
@grokspawn

Copy link
Copy Markdown
Contributor

Comments here but I'll reproduce here and start using this as primary coordination to stay in-sync with other reviewers:

I'm reviewing it, but I think I expected the "new minified version" to become the new de facto structure instead of retaining the "bloated original" status.

(and relying on skipUnknownFields serialization capabilities to successfully ingest legacy instances)

and

If you think that we cannot safely adopt the "new reality" of the minified structure ... can we establish a parallel to the migrations (maybe called finalizers) which are represented as mandatory in-order mutations?

I say that because the current migration used to be side-effect-free for existing csv.metadata, but now the flow isn't so clear and really breaks the logic into two seemingly-unrelated chunks/locations.

@grokspawn

Copy link
Copy Markdown
Contributor

From offline conversation:
Complication to establishing a canonical type lies in the re-use of v1alpha1 types from o-f/api in the csv.metadata type. Options include

  1. introducing new types in csv.metadata and dealing with sync/drift issues
  2. dissembling the current flow into helpers to aid composition in both old & new contexts
  3. establishing a "finalizer/normalizer" toolflow to enforce mandatorily formatted output

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.

2 participants