Skip to content

Improve error handling of artifact deletion - #3157

Open
thivindu wants to merge 2 commits into
wso2:mainfrom
thivindu:bug-fixes
Open

Improve error handling of artifact deletion#3157
thivindu wants to merge 2 commits into
wso2:mainfrom
thivindu:bug-fixes

Conversation

@thivindu

@thivindu thivindu commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

This pull request enhances the deletion workflows for MCP Proxies, App LLM Proxies, and Service Providers by adding improved user feedback and safeguards, especially for read-only (gateway-managed) artifacts. It introduces consistent warning dialogs, disables deletion when blocked by active deployments or permissions, and clarifies error handling. These changes improve both user experience and system safety.

Deletion Workflow Improvements:

  • Added GatewayArtifactDeleteWarning to deletion dialogs for MCP Proxies, App LLM Proxies, and Service Providers to clearly inform users when deleting read-only (gateway-managed) artifacts. [1] [2] [3] [4]
  • Disabled delete actions with clear tooltips when the user lacks permission or when deletion is blocked by active deployments, using DisabledActionTooltip and improved logic for checking deployment status. [1] [2]

Read-Only Artifact and Deployment Blocking Logic:

  • Integrated logic to check for active deployments before allowing deletion of read-only MCP Proxies and App LLM Proxies, showing the reason for blocking deletion when applicable. [1] [2]
  • Updated state management to track read-only status and deployment counts for deletion eligibility. [1] [2] [3]

User Experience and Error Handling:

  • Improved error handling and feedback in provider deletion, displaying specific error messages on failure.
  • Enhanced dialog and button layouts for consistency and accessibility across all affected pages. [1] [2]

Code Consistency and Maintenance:

  • Refactored imports and dialog code to consistently use the new warning and tooltip components across all relevant files. [1] [2] [3] [4]

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This change adds shared deletion checks and read-only warnings for gateway-created artifacts. It updates overview pages to block deletion when deployments or linked proxies exist, and updates list dialogs to show the same warning content and improved delete error messages.

Changes

Artifact deletion guards

Layer / File(s) Summary
Shared deletion helpers
portals/ai-workspace/src/utils/artifactDeletion.ts, portals/ai-workspace/src/utils/readOnlyArtifacts.tsx
Adds shared helpers to detect active deployments, build delete-blocked tooltip text, and render GatewayArtifactDeleteWarning for read-only gateway artifacts.
Overview delete controls
portals/ai-workspace/src/pages/appShell/appShellPages/externalServers/ExternalServersOverview.tsx, portals/ai-workspace/src/pages/appShell/appShellPages/proxies/LLMProxyOverview.tsx, portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/ServiceProviderOverview.tsx
Adds delete permission checks, deployment or linked-proxy precondition lookups, disabled delete actions with tooltips, confirmation dialogs with read-only warnings, and delete execution or error handling on overview pages.
List delete dialog updates
portals/ai-workspace/src/pages/appShell/appShellPages/externalServers/ExternalServersList.tsx, portals/ai-workspace/src/pages/appShell/appShellPages/proxies/LLMProxiesList.tsx, portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/ProvidersList.tsx
Propagates readOnly state into list delete dialogs, shows the gateway warning for read-only artifacts, and uses API-derived error text for provider delete failures.

Estimated code review effort: 4 (Complex) | ~45 minutes

Suggested reviewers: krishanx92, rakhitharr, induwara04

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant OverviewPage
  participant PreconditionAPI
  participant DeleteAPI

  User->>OverviewPage: open artifact overview
  OverviewPage->>PreconditionAPI: fetch deployments or linked proxies
  PreconditionAPI-->>OverviewPage: return active counts
  OverviewPage-->>User: disable delete or open confirmation dialog
  User->>OverviewPage: confirm delete
  OverviewPage->>DeleteAPI: delete artifact
  DeleteAPI-->>OverviewPage: success or error
  OverviewPage-->>User: show snackbar and navigate if deleted
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the main changes but omits several required template sections, including tests, security checks, documentation, samples, and test environment. Add the missing template sections and provide test, security, documentation, related PR, sample, and test environment details.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title addresses artifact deletion error handling, which is a real part of the broader deletion safeguards and workflow changes.
Linked Issues check ✅ Passed The changes prevent deletion of deployed gateway-managed artifacts and provide clear blocking feedback, satisfying issue #3088.
Out of Scope Changes check ✅ Passed The changes remain focused on artifact deletion safeguards, warnings, permissions, deployment checks, error handling, and related UI consistency.
Docstring Coverage ✅ Passed Docstring coverage is 85.71% which is sufficient. The required threshold is 80.00%.
✨ 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@portals/ai-workspace/src/pages/appShell/appShellPages/externalServers/ExternalServersList.tsx`:
- Around line 598-603: Add a deployment preflight to each delete flow so
confirmation is blocked when deployments are active, pending, or unavailable.
Update ExternalServersList, LLMProxiesList, and ProvidersList to query the
relevant deployments before enabling delete, and keep the existing warning
dialogs as secondary context rather than the only guard. In ProvidersList,
preserve the current linked-proxy check and add the read-only LLM Provider
deployment check alongside it.

In
`@portals/ai-workspace/src/pages/appShell/appShellPages/externalServers/ExternalServersOverview.tsx`:
- Around line 448-456: Treat unresolved deployment lookups as a blocked delete
state in ExternalServersOverview, LLMProxyOverview, and ServiceProviderOverview:
replace the current null/falsey handling around deleteBlockedReason so it
distinguishes loading, lookup failure, and zero active deployments, and only
enables deletion after a successful deployment check returns zero. In
ServiceProviderOverview, also revalidate deployment status in the delete
confirmation/preflight path before allowing the request through, and keep
deletion disabled on lookup failure while wiring in a retry path for the
deployment check.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 56043a0d-c859-487e-8fa0-c1618ff15b83

📥 Commits

Reviewing files that changed from the base of the PR and between 382ed64 and c9b05dd.

📒 Files selected for processing (8)
  • portals/ai-workspace/src/pages/appShell/appShellPages/externalServers/ExternalServersList.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/externalServers/ExternalServersOverview.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/proxies/LLMProxiesList.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/proxies/LLMProxyOverview.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/ProvidersList.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/ServiceProviderOverview.tsx
  • portals/ai-workspace/src/utils/artifactDeletion.ts
  • portals/ai-workspace/src/utils/readOnlyArtifacts.tsx

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.

[Bug]: DP to CP Artifacts are shown as deletable

1 participant