Skip to content

Conversation

@camilamacedo86
Copy link
Contributor

@camilamacedo86 camilamacedo86 commented Nov 9, 2025

Summary

Bundle configuration is now validated using JSONSchema. Configuration
errors (typos, missing required fields, wrong types) are caught
immediately with clear error messages instead of failing during installation.

Motivation

https://issues.redhat.com/browse/OPRUN-4112

Criterias

Your Bundle Supports Do You Need to Configure watchNamespace?
AllNamespaces ✅ No - config is optional
SingleNamespace ❌ Yes - you must specify which namespace
OwnNamespace ❌ Yes - you must specify the install namespace
Multiple modes including AllNamespaces ✅ No - config is optional
Multiple modes WITHOUT AllNamespaces ❌ Yes - you must pick a namespace

Examples

✅ Works - AllNamespaces bundle without config

kind: ClusterExtension
spec:
  packageName: my-operator
  # No config needed

✅ Works - OwnNamespace bundle with config

kind: ClusterExtension
spec:
  packageName: my-operator
  config:
    watchNamespace: my-namespace

❌ Fails - OwnNamespace bundle without config

kind: ClusterExtension
spec:
  packageName: my-operator
  # Error: required field "watchNamespace" is missing

❌ Fails - Invalid field

kind: ClusterExtension
spec:
  packageName: my-operator
  config:
    watchNamespce: my-namespace  # Typo
    # Error: unknown field "watchNamespce"

@camilamacedo86 camilamacedo86 requested a review from a team as a code owner November 9, 2025 09:32
@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 Nov 9, 2025
@netlify
Copy link

netlify bot commented Nov 9, 2025

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit aaa71d0
🔍 Latest deploy log https://app.netlify.com/projects/olmv1/deploys/6911c977afb9540008f9cf5d
😎 Deploy Preview https://deploy-preview-2316--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.

@codecov
Copy link

codecov bot commented Nov 9, 2025

Codecov Report

❌ Patch coverage is 68.64865% with 58 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.06%. Comparing base (b3f85d5) to head (aaa71d0).

Files with missing lines Patch % Lines
...ternal/operator-controller/rukpak/bundle/config.go 68.64% 47 Missing and 11 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2316      +/-   ##
==========================================
+ Coverage   71.14%   74.06%   +2.91%     
==========================================
  Files          91       91              
  Lines        7046     7198     +152     
==========================================
+ Hits         5013     5331     +318     
+ Misses       1618     1446     -172     
- Partials      415      421       +6     
Flag Coverage Δ
e2e 44.79% <0.00%> (-1.15%) ⬇️
experimental-e2e 48.34% <51.35%> (?)
unit 58.68% <68.64%> (+0.09%) ⬆️

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.

@camilamacedo86 camilamacedo86 force-pushed the add-checks-config branch 3 times, most recently from a753a5c to f15ea9f Compare November 9, 2025 10:35
@camilamacedo86 camilamacedo86 changed the title WIP: ✨ (chore): Add structured bundle config validation helpers and tests. ✨ (chore): Add structured bundle config validation helpers and tests. Nov 9, 2025
@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 Nov 9, 2025
@openshift-ci
Copy link

openshift-ci bot commented Nov 9, 2025

[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 joelanford for approval. For more information see the Code Review Process.

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

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

@camilamacedo86 camilamacedo86 changed the title ✨ (chore): Add structured bundle config validation helpers and tests. ✨ (chore): Bundle configuration is now validated - errors caught early with clear messages. Nov 9, 2025
@camilamacedo86 camilamacedo86 changed the title ✨ (chore): Bundle configuration is now validated - errors caught early with clear messages. ✨ Bundle configuration is now validated - errors caught early with clear messages. Nov 9, 2025
Copilot AI review requested due to automatic review settings November 10, 2025 10:13
@camilamacedo86 camilamacedo86 force-pushed the add-checks-config branch 2 times, most recently from 1f3451a to 65bd4ef Compare November 10, 2025 10:17
Copy link

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 refactors bundle configuration validation to use JSON Schema for comprehensive validation rather than imperative Go code. The change moves all validation logic (structural checks, format validation, and install mode compatibility) into a dynamically generated JSON schema.

Key Changes:

  • Replaces manual validation logic with JSON Schema-based validation using the jsonschema/v6 library
  • Introduces schema generation functions that create validation rules tailored to bundle install modes
  • Adds comprehensive error formatting to translate JSON schema validation errors into user-friendly messages

Reviewed Changes

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

File Description
internal/operator-controller/rukpak/bundle/config.go Complete rewrite of validation logic to use JSON Schema; adds schema generation, custom format validators, and error message formatting functions
internal/operator-controller/rukpak/bundle/config_test.go Updates test cases to reflect new behavior where nil config is treated as {} for validation
go.mod Moves github.com/santhosh-tekuri/jsonschema/v6 from indirect to direct dependency
Comments suppressed due to low confidence (1)

internal/operator-controller/rukpak/bundle/config.go:505

  • [nitpick] The function substringBetween has a confusing parameter name finish that represents the index, not the end marker itself. The variable should be named endIdx to match the pattern used with beginbegin index calculation.

Consider renaming for consistency:

endIdx := strings.Index(remaining, end)
if endIdx == -1 {
    return ""
}
return remaining[:endIdx]
		return ""
	}
	return value[idx+len(token):]
}


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

@camilamacedo86 camilamacedo86 force-pushed the add-checks-config branch 2 times, most recently from d78bf4a to 920f78e Compare November 10, 2025 11:08
Copy link

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


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

Bundle configuration is now validated using JSONSchema. Configuration
errors (typos, missing required fields, wrong types) are caught
immediately with clear error messages instead of failing during installation.

Assisted-by: Cursor
Copy link

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


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

1 participant