Skip to content

🌱 consolidate Release types with operator-registry#2771

Open
rashmigottipati wants to merge 3 commits into
operator-framework:mainfrom
rashmigottipati:consolidate-release-type
Open

🌱 consolidate Release types with operator-registry#2771
rashmigottipati wants to merge 3 commits into
operator-framework:mainfrom
rashmigottipati:consolidate-release-type

Conversation

@rashmigottipati

Copy link
Copy Markdown
Member

Description

Removes duplicate bundle.Release and bundle.VersionRelease type definitions in favor of using declcfg.Release and declcfg.VersionRelease from operator-registry.

This consolidates type definitions between operator-controller and operator-registry, eliminating code duplication and aligning with the vision from OPRUN-4548.

Changes:

  • Delete internal/operator-controller/bundle/versionrelease.go and the test file
  • Update all internal code to use declcfg.VersionRelease and declcfg.Release from operator-registry
  • API boundary (BundleMetadata.Release) remains *string with conversion at:
    • bundleutil.MetadataFor (declcfg -> API)
    • catalogmetadata/filter.parseInstalledBundleVersionRelease (API -> declcfg)

Reviewer Checklist

  • API Go Documentation
  • Tests: Unit Tests (and E2E Tests, if appropriate)
  • Comprehensive Commit Messages
  • Links to related GitHub Issue(s)

Copilot AI review requested due to automatic review settings June 16, 2026 23:50
@netlify

netlify Bot commented Jun 16, 2026

Copy link
Copy Markdown

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit 74c294c
🔍 Latest deploy log https://app.netlify.com/projects/olmv1/deploys/6a3eae50e78cc90008fc2090
😎 Deploy Preview https://deploy-preview-2771--olmv1.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@openshift-ci

openshift-ci Bot commented Jun 16, 2026

Copy link
Copy Markdown

[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 tmshort 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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR removes operator-controller’s duplicate bundle.Release / bundle.VersionRelease definitions and standardizes on declcfg.Release / declcfg.VersionRelease from operator-registry, keeping the API boundary (BundleMetadata.Release as *string) intact via conversion helpers.

Changes:

  • Replaced internal bundle.VersionRelease usage across resolver, catalogmetadata filtering/comparison, and tests with declcfg.VersionRelease.
  • Moved legacy registry+v1 “release-in-build-metadata” parsing logic into package-local helpers where needed, and updated metadata conversion (bundleutil.MetadataFor) accordingly.
  • Removed the now-redundant internal/operator-controller/bundle/versionrelease.go and its unit tests; updated generated CRD artifacts touched by regeneration.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
manifests/experimental.yaml Updates generated experimental manifests (includes CRD generator version annotation change for ClusterExtension CRD).
manifests/experimental-e2e.yaml Updates generated experimental e2e manifests (includes CRD generator version annotation change for ClusterExtension CRD).
internal/operator-controller/resolve/resolver.go Changes resolver interface to return *declcfg.VersionRelease instead of the internal type.
internal/operator-controller/resolve/catalog.go Propagates declcfg.VersionRelease through catalog resolution return types.
internal/operator-controller/resolve/catalog_test.go Updates resolver unit tests to assert against declcfg.VersionRelease.
internal/operator-controller/controllers/clusterextension_controller_test.go Updates controller tests to use declcfg.VersionRelease in mocked resolver responses.
internal/operator-controller/catalogmetadata/filter/successors.go Converts installed bundle metadata parsing to produce *declcfg.VersionRelease, including legacy registry+v1 parsing helper.
internal/operator-controller/catalogmetadata/filter/successors_test.go Adjusts successor/filter tests to use declcfg.VersionRelease parsing helper.
internal/operator-controller/catalogmetadata/filter/bundle_predicates.go Updates version/release predicate API to take declcfg.VersionRelease and compare via declcfg’s Compare semantics.
internal/operator-controller/catalogmetadata/compare/compare.go Updates bundle version/release comparison to use declcfg.VersionRelease.
internal/operator-controller/bundleutil/bundle.go Updates bundle property parsing and MetadataFor conversion to use declcfg.Release / declcfg.VersionRelease and new legacy parsing/conversion helpers.
internal/operator-controller/bundleutil/bundle_test.go Updates bundleutil tests for declcfg.VersionRelease expectations.
internal/operator-controller/bundle/versionrelease.go Deletes the duplicated internal release/version types and logic.
internal/operator-controller/bundle/versionrelease_test.go Deletes unit tests for the removed internal release/version types.
helm/olmv1/base/operator-controller/crd/experimental/olm.operatorframework.io_clusterextensions.yaml Updates generated Helm base CRD for ClusterExtension (includes generator version annotation change).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/operator-controller/bundleutil/bundle.go Outdated
Comment thread internal/operator-controller/catalogmetadata/filter/successors.go Outdated
Comment thread manifests/experimental.yaml Outdated
Comment thread manifests/experimental-e2e.yaml Outdated
@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.31%. Comparing base (cf0266c) to head (74c294c).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2771      +/-   ##
==========================================
- Coverage   70.42%   70.31%   -0.12%     
==========================================
  Files         143      142       -1     
  Lines       10625    10577      -48     
==========================================
- Hits         7483     7437      -46     
+ Misses       2580     2579       -1     
+ Partials      562      561       -1     
Flag Coverage Δ
e2e 35.14% <60.46%> (+<0.01%) ⬆️
experimental-e2e 52.59% <39.53%> (+0.30%) ⬆️
unit 59.32% <100.00%> (-0.19%) ⬇️

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

☔ 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.

@rashmigottipati rashmigottipati force-pushed the consolidate-release-type branch 2 times, most recently from 2865724 to ccc8f3b Compare June 17, 2026 13:21
Copilot AI review requested due to automatic review settings June 17, 2026 13:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Comment thread internal/operator-controller/catalogmetadata/filter/successors.go Outdated

@tmshort tmshort left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Most of this is changing the namespace of an API, but there is some de-duplication that could be done.

Comment thread internal/operator-controller/bundleutil/bundle.go Outdated
Comment thread internal/operator-controller/catalogmetadata/compare/compare.go
Comment thread internal/operator-controller/catalogmetadata/filter/successors.go Outdated
Comment thread internal/operator-controller/bundleutil/bundle.go Outdated
Comment thread internal/operator-controller/catalogmetadata/filter/successors.go Outdated
@openshift-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 24, 2026
Copilot AI review requested due to automatic review settings June 24, 2026 03:28
@rashmigottipati rashmigottipati force-pushed the consolidate-release-type branch from ac0cad4 to e0fe939 Compare June 24, 2026 03:28
@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 24, 2026
@rashmigottipati rashmigottipati force-pushed the consolidate-release-type branch from e0fe939 to da8ab9c Compare June 24, 2026 03:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Comment thread internal/operator-controller/bundleutil/bundle.go
@rashmigottipati rashmigottipati force-pushed the consolidate-release-type branch from da8ab9c to 21e1ef3 Compare June 24, 2026 03:34
Copilot AI review requested due to automatic review settings June 24, 2026 03:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Comment thread internal/operator-controller/bundleutil/bundle.go
Comment thread internal/operator-controller/bundleutil/bundle.go
Copilot AI review requested due to automatic review settings June 24, 2026 09:00
@perdasilva perdasilva force-pushed the consolidate-release-type branch from 518364a to 21e1ef3 Compare June 24, 2026 09:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated no new comments.

@perdasilva perdasilva left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review: Consolidate Release types with operator-registry

4 inline comments posted + 3 additional findings below.


Double JSON unmarshal in parseVersionRelease (bundleutil/bundle.go:66-76)

pkgData is unmarshalled twice: once into property.Package (line 66) and again into a helper struct (line 76) just to detect Release *string presence. Only pkg.Version is actually used from property.Package. A single struct struct{ Version string \json:"version"`; Release *string `json:"release"` }` would serve both purposes in one unmarshal pass.

SuccessorsOf double-parses installed bundle version (successors.go:57-75)

parseInstalledBundleVersionRelease (line 57) parses installedBundle.Version into a bsemver.Version, then legacySuccessor (line 75) parses the exact same string again via bsemver.Parse. The already-parsed version could be passed to legacySuccessor instead.

33 comparison test cases deleted without equivalent upstream coverage

The deleted bundle/versionrelease_test.go contained TestRelease_Compare (17 cases) and TestVersionRelease_Compare (16 cases). operator-registry v1.72.0's versionrelease_test.go has zero dedicated Compare tests — only a single equality assertion inside a round-trip test. ParseLegacyVersionRelease also has no direct unit tests (only indirect coverage through GetVersionAndRelease). Consider either adding comparison tests upstream or keeping a subset here.

Comment thread internal/operator-controller/bundleutil/bundle.go
Comment thread internal/operator-controller/catalogmetadata/filter/successors.go Outdated
}

var release bundle.Release
var release declcfg.Release

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This block (lines 33-51) is a semantic duplicate of parseExplicitRelease in bundleutil/bundle.go (lines 99-120): both parse version, branch on empty-vs-nonempty release, construct VersionRelease.

Consider exporting parseExplicitRelease as ParseExplicitRelease and calling it from here to avoid drift if either copy changes.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done - exported parseExplicitRelease as ParseExplicitRelease and called it from parseInstalledBundleVersionRelease to eliminate the duplication. Fixed in latest commit

Build: vr.Version.Build,
}
if len(vr.Release) > 0 {
v.Build = make([]string, len(vr.Release))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: This manual loop duplicates the slicesutil.Map pattern already used in compare/compare.go:35 for the identical PRVersionstring conversion. The old deleted code also used slicesutil.Map here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

fixed - replaced the manual loop with slicesutil.Map. addressed in latest commit.

Signed-off-by: Rashmi Gottipati <rgottipa@redhat.com>
Signed-off-by: Rashmi Gottipati <rgottipa@redhat.com>
- Export parseExplicitRelease as ParseExplicitRelease and use it from
  parseInstalledBundleVersionRelease to deduplicate logic
- Replace manual loop with slicesutil.Map in asLegacyRegistryV1Version
- Update test error message expectation

Signed-off-by: Rashmi Gottipati <rgottipa@redhat.com>
@rashmigottipati rashmigottipati force-pushed the consolidate-release-type branch from 21e1ef3 to 74c294c Compare June 26, 2026 16:52
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.

6 participants