Skip to content

🌱 Return *DeploymentConfig directly from GetDeploymentConfig()#2598

Open
joelanford wants to merge 1 commit intooperator-framework:mainfrom
joelanford:refactor/get-deployment-config-return-type
Open

🌱 Return *DeploymentConfig directly from GetDeploymentConfig()#2598
joelanford wants to merge 1 commit intooperator-framework:mainfrom
joelanford:refactor/get-deployment-config-return-type

Conversation

@joelanford
Copy link
Member

Description

GetDeploymentConfig() previously returned map[string]any, requiring callers to
immediately convert it to a *DeploymentConfig via a separate convertToDeploymentConfig()
function. This changes the method to return (*DeploymentConfig, error) directly,
eliminating the unnecessary indirection.

Changes:

  • config/config.go: GetDeploymentConfig() now returns (*DeploymentConfig, error) instead of map[string]any, unmarshaling directly into the struct internally
  • applier/provider.go: Removed convertToDeploymentConfig() function; caller now uses the *DeploymentConfig directly
  • config/config_test.go: Updated test expectations for new return type; removed defensive-copy test (no longer applicable to struct return)

Reviewer Checklist

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

Generated with Claude Code

Copilot AI review requested due to automatic review settings March 25, 2026 19:37
@openshift-ci openshift-ci bot requested review from oceanc80 and pedjak March 25, 2026 19:37
@netlify
Copy link

netlify bot commented Mar 25, 2026

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit bb588d5
🔍 Latest deploy log https://app.netlify.com/projects/olmv1/deploys/69c43e4b4b25ac0008ee0a45
😎 Deploy Preview https://deploy-preview-2598--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.

@tmshort
Copy link
Contributor

tmshort commented Mar 25, 2026

/approve

@openshift-ci
Copy link

openshift-ci bot commented Mar 25, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tmshort

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 Mar 25, 2026
Copy link
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 simplifies how deployment configuration is accessed by changing Config.GetDeploymentConfig() to return a typed *DeploymentConfig (with an error) directly, removing the need for callers to convert from a generic map[string]any.

Changes:

  • Updated GetDeploymentConfig() to unmarshal into DeploymentConfig internally and return (*DeploymentConfig, error).
  • Removed convertToDeploymentConfig() and updated the applier to consume the typed config directly.
  • Updated unit tests to assert against *config.DeploymentConfig and the new error return.

Reviewed changes

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

File Description
internal/operator-controller/config/config.go Changes GetDeploymentConfig() to return (*DeploymentConfig, error) and unmarshal internally.
internal/operator-controller/applier/provider.go Removes map→struct conversion helper; uses the new accessor directly.
internal/operator-controller/config/config_test.go Updates expectations for the new return type and error handling.

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

@joelanford joelanford force-pushed the refactor/get-deployment-config-return-type branch from 05fd6db to 35c51b7 Compare March 25, 2026 19:42
@joelanford
Copy link
Member Author

/hold

Still self-reviewing Claude's work and making sure I address Copilot's feedback.

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 25, 2026
Copilot AI review requested due to automatic review settings March 25, 2026 19:48
@joelanford joelanford force-pushed the refactor/get-deployment-config-return-type branch from 35c51b7 to a6ed8a8 Compare March 25, 2026 19:48
@joelanford joelanford force-pushed the refactor/get-deployment-config-return-type branch from a6ed8a8 to 3779279 Compare March 25, 2026 19:51
Copy link
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 4 out of 4 changed files in this pull request and generated 2 comments.


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

Change GetDeploymentConfig() to return (*DeploymentConfig, error) instead of
map[string]any, eliminating the intermediate convertToDeploymentConfig() function
in provider.go. The caller was immediately converting the map to a DeploymentConfig
anyway, so this simplifies the API and removes unnecessary indirection.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@joelanford joelanford force-pushed the refactor/get-deployment-config-return-type branch from 3779279 to bb588d5 Compare March 25, 2026 19:58
@joelanford
Copy link
Member Author

/hold cancel

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 25, 2026
@codecov
Copy link

codecov bot commented Mar 25, 2026

Codecov Report

❌ Patch coverage is 78.57143% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.96%. Comparing base (71a91dc) to head (bb588d5).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
internal/operator-controller/applier/provider.go 50.00% 1 Missing and 1 partial ⚠️
internal/operator-controller/config/config.go 90.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2598      +/-   ##
==========================================
+ Coverage   67.81%   67.96%   +0.15%     
==========================================
  Files         137      137              
  Lines        9588     9575      -13     
==========================================
+ Hits         6502     6508       +6     
+ Misses       2586     2573      -13     
+ Partials      500      494       -6     
Flag Coverage Δ
e2e 38.32% <0.00%> (+0.31%) ⬆️
experimental-e2e 50.99% <50.00%> (+0.04%) ⬆️
unit 52.96% <78.57%> (+0.01%) ⬆️

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

approved Indicates a PR has been approved by an approver from all required OWNERS files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants