Skip to content

fix(workloads): catch silent multi-cluster propagation failures and unhandled rejections#11114

Merged
clubanderson merged 2 commits intokubestellar:mainfrom
pulkitvats2007-crypto:fix-unhandled-workload-failures
Apr 30, 2026
Merged

fix(workloads): catch silent multi-cluster propagation failures and unhandled rejections#11114
clubanderson merged 2 commits intokubestellar:mainfrom
pulkitvats2007-crypto:fix-unhandled-workload-failures

Conversation

@pulkitvats2007-crypto
Copy link
Copy Markdown
Contributor

📌 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.

  • Ensures frontend hooks validate logical API success (success: false) instead of relying solely on HTTP status
  • Prevents unhandled promise rejections in dashboard runtime
  • Adds comprehensive test coverage for failure scenarios

Changes Made

  • Fixed silent API failure handling in useDeployWorkload, useScaleWorkload, and useDeleteWorkload
  • Added validation for result.success === false and throw appropriate errors
  • Prevented false-positive onSuccess callbacks on failed operations
  • Fixed unhandled promise rejection in handleDeployWorkload by appending .catch(console.error)
  • Added unit tests for:
    • HTTP 200 OK + success: false in deploy workflow
    • HTTP 200 OK + success: false in scale workflow
    • HTTP 200 OK + success: false in delete workflow

Checklist

Please ensure the following before submitting your PR:


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:

  • False success notifications in UI ("Deployed successfully")
  • Silent configuration drift across clusters
  • Unhandled promise rejections causing instability in dashboard runtime

Fix Highlights:

  • Added explicit validation of result.success before invoking onSuccess
  • Errors are now properly thrown and propagated to UI
  • Ensured all async mutations are safely handled with .catch(...)

Result:
Accurate error reporting, elimination of silent failures, and improved reliability of multi-cluster workload orchestration.

Copilot AI review requested due to automatic review settings April 30, 2026 17:49
@kubestellar-prow
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign clubanderson for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Apr 30, 2026
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 30, 2026

Deploy Preview for kubestellarconsole ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 928957b
🔍 Latest deploy log https://app.netlify.com/projects/kubestellarconsole/deploys/69f398cd0a19530008753df5
😎 Deploy Preview https://deploy-preview-11114.console-deploy-preview.kubestellar.io
📱 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.

@github-actions
Copy link
Copy Markdown
Contributor

👋 Hey @pulkitvats2007-crypto — thanks for opening this PR!

🤖 This project is developed exclusively using AI coding assistants.

Please do not attempt to code anything for this project manually.
All contributions should be authored using an AI coding tool such as:

This ensures consistency in code style, architecture patterns, test coverage,
and commit quality across the entire codebase.


This is an automated message.

@kubestellar-prow kubestellar-prow Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Apr 30, 2026
@github-actions
Copy link
Copy Markdown
Contributor

👋 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:

  • DCO Sign-off — All commits signed with git commit -s (DCO)
  • PR Title — Starts with an emoji: ✨ feature | 🐛 bug fix | 📖 docs | 🌱 infra/tests | ⚠️ breaking

📬 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.

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

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 === false handling 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.

Comment thread web/src/hooks/__tests__/useWorkloads.test.ts
Comment thread web/src/hooks/__tests__/useWorkloads.test.ts
Comment thread web/src/hooks/__tests__/useWorkloads.test.ts
Comment thread web/src/hooks/useWorkloads.ts
Comment thread web/src/hooks/useWorkloads.ts
…ss is not called on failure

Signed-off-by: pulkitvats2007-crypto <[email protected]>
@kubestellar-prow kubestellar-prow Bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 30, 2026
@clubanderson clubanderson merged commit 61c57e8 into kubestellar:main Apr 30, 2026
35 of 36 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

✅ Post-Merge Verification: passed

Commit: 61c57e80948293d8d9fc0bafd9296da46a26fe15
Specs run: smoke.spec.ts
Report: https://github.com/kubestellar/console/actions/runs/25181787198

lightyagami2109 pushed a commit to lightyagami2109/kubestellar_console_OJT that referenced this pull request May 3, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the DCO. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. tier/2-standard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: backend pod SA must not be used for user-initiated k8s actions (umbrella — was CheckCanI)

3 participants