fix(workloads): catch silent multi-cluster propagation failures and unhandled rejections#11114
Conversation
…ctions Signed-off-by: pulkitvats2007-crypto <[email protected]>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
✅ Deploy Preview for kubestellarconsole ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
👋 Hey @pulkitvats2007-crypto — thanks for opening this PR!
This is an automated message. |
|
👋 Welcome to the KubeStellar community! 💖 Thanks and congrats 🎉 for opening your first PR here! We're excited to have you contributing. Before merge, please ensure:
📬 If you're using KubeStellar in your organization, please add your name to our Adopters list. 🙏 It really helps the project gain momentum and credibility — a small contribution back with a big impact. Resources:
A maintainer will review your PR soon. Hope you have a great time here! 🌟 ~~~~~~~~~~ 🌟 📬 If you like KubeStellar, please ⭐ star ⭐ our repo to support it! 🙏 It really helps the project gain momentum and credibility — a small contribution back with a big impact. |
There was a problem hiding this comment.
Pull request overview
Improves reliability of workload orchestration in the web console by ensuring logical API failures ({ success: false }) are surfaced as errors (instead of being treated as success on HTTP 200), and by preventing an unhandled promise rejection in the dashboard runtime.
Changes:
- Add explicit
result.success === falsehandling in workload deploy/scale/delete hooks to throw and route errors through existing error paths. - Prevent unhandled promise rejection when triggering deploy from the dashboard runtime by attaching a
.catch(...). - Add unit tests covering HTTP 200 responses that still indicate failure via
success: false.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| web/src/lib/dashboards/DashboardRuntime.tsx | Adds a rejection handler to avoid unhandled promise rejections for fire-and-forget deploy mutation calls. |
| web/src/hooks/useWorkloads.ts | Treats { success: false } as failure for deploy/scale/delete mutations, preventing false-positive UI success. |
| web/src/hooks/tests/useWorkloads.test.ts | Adds tests for “HTTP 200 but success: false” failure scenarios for deploy/scale/delete hooks. |
…ss is not called on failure Signed-off-by: pulkitvats2007-crypto <[email protected]>
✅ Post-Merge Verification: passedCommit: |
…nhandled rejections (kubestellar#11114) * fix(workloads): handle silent propagation failures and unhandled rejections Signed-off-by: pulkitvats2007-crypto <[email protected]> * test: align success response mocks to object shape and assert onSuccess is not called on failure Signed-off-by: pulkitvats2007-crypto <[email protected]> --------- Signed-off-by: pulkitvats2007-crypto <[email protected]> Signed-off-by: lightyagami2109 <[email protected]>
📌 Fixes
Fixes #7993
📝 Summary of Changes
This PR fixes critical issues in workload orchestration where API failures were silently ignored and promise rejections were left unhandled, leading to misleading UI states and potential multi-cluster drift.
success: false) instead of relying solely on HTTP statusChanges Made
useDeployWorkload,useScaleWorkload, anduseDeleteWorkloadresult.success === falseand throw appropriate errorsonSuccesscallbacks on failed operationshandleDeployWorkloadby appending.catch(console.error)success: falsein deploy workflowsuccess: falsein scale workflowsuccess: falsein delete workflowChecklist
Please ensure the following before submitting your PR:
git commit -s)Screenshots or Logs (if applicable)
N/A (logic-level fix, no UI changes)
👀 Reviewer Notes
Root Issue:
Frontend hooks were incorrectly treating HTTP 200 responses as success, even when the backend explicitly returned
{ success: false }for failed multi-cluster propagation operations.Impact:
Fix Highlights:
result.successbefore invokingonSuccess.catch(...)Result:
Accurate error reporting, elimination of silent failures, and improved reliability of multi-cluster workload orchestration.