Skip to content

Conversation

@camilamacedo86
Copy link
Contributor

@camilamacedo86 camilamacedo86 commented Dec 24, 2025

Change ClusterCatalog Priority field from int32 to *int32 to properly
represent an optional field with a default value.

  • Update Priority to *int32 with json:"priority,omitempty"
  • Fix kubebuilder markers: Minimum/Maximum capitalization
  • Add Format:=int32 marker for OpenAPI schema

The kubebuilder default marker ensures the API server sets Priority
to 0 when omitted, while the pointer type allows proper detection of
user-specified vs defaulted values.

@camilamacedo86 camilamacedo86 requested a review from a team as a code owner December 24, 2025 17:06
Copilot AI review requested due to automatic review settings December 24, 2025 17:06
@openshift-ci openshift-ci bot requested review from anik120 and bentito December 24, 2025 17:06
@openshift-ci
Copy link

openshift-ci bot commented Dec 24, 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 camilamacedo86, thetechnick 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

//
// +kubebuilder:default:=0
// +kubebuilder:validation:minimum:=-2147483648
// +kubebuilder:validation:maximum:=2147483647
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The above ones are invalid.
Therefore, we are fixing the validation here.

@netlify
Copy link

netlify bot commented Dec 24, 2025

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit c88aa54
🔍 Latest deploy log https://app.netlify.com/projects/olmv1/deploys/694c1fbf7ce38100089484b3
😎 Deploy Preview https://deploy-preview-2413--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.

// +kubebuilder:validation:Format:=int32
// +optional
Priority int32 `json:"priority"`
Priority *int32 `json:"priority,omitempty"`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • Pointer = distinguish between "not set" (nil) vs "set to 0"
  • omitempty = don't show field in YAML when not set (cleaner)
  • kubebuilder default = API server fills in 0 when user omits it

  Change ClusterCatalog Priority field from int32 to *int32 to properly
  represent an optional field with a default value.

  - Update Priority to *int32 with json:"priority,omitempty"
  - Fix kubebuilder markers: Minimum/Maximum capitalization
  - Add Format:=int32 marker for OpenAPI schema
  - Add GetPriority() helper method for safe nil handling
  - Update resolver to use GetPriority() instead of direct access
  - Update tests to use ptr.To[int32]() for pointer values

  The kubebuilder default marker ensures the API server sets Priority
  to 0 when omitted, while the pointer type allows proper detection of
  user-specified vs defaulted values.

Assisted-by: CLAUDE

This comment was marked as outdated.

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


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

// The lowest possible value is -2147483648.
// The highest possible value is 2147483647.
//
// +kubebuilder:default:=0
Copy link

Copilot AI Dec 24, 2025

Choose a reason for hiding this comment

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

The +kubebuilder:default:=0 marker combined with the pointer type *int32 creates a contradiction. When this default is applied by the API server, the Go code will receive a non-nil pointer to 0 whether the user explicitly set priority to 0 or omitted it entirely. This defeats the purpose of using a pointer type, which is typically to distinguish between "not set" (nil) and "set to zero value" (non-nil pointer to 0). Consider removing the default marker if the goal is to detect user-specified vs omitted values, or changing back to a non-pointer type if a default value should always be present.

Copilot uses AI. Check for mistakes.
@codecov
Copy link

codecov bot commented Dec 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.82%. Comparing base (bd540c9) to head (c88aa54).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2413   +/-   ##
=======================================
  Coverage   68.82%   68.82%           
=======================================
  Files         100      100           
  Lines        7641     7648    +7     
=======================================
+ Hits         5259     5264    +5     
- Misses       1947     1948    +1     
- Partials      435      436    +1     
Flag Coverage Δ
e2e 43.96% <100.00%> (+0.14%) ⬆️
experimental-e2e 13.72% <50.00%> (+0.04%) ⬆️
unit 57.09% <50.00%> (-0.02%) ⬇️

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.

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