Skip to content

✨ Support explicit pkg.Release field with build metadata fallback for bundle comparison#2543

Open
rashmigottipati wants to merge 9 commits intooperator-framework:mainfrom
rashmigottipati:oprun-4277-implementation
Open

✨ Support explicit pkg.Release field with build metadata fallback for bundle comparison#2543
rashmigottipati wants to merge 9 commits intooperator-framework:mainfrom
rashmigottipati:oprun-4277-implementation

Conversation

@rashmigottipati
Copy link
Copy Markdown
Member

@rashmigottipati rashmigottipati commented Mar 6, 2026

Description

Summary

Adds support for the explicit pkg.Release field in bundle metadata, enabling proper semantic versioning with release
information. When the BundleReleaseSupport feature gate is enabled, the comparison and sorting logic reads release information from the dedicated pkg.Release field (when present) instead of only using semver build metadata.

Key design decision: Re-releases require explicit channel entries (replaces/skips/skipRange) to be valid successors. The channel graph remains the sole authority on upgrade paths for registry+v1 bundles.

Changes

  • Added BundleReleaseSupport feature gate (alpha, disabled by default)
  • Feature-gated parsing: reads explicit pkg.Release when enabled, falls back to build metadata when disabled
  • Build metadata is preserved when using explicit pkg.Release (serves its proper semver purpose)
  • Updated ByVersionAndRelease(): uses Bundle.Compare() with build metadata fallback when enabled
  • Re-releases must have explicit channel entries to be valid successors (no automatic bypass)
  • Comprehensive test coverage with feature gate detection for both enabled/disabled paths

Feature Gate Behavior

Disabled (standard):

  • Backward compatible - build metadata only
  • Ignores explicit pkg.Release field
  • Comparison/sorting uses legacy build metadata parsing

Enabled (experimental):

  • Reads explicit pkg.Release field when present, falls back to build metadata
  • Build metadata is preserved in version string
  • Comparison/sorting uses Bundle.Compare() with fallback
  • Supports both new bundle formats (with explicit release) and registry+v1 bundles (build metadata)
  • Important: Does NOT bypass channel graph - re-releases require explicit channel entries

Reviewer Checklist

  • API Go Documentation
  • Tests: Unit Tests
  • Comprehensive Commit Messages
  • Links to related GitHub Issue(s)

Link to Github Issue: #2495
Epic: #2479

Copilot AI review requested due to automatic review settings March 6, 2026 16:37
@openshift-ci openshift-ci bot requested review from joelanford and perdasilva March 6, 2026 16:37
@netlify
Copy link
Copy Markdown

netlify bot commented Mar 6, 2026

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit 8d6dda3
🔍 Latest deploy log https://app.netlify.com/projects/olmv1/deploys/69d6af65fe48be00077bbe36
😎 Deploy Preview https://deploy-preview-2543--olmv1.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Mar 6, 2026

[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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 introduces an alpha feature gate to allow OLMv1 upgrade resolution to treat “re-released” bundles (same semver, higher release/build value like 2.0.0+1 -> 2.0.0+2) as valid successors when explicitly enabled.

Changes:

  • Added ReleaseVersionPriority feature gate (Alpha, default disabled).
  • Added SameVersionHigherRelease() predicate and integrated it into SuccessorsOf() behind the feature gate.
  • Added unit tests for SameVersionHigherRelease() and for SuccessorsOf() with the gate disabled.

Reviewed changes

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

Show a summary per file
File Description
internal/operator-controller/features/features.go Defines the new ReleaseVersionPriority feature gate and its spec.
internal/operator-controller/catalogmetadata/filter/successors.go Conditionally expands successor matching to include same-version/higher-release bundles when gated on.
internal/operator-controller/catalogmetadata/filter/bundle_predicates.go Adds the SameVersionHigherRelease() predicate.
internal/operator-controller/catalogmetadata/filter/bundle_predicates_test.go Adds predicate unit tests including edge cases.
internal/operator-controller/catalogmetadata/filter/successors_test.go Adds a regression test to ensure default (gate-off) behavior does not accept higher-release bundles.

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

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 6, 2026

Codecov Report

❌ Patch coverage is 85.29412% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.00%. Comparing base (fd25bf7) to head (8d6dda3).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
internal/operator-controller/bundleutil/bundle.go 90.00% 1 Missing and 1 partial ⚠️
...ator-controller/catalogmetadata/compare/compare.go 81.81% 1 Missing and 1 partial ⚠️
...or-controller/catalogmetadata/filter/successors.go 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2543      +/-   ##
==========================================
+ Coverage   68.95%   69.00%   +0.05%     
==========================================
  Files         139      139              
  Lines        9891     9915      +24     
==========================================
+ Hits         6820     6842      +22     
- Misses       2562     2563       +1     
- Partials      509      510       +1     
Flag Coverage Δ
e2e 37.23% <20.58%> (-0.34%) ⬇️
experimental-e2e 52.14% <32.35%> (-0.09%) ⬇️
unit 53.67% <85.29%> (+0.07%) ⬆️

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:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI review requested due to automatic review settings March 6, 2026 17:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 5 out of 5 changed files in this pull request and generated 1 comment.


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

@joelanford
Copy link
Copy Markdown
Member

If I understand this correctly, it looks like this introduces the new behavior that an explicit upgrade edge doesn't actually have to exist in the catalog to upgrade to a bundle that has the same version and a higher release. Is that the intent? (If so let's make that clear in the PR description).

Is it also the intent that we'll inherit the upgrade edges of the first release of the version?

@grokspawn
Copy link
Copy Markdown
Contributor

grokspawn commented Mar 9, 2026

We discussed earlier today. I think the first step is to essentially revert #2273 so that we're not attempting to interpret build metadata as release info anymore. Any catalogs built with tooling that supports release versioning will automagically propagate the build metadata into the CSV's spec.release field anyway, so regardless of whether the operator author used the old build metadata approach or the new spec.release approach, they would still have spec.release here.

The next step is to ensure that we're sorting successors using the CompositeVersion, which is easily performed if using the Bundle comparator during the sort.

This will prefer version+release over version.

#2273 makes the claim that future bundle types will drop this approach, not that registry+v1 bundles should. So that's my bad.
From the perspective of fulfilling handling precedents for registry+v1 bundles, we need to retain the ability to differentiate/order them by build metadata. :(

@grokspawn
Copy link
Copy Markdown
Contributor

If I understand this correctly, it looks like this introduces the new behavior that an explicit upgrade edge doesn't actually have to exist in the catalog to upgrade to a bundle that has the same version and a higher release. Is that the intent? (If so let's make that clear in the PR description).

Is it also the intent that we'll inherit the upgrade edges of the first release of the version?

Sadly, we have to rely on the presence of existing graph edges or we break assumptions users have with the registry+v1 bundle format, coming from v0.

So even though we have the ability to prefer version+release over version, since replaces/skips use named bundles instead of bundle versions we have to support the older behavior.

@joelanford
Copy link
Copy Markdown
Member

I think the first step is to essentially revert #2273 so that we're not attempting to interpret build metadata as release info anymore.

That would be a regression of a bug fix that #2273 made though, right?

Sadly, we have to rely on the presence of existing graph edges or we break assumptions users have with the registry+v1 bundle format, coming from v0.

So even though we have the ability to prefer version+release over version, since replaces/skips use named bundles instead of bundle versions we have to support the older behavior.

Yeah, agreed. I reached the same conclusion after thinking about this more.

So if I understand correctly now:

  1. The existing code on main already honors the upgrade graph and orders "same version, different release" correctly when parsing from build metadata
  2. The existing code on main knows nothing about the new release field.

So the change we need now is "look for release in the olm.package property, and if present, prefer it over build metadata"?

Copilot AI review requested due to automatic review settings March 12, 2026 19:55
@rashmigottipati rashmigottipati force-pushed the oprun-4277-implementation branch from 5681488 to 8dcab49 Compare March 12, 2026 20:00
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 5 out of 5 changed files in this pull request and generated 4 comments.


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

@grokspawn
Copy link
Copy Markdown
Contributor

Adjusted my comments. I missed the part of the #2273 description when it said that we wouldn't divert from semver ordering for any new bundle formats.
From the perspective of registry+v1 bundles, this is precedent and we should support the new case with .spec.release is available, otherwise falling back on the 'is it bundle metadata' ordering logic.

@rashmigottipati rashmigottipati force-pushed the oprun-4277-implementation branch from a2e5062 to 1e9cded Compare April 2, 2026 20:52
Copilot AI review requested due to automatic review settings April 2, 2026 20:52
Copilot AI review requested due to automatic review settings April 6, 2026 20:39
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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.


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

@rashmigottipati
Copy link
Copy Markdown
Member Author

@grokspawn Done. Updated the PR to enable the feature gate in experimental release.

Signed-off-by: Rashmi Gottipati <rgottipa@redhat.com>
Copilot AI review requested due to automatic review settings April 7, 2026 17:22
@rashmigottipati rashmigottipati force-pushed the oprun-4277-implementation branch from 3cca497 to 477accb Compare April 7, 2026 17:22
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 4 comments.


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

Signed-off-by: Rashmi Gottipati <rgottipa@redhat.com>
@grokspawn
Copy link
Copy Markdown
Contributor

@rashmigottipati would you please resolve the copilot comments in this review? I'm trying to not duplicate guidance with them, and it's challenging to know what is still current.

What I have been doing is:

  • thumbs-up and resolve, for good feedback that I updated
  • thumbs-down and resolve, for clear hallucinations or obvious craziness
  • thumbs-down and DON'T resolve, for a disagreement I cannot dismiss (and we can talk more about).

WDYT?

…upport

Signed-off-by: Rashmi Gottipati <rgottipa@redhat.com>
Copilot AI review requested due to automatic review settings April 7, 2026 19:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 3 comments.


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

Signed-off-by: Rashmi Gottipati <rgottipa@redhat.com>
Copy link
Copy Markdown
Contributor

@pedjak pedjak left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! Here are some review comments on the implementation.

Signed-off-by: Rashmi Gottipati <rgottipa@redhat.com>
Copilot AI review requested due to automatic review settings April 8, 2026 18:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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.


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

…kg.Release field

Signed-off-by: Rashmi Gottipati <rgottipa@redhat.com>
// and falls back to build metadata comparison if equal. When disabled, it uses
// version+release from build metadata (backward compatible).
func ByVersionAndRelease(b1, b2 declcfg.Bundle) int {
if features.OperatorControllerFeatureGate.Enabled(features.BundleReleaseSupport) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This change feels off to me.

It seems like this function shouldn't change at all. The change, as I understand it, boils down to how we build a version/release.

Without the feature gate: Only do it the legacy way by inspecting/parsing build metadata

With the feature gate: If release field is set, parse it directly. Only if unset do we fall back to legacy registry+v1 build metadata parsing.

But then once we have a VersionRelease, the comparison is the same.

Am I missing something else?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe the thing I'm missing is:

  • operator-registry has a CompositeVersion type
  • operator-controller has a VersionRelease type.

These represent the same exact concept, and we're trying to move in the direction of using the operator-registry variant?

IMO, we shouldn't mix them. We should pick one and delete the other.

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.

I completely agree that we need to consolidate to a single representative type.
This PR is not intended to force the type consistency yet, since if it adopted the CompositeVersion type right now it would lack a formal Release type which we determined was essential to encourage broad adoption.
It just provides the featuregate and the sensitivity to an explicit release version.
I'd intended to merge operator-framework/operator-registry#1938 and then we would have follow-ups to op-reg & op-con to adopt the base type consistently throughout.
I was just hoping to be able to merge the two PRs independently.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

So WDYT about this PR focusing on "if release explicitly set, load it into VersionRelease value". And then a later PR comes in a moves everything over to the operator-registry types/comparisons?

// 2. Versions and releases are equal
// 3. Parsing errors occur (silently swallowed)
// Catalog validation should catch malformed versions before they reach this code.
result := b2.Compare(&b1)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Comparing at the bundle level seems incorrect to me based on the name of this function. What if the bundle comparison method considers more than the version and release?

Seems like we'd want b2.CompositeVersion.Compare(&b1.CompositeVersion) or something like that?

Signed-off-by: Rashmi Gottipati <rgottipa@redhat.com>
Copilot AI review requested due to automatic review settings April 8, 2026 19:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 9 out of 9 changed files in this pull request and generated 1 comment.


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

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