Skip to content

MGMT-23549: Unable to recover from duplicate/ invalid manifest#3482

Merged
openshift-merge-bot[bot] merged 1 commit intoopenshift-assisted:masterfrom
jgyselov:ui_settings_for_manifest_remove
Mar 24, 2026
Merged

MGMT-23549: Unable to recover from duplicate/ invalid manifest#3482
openshift-merge-bot[bot] merged 1 commit intoopenshift-assisted:masterfrom
jgyselov:ui_settings_for_manifest_remove

Conversation

@jgyselov
Copy link
Copy Markdown
Contributor

@jgyselov jgyselov commented Mar 24, 2026

https://redhat.atlassian.net/browse/MGMT-23549

Summary by CodeRabbit

  • Bug Fixes
    • Fixed an issue where the interface did not reliably refresh after removing a custom manifest: the UI now updates immediately after a successful removal.
    • Ensures cluster configuration state stays consistent and visible to users without requiring manual refresh or navigation.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Mar 24, 2026
@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented Mar 24, 2026

@jgyselov: This pull request references MGMT-23549 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the bug to target the "4.22.0" version, but no target version was set.

Details

In response to this:

https://redhat.atlassian.net/browse/MGMT-23549

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 ammont82 and rawagner March 24, 2026 10:57
@openshift-ci openshift-ci bot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Mar 24, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 24, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cc56b5f7-5d85-42b2-b36d-51be09f0eb84

📥 Commits

Reviewing files that changed from the base of the PR and between 24abdf8 and a81ad95.

📒 Files selected for processing (1)
  • libs/ui-lib/lib/ocm/components/clusterConfiguration/manifestsConfiguration/components/CustomManifestsArray.tsx
✅ Files skipped from review due to trivial changes (1)
  • libs/ui-lib/lib/ocm/components/clusterConfiguration/manifestsConfiguration/components/CustomManifestsArray.tsx

📝 Walkthrough

Walkthrough

CustomManifestsArray now uses useClusterWizardContext() to obtain updateUISettings and calls await updateUISettings({ customManifestsUpdated: true }) after successful ClustersAPI.removeCustomManifest(...), and the removeManifest hook dependency array was updated to include updateUISettings.

Changes

Cohort / File(s) Summary
Custom Manifest Deletion Handler
libs/ui-lib/lib/ocm/components/clusterConfiguration/manifestsConfiguration/components/CustomManifestsArray.tsx
Initialize updateUISettings from useClusterWizardContext(). After successful ClustersAPI.removeCustomManifest(...), await updateUISettings({ customManifestsUpdated: true }). Add updateUISettings to removeManifest useCallback dependency array.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested labels

lgtm, jira/valid-bug

Suggested reviewers

  • rawagner
  • ammont82
  • batzionb

Poem

I’m a rabbit in a cluster, swift and neat, 🐇
I nudge the UI when manifests take their seat,
Delete one, then tell the wizard so,
State stays true, the views all glow —
Hooray for tidy sync, a small but merry feat!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: fixing the inability to recover from duplicate/invalid manifests by ensuring UI settings are properly updated after manifest removal.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

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

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented Mar 24, 2026

@jgyselov: This pull request references MGMT-23549 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the bug to target the "4.22.0" version, but no target version was set.

Details

In response to this:

https://redhat.atlassian.net/browse/MGMT-23549

Summary by CodeRabbit

  • Bug Fixes
  • Fixed an issue where the application interface did not properly refresh after removing a custom manifest, ensuring UI state consistency during cluster configuration.

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
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
libs/ui-lib/lib/ocm/components/clusterConfiguration/manifestsConfiguration/components/CustomManifestsArray.tsx (1)

73-80: ⚠️ Potential issue | 🟠 Major

Split delete failure handling from UI-settings update failure.

At Line 73, updateUISettings is inside the same try as the backend delete. If delete succeeds but UI-settings update fails, the alert at Line 77 says deletion failed (incorrect), and onConfirm still removes the form row, while customManifestsUpdated may stay unset. That can leave install-state gating stale.

💡 Proposed fix
-  const removeManifest = React.useCallback(
-    async (clusterId: string, manifestIdx: number) => {
+  const removeManifest = React.useCallback(
+    async (clusterId: string, manifestIdx: number): Promise<boolean> => {
       const manifestToRemove = field.value[manifestIdx];
       if ((manifestToRemove['folder'] as string) !== '' && manifestToRemove['filename'] !== '') {
         try {
           await ClustersAPI.removeCustomManifest(
             clusterId,
             manifestToRemove['folder'] as string,
             manifestToRemove['filename'],
           );
-          await updateUISettings({ customManifestsUpdated: true });
         } catch (e) {
           handleApiError(e, () =>
             addAlert({
               title: 'Manifest could not be deleted',
               message: getApiErrorMessage(e),
             }),
           );
+          return false;
+        }
+
+        try {
+          await updateUISettings({ customManifestsUpdated: true });
+        } catch (e) {
+          handleApiError(e, () =>
+            addAlert({
+              title: 'Manifest deleted, but failed to refresh UI state',
+              message: getApiErrorMessage(e),
+            }),
+          );
         }
       }
+      return true;
     },
     [addAlert, field.value, updateUISettings],
   );
   const onConfirm = React.useCallback(async (): Promise<void> => {
     if (manifestIdxToRemove !== null) {
-      await removeManifest(clusterId, manifestIdxToRemove);
-      remove(manifestIdxToRemove);
+      const shouldRemoveFromForm = await removeManifest(clusterId, manifestIdxToRemove);
+      if (shouldRemoveFromForm) {
+        remove(manifestIdxToRemove);
+      }
       setManifestIdxToRemove(null);
     }
   }, [removeManifest, clusterId, remove, manifestIdxToRemove, setManifestIdxToRemove]);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@libs/ui-lib/lib/ocm/components/clusterConfiguration/manifestsConfiguration/components/CustomManifestsArray.tsx`
around lines 73 - 80, The backend delete and the UI-settings update are in the
same try/catch causing delete-success + update-failure to be reported as a
deletion failure; separate them: keep the backend delete call in its own
try/catch and on success proceed to a second try/catch that calls
updateUISettings({ customManifestsUpdated: true }); if the delete try fails, use
handleApiError(...) with addAlert titled "Manifest could not be deleted" and
message from getApiErrorMessage; if the UI-settings update try fails, call
handleApiError(...) with a distinct alert (e.g., "Manifest deleted but UI
settings update failed") and the API error message, and ensure removal of the
form row or local state update is performed only based on the actual delete
success logic (not silently rolled back by the UI-update error).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In
`@libs/ui-lib/lib/ocm/components/clusterConfiguration/manifestsConfiguration/components/CustomManifestsArray.tsx`:
- Around line 73-80: The backend delete and the UI-settings update are in the
same try/catch causing delete-success + update-failure to be reported as a
deletion failure; separate them: keep the backend delete call in its own
try/catch and on success proceed to a second try/catch that calls
updateUISettings({ customManifestsUpdated: true }); if the delete try fails, use
handleApiError(...) with addAlert titled "Manifest could not be deleted" and
message from getApiErrorMessage; if the UI-settings update try fails, call
handleApiError(...) with a distinct alert (e.g., "Manifest deleted but UI
settings update failed") and the API error message, and ensure removal of the
form row or local state update is performed only based on the actual delete
success logic (not silently rolled back by the UI-update error).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8ffb7dc4-05f8-4e8c-b343-7bab16dad1aa

📥 Commits

Reviewing files that changed from the base of the PR and between 17c1910 and 24abdf8.

📒 Files selected for processing (1)
  • libs/ui-lib/lib/ocm/components/clusterConfiguration/manifestsConfiguration/components/CustomManifestsArray.tsx

@jgyselov jgyselov force-pushed the ui_settings_for_manifest_remove branch from 24abdf8 to a81ad95 Compare March 24, 2026 11:09
@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented Mar 24, 2026

@jgyselov: This pull request references MGMT-23549 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the bug to target the "4.22.0" version, but no target version was set.

Details

In response to this:

https://redhat.atlassian.net/browse/MGMT-23549

Summary by CodeRabbit

  • Bug Fixes
  • Fixed an issue where the interface did not reliably refresh after removing a custom manifest: the UI now updates immediately after a successful removal.
  • Ensures cluster configuration state stays consistent and visible to users without requiring manual refresh or navigation.

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.

@jgyselov
Copy link
Copy Markdown
Contributor Author

/cherry-pick releases/v2.51

@openshift-cherrypick-robot
Copy link
Copy Markdown
Contributor

@jgyselov: once the present PR merges, I will cherry-pick it on top of releases/v2.51 in a new PR and assign it to you.

Details

In response to this:

/cherry-pick releases/v2.51

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.

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

openshift-ci bot commented Mar 24, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jgyselov, LiorSoffer

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-merge-bot openshift-merge-bot bot merged commit c02338a into openshift-assisted:master Mar 24, 2026
14 checks passed
@openshift-cherrypick-robot
Copy link
Copy Markdown
Contributor

@jgyselov: new pull request created: #3485

Details

In response to this:

/cherry-pick releases/v2.51

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.

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-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants