Skip to content

fix: allow deleting organization with failed invoices#3055

Merged
lohanidamodar merged 1 commit into
mainfrom
fix-CLO-4155-drop-failed-invoice-delete-org-check
May 21, 2026
Merged

fix: allow deleting organization with failed invoices#3055
lohanidamodar merged 1 commit into
mainfrom
fix-CLO-4155-drop-failed-invoice-delete-org-check

Conversation

@lohanidamodar
Copy link
Copy Markdown
Member

Summary

The cloud backend was updated to cancel pending/failed invoices when an organization is deleted, instead of throwing BILLING_INVOICE_PENDING. The console, however, still gated the delete modal via the unpaid-invoices branch of the estimationDeleteOrganization endpoint, which rendered an alternate view without the organization-name confirmation input. That left the Delete button permanently disabled for any org that had a failed or pending invoice, even though the backend was perfectly happy to proceed.

This PR drops that frontend gate so the confirm-name form always renders. The backend takes care of cancelling failed invoices server-side as part of the delete.

  • Remove the estimation-based branch in deleteOrganizationModal.svelte and the now-unused estimation fetch / import / state.
  • Delete the dead deleteOrganizationEstimation.svelte component (only consumer was the modal).
  • Preserve the informational upcomingInvoice Alert and the invoices prop — they remain in use.

Test plan

  • Open an organization with a failed / pending invoice (cloud only) and confirm the delete modal renders the org-name confirmation input.
  • Type the organization name and confirm the Delete button enables and submits successfully (backend cancels the failed invoice and deletes the org).
  • Open an organization with an upcoming-cycle invoice and confirm the informational warning Alert still renders above the confirm input.
  • Open an organization with no projects and confirm the modal renders the description + confirm input (no tabs / table).
  • Open an organization with projects and confirm the Projects / Members tabs render as before.

The cloud backend (already merged) now cancels pending/failed invoices on
organization delete instead of throwing BILLING_INVOICE_PENDING. The
console was still gating the delete modal via the unpaid-invoices branch
of the delete-estimation endpoint, which rendered an alternate view
without the org-name confirmation input and left the Delete button
permanently disabled.

Drop the estimation-based gate (and the now-unused estimation fetch,
component, and import) so the confirm-name form always renders. The
backend will cancel any failed invoices server-side as part of the
delete. The informational upcoming-invoice Alert is preserved.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 21, 2026

Greptile Summary

Removes the frontend gate that prevented deletion of organizations with failed or pending invoices. The backend now cancels such invoices server-side during org deletion, so the estimation-fetch branch and its DeleteOrganizationEstimation component are no longer needed.

  • deleteOrganizationModal.svelte: drops getEstimate(), the estimation state, and the conditional branch that swapped in the estimation component — the confirm-name input and tabs now always render when the modal opens.
  • deleteOrganizationEstimation.svelte: deleted in full; it had no other consumers and its warning about "unresolved invoices" is no longer accurate given the backend behaviour change.
  • The invoices prop and the informational upcomingInvoice Alert for active billing cycles are unchanged.

Confidence Score: 5/5

Safe to merge — the change removes a frontend gate that was already inconsistent with backend behaviour, and all remaining imports and reactive state are still correctly wired.

The diff is a targeted removal of dead code: the estimation fetch, its state variable, and the component that rendered an unresolvable 'must settle invoices' block. The confirm-name input and the upcoming-invoice Alert that remain are unchanged and still function correctly. No new logic was introduced.

No files require special attention.

Important Files Changed

Filename Overview
src/routes/(console)/organization-[organization]/settings/deleteOrganizationModal.svelte Removes the estimation-based gate and getEstimate() call; the confirm-name input and Delete button now always render. The upcomingInvoice Alert and invoices prop are preserved. All remaining imports are still used.
src/routes/(console)/organization-[organization]/settings/deleteOrganizationEstimation.svelte Component deleted entirely; it was the sole consumer of the unpaid-invoices branch that blocked deletion. Safe to remove given the backend now handles invoice cancellation server-side.

Reviews (1): Last reviewed commit: "fix: allow deleting organization with fa..." | Re-trigger Greptile

@lohanidamodar lohanidamodar merged commit 111583e into main May 21, 2026
4 checks passed
@lohanidamodar lohanidamodar deleted the fix-CLO-4155-drop-failed-invoice-delete-org-check branch May 21, 2026 06:17
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.

2 participants