Skip to content

OCPBUGS-85775: validate skipRange with blang/semver ParseRange#1987

Merged
openshift-merge-bot[bot] merged 1 commit into
operator-framework:masterfrom
joelanford:fix-OCPBUGS-85775
May 20, 2026
Merged

OCPBUGS-85775: validate skipRange with blang/semver ParseRange#1987
openshift-merge-bot[bot] merged 1 commit into
operator-framework:masterfrom
joelanford:fix-OCPBUGS-85775

Conversation

@joelanford

Copy link
Copy Markdown
Member

Description of the change:

opm validate does not validate the skipRange field in operator bundle metadata. Invalid semver ranges (e.g. >v0.1.0, >1.00.1) are silently accepted, which can lead to broken upgrade graphs discovered only at runtime.

This PR adds validation of the skipRange field in Bundle.Validate() using semver.ParseRange() from the blang/semver library (already a dependency). Any parse error is surfaced in the validation error tree.

Motivation for the change:

Invalid skipRange values should be caught at build/validation time rather than at install time. This makes opm validate more reliable as a pre-publish check.

Reviewer Checklist

  • Implementation matches the proposed design, or proposal is updated to match implementation
  • Sufficient unit test coverage
  • Sufficient end-to-end test coverage
  • Docs updated or added to /docs
  • Commit messages sensible and descriptive

Jira: https://redhat.atlassian.net/browse/OCPBUGS-85775

🤖 Generated with Claude Code via /jira:solve OCPBUGS-85775

Copilot AI review requested due to automatic review settings May 15, 2026 15:21
@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 May 15, 2026
@openshift-ci

openshift-ci Bot commented May 15, 2026

Copy link
Copy Markdown
Contributor

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

@openshift-ci-robot openshift-ci-robot added jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. labels May 15, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@joelanford: This pull request references Jira Issue OCPBUGS-85775, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

Description of the change:

opm validate does not validate the skipRange field in operator bundle metadata. Invalid semver ranges (e.g. >v0.1.0, >1.00.1) are silently accepted, which can lead to broken upgrade graphs discovered only at runtime.

This PR adds validation of the skipRange field in Bundle.Validate() using semver.ParseRange() from the blang/semver library (already a dependency). Any parse error is surfaced in the validation error tree.

Motivation for the change:

Invalid skipRange values should be caught at build/validation time rather than at install time. This makes opm validate more reliable as a pre-publish check.

Reviewer Checklist

  • Implementation matches the proposed design, or proposal is updated to match implementation
  • Sufficient unit test coverage
  • Sufficient end-to-end test coverage
  • Docs updated or added to /docs
  • Commit messages sensible and descriptive

Jira: https://redhat.atlassian.net/browse/OCPBUGS-85775

🤖 Generated with Claude Code via /jira:solve OCPBUGS-85775

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

Copilot AI left a comment

Copy link
Copy Markdown

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 adds skipRange syntax validation to bundle model validation so invalid semver ranges are caught by opm validate before publication/runtime graph use.

Changes:

  • Validates non-empty Bundle.SkipRange using blang/semver’s ParseRange.
  • Adds unit tests covering a valid range and invalid ranges with a leading v and leading zeroes.

Reviewed changes

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

File Description
alpha/model/model.go Adds skipRange parse validation to Bundle.Validate().
alpha/model/model_test.go Adds validator test cases for valid and invalid skipRange values.

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

opm validate silently accepts invalid skipRange values, which can lead
to broken upgrade graphs discovered only at runtime. Parse the
skipRange field using semver.ParseRange() and surface any error in the
validation error tree.
@joelanford joelanford force-pushed the fix-OCPBUGS-85775 branch from 86c5bbb to 8ac96c2 Compare May 15, 2026 15:25
@joelanford joelanford marked this pull request as ready for review May 15, 2026 15:25
Copilot AI review requested due to automatic review settings May 15, 2026 15:25
@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 May 15, 2026
@openshift-ci openshift-ci Bot requested review from ankitathomas and grokspawn May 15, 2026 15:25

Copilot AI left a comment

Copy link
Copy Markdown

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

@codecov

codecov Bot commented May 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 57.88%. Comparing base (fdecf0e) to head (8ac96c2).
⚠️ Report is 18 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1987      +/-   ##
==========================================
+ Coverage   57.71%   57.88%   +0.17%     
==========================================
  Files         139      140       +1     
  Lines       13373    13451      +78     
==========================================
+ Hits         7718     7786      +68     
- Misses       4468     4474       +6     
- Partials     1187     1191       +4     

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

@perdasilva

Copy link
Copy Markdown
Contributor

/approve

@openshift-ci

openshift-ci Bot commented May 19, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: perdasilva

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

The pull request process is described 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

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 19, 2026
@tmshort

tmshort commented May 20, 2026

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label May 20, 2026
@openshift-merge-bot openshift-merge-bot Bot merged commit 1ead90f into operator-framework:master May 20, 2026
17 checks passed
@openshift-ci-robot

Copy link
Copy Markdown

@joelanford: Jira Issue OCPBUGS-85775: All pull requests linked via external trackers have merged:

Jira Issue OCPBUGS-85775 has been moved to the MODIFIED state.

Details

In response to this:

Description of the change:

opm validate does not validate the skipRange field in operator bundle metadata. Invalid semver ranges (e.g. >v0.1.0, >1.00.1) are silently accepted, which can lead to broken upgrade graphs discovered only at runtime.

This PR adds validation of the skipRange field in Bundle.Validate() using semver.ParseRange() from the blang/semver library (already a dependency). Any parse error is surfaced in the validation error tree.

Motivation for the change:

Invalid skipRange values should be caught at build/validation time rather than at install time. This makes opm validate more reliable as a pre-publish check.

Reviewer Checklist

  • Implementation matches the proposed design, or proposal is updated to match implementation
  • Sufficient unit test coverage
  • Sufficient end-to-end test coverage
  • Docs updated or added to /docs
  • Commit messages sensible and descriptive

Jira: https://redhat.atlassian.net/browse/OCPBUGS-85775

🤖 Generated with Claude Code via /jira:solve OCPBUGS-85775

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@joelanford joelanford deleted the fix-OCPBUGS-85775 branch June 1, 2026 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants