Skip to content

OCPBUGS-79525: Fix null reference error in subscription action menu#16196

Open
rhamilto wants to merge 1 commit intoopenshift:mainfrom
rhamilto:OCPBUGS-79525
Open

OCPBUGS-79525: Fix null reference error in subscription action menu#16196
rhamilto wants to merge 1 commit intoopenshift:mainfrom
rhamilto:OCPBUGS-79525

Conversation

@rhamilto
Copy link
Member

@rhamilto rhamilto commented Mar 25, 2026

Summary

  • Fix runtime error when uninstalling an operator from the catalog overlay modal
  • Add null check before calling referenceFor(obj) in customActionMenu to prevent "Cannot destructure property 'kind' of object null" error
  • The issue occurred because the action menu was rendered before the subscription object was fully loaded

After

Screen.Recording.2026-03-25.at.11.31.35.AM.mov

Test plan

  • Open the OpenShift catalog from the developer or admin perspective
  • Navigate to an installed operator in the catalog overlay modal
  • Click the "Uninstall" action from the kebab menu
  • Verify no runtime error occurs and the uninstall modal opens correctly
  • Test the action menu on the subscription details page to ensure it still works

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Fixed an issue in subscription details where the action menu could attempt to render even when subscription data was unavailable. The action menu now conditionally displays only when the required data is present.

Add null check before calling referenceFor(obj) in customActionMenu
to prevent "Cannot destructure property 'kind' of object null" error
when uninstalling an operator from the catalog overlay modal.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@openshift-ci-robot openshift-ci-robot added jira/severity-moderate Referenced Jira bug's severity is moderate for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Mar 25, 2026
@openshift-ci-robot
Copy link
Contributor

@rhamilto: This pull request references Jira Issue OCPBUGS-79525, which is invalid:

  • expected the bug to target the "4.22.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

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

Details

In response to this:

Summary

  • Fix runtime error when uninstalling an operator from the catalog overlay modal
  • Add null check before calling referenceFor(obj) in customActionMenu to prevent "Cannot destructure property 'kind' of object null" error
  • The issue occurred because the action menu was rendered before the subscription object was fully loaded

Test plan

  • Open the OpenShift catalog from the developer or admin perspective
  • Navigate to an installed operator in the catalog overlay modal
  • Click the "Uninstall" action from the kebab menu
  • Verify no runtime error occurs and the uninstall modal opens correctly
  • Test the action menu on the subscription details page to ensure it still works

🤖 Generated with Claude Code

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.

@openshift-ci openshift-ci bot requested review from jhadvig and spadgett March 25, 2026 15:31
@openshift-ci openshift-ci bot added component/olm Related to OLM approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Mar 25, 2026
@rhamilto
Copy link
Member Author

/jira refresh

@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Mar 25, 2026
@openshift-ci-robot
Copy link
Contributor

@rhamilto: This pull request references Jira Issue OCPBUGS-79525, 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 (4.22.0) matches configured target version for branch (4.22.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

/jira refresh

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.

Copy link
Member

@logonoff logonoff left a comment

Choose a reason for hiding this comment

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

/lgtm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 25, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: ccc7fd82-eccd-40af-8cc9-8890753333fe

📥 Commits

Reviewing files that changed from the base of the PR and between 1425db6 and 3fdeda4.

📒 Files selected for processing (1)
  • frontend/packages/operator-lifecycle-manager/src/components/subscription.tsx
📜 Recent review details
🧰 Additional context used
📓 Path-based instructions (1)
**

⚙️ CodeRabbit configuration file

-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.

Files:

  • frontend/packages/operator-lifecycle-manager/src/components/subscription.tsx
🔇 Additional comments (1)
frontend/packages/operator-lifecycle-manager/src/components/subscription.tsx (1)

767-776: Null-guard fix is correct and resolves the crash path.

This safely prevents referenceFor(obj) from being invoked before the subscription object is available, and returning null here is appropriate for transient loading states.


📝 Walkthrough

Walkthrough

The SubscriptionDetailsPage component's customActionMenu prop was updated to add a null-safety guard. The implementation now checks whether the obj parameter is truthy before attempting to render the LazyActionMenu component and compute its context via referenceFor(obj). When obj is absent, the function returns null. This prevents potential runtime errors that could occur from passing undefined or null values to downstream components and utility functions.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Mar 25, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 25, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: logonoff, rhamilto

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

@XiyunZhao
Copy link
Contributor

Bug has been verified by using cluster-bot, now user can uninstall the operator on operator subscribe page normally

@XiyunZhao
Copy link
Contributor

/verified by @XiyunZhao

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Mar 26, 2026
@openshift-ci-robot
Copy link
Contributor

@XiyunZhao: This PR has been marked as verified by @XiyunZhao.

Details

In response to this:

/verified by @XiyunZhao

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.

@rhamilto
Copy link
Member Author

/retest

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 26, 2026

@rhamilto: all tests passed!

Full PR test history. Your PR dashboard.

Details

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 kubernetes-sigs/prow repository. I understand the commands that are listed here.

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. component/olm Related to OLM jira/severity-moderate Referenced Jira bug's severity is moderate for the branch this PR is targeting. 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. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants