From c1727b267d119cba1b8a5ddfe5af5845bd592d8b Mon Sep 17 00:00:00 2001 From: bymyself Date: Sun, 9 Aug 2026 04:36:59 +0000 Subject: [PATCH 1/9] fix(billing): resolve terminal promise even if success side effects throw A thrown error in the success-path side-effects block (dialog close, settings show, or toast add) silently skips resolveTerminal, leaving any caller awaiting startOperation() hanging forever. poll()'s catch-all swallowed the exception, masking the hang. Adds a try/finally so resolveTerminal runs unconditionally after the success side-effects block. Adds a regression test that throws from the second mockToastAdd call and asserts the terminal promise still resolves to succeeded. Found in the review of #14421. --- .../stores/billingOperationStore.test.ts | 19 ++++++++++ .../workspace/stores/billingOperationStore.ts | 38 ++++++++++--------- 2 files changed, 39 insertions(+), 18 deletions(-) diff --git a/src/platform/workspace/stores/billingOperationStore.test.ts b/src/platform/workspace/stores/billingOperationStore.test.ts index 2c91f1b9c0d..52cfb296d2b 100644 --- a/src/platform/workspace/stores/billingOperationStore.test.ts +++ b/src/platform/workspace/stores/billingOperationStore.test.ts @@ -717,6 +717,25 @@ describe('billingOperationStore', () => { expect(mockToastRemove).toHaveBeenCalledWith(receivedToast) }) + + it('resolves the terminal promise even if a success side effect throws', async () => { + vi.mocked(workspaceApi.getBillingOpStatus).mockResolvedValue({ + id: 'op-1', + status: 'succeeded', + started_at: new Date().toISOString() + }) + mockToastAdd.mockImplementationOnce(() => {}) + mockToastAdd.mockImplementationOnce(() => { + throw new Error('toast rendering failed') + }) + + const store = useBillingOperationStore() + const terminal = store.startOperation('op-1', 'topup') + + await vi.advanceTimersByTimeAsync(0) + + await expect(terminal).resolves.toMatchObject({ status: 'succeeded' }) + }) }) describe('polling failure', () => { diff --git a/src/platform/workspace/stores/billingOperationStore.ts b/src/platform/workspace/stores/billingOperationStore.ts index be266006638..3ddca69c315 100644 --- a/src/platform/workspace/stores/billingOperationStore.ts +++ b/src/platform/workspace/stores/billingOperationStore.ts @@ -711,26 +711,28 @@ export const useBillingOperationStore = defineStore('billingOperation', () => { return } - // A subscription checkout shows its own success step in the pricing dialog, - // so leave it open. Top-ups have no such step: close and surface settings. - if (operation.type === 'topup') { - useDialogStore().closeDialog({ key: 'top-up-credits' }) - useSettingsDialog().show(isCloud ? 'workspace' : 'credits') - } - - const toastStore = useToastStore() - const messageKey = - operation.type === 'subscription' - ? 'billingOperation.subscriptionSuccess' - : 'billingOperation.topupSuccess' + try { + // A subscription checkout shows its own success step in the pricing dialog, + // so leave it open. Top-ups have no such step: close and surface settings. + if (operation.type === 'topup') { + useDialogStore().closeDialog({ key: 'top-up-credits' }) + useSettingsDialog().show(isCloud ? 'workspace' : 'credits') + } - toastStore.add({ - severity: 'success', - summary: t(messageKey), - life: 5000 - }) + const toastStore = useToastStore() + const messageKey = + operation.type === 'subscription' + ? 'billingOperation.subscriptionSuccess' + : 'billingOperation.topupSuccess' - resolveTerminal(opId) + toastStore.add({ + severity: 'success', + summary: t(messageKey), + life: 5000 + }) + } finally { + resolveTerminal(opId) + } } function handleFailure(opId: string, errorMessage: string | null) { From 32290acc2c41e84e4d1700a30f71ab730c461ea1 Mon Sep 17 00:00:00 2001 From: bymyself Date: Tue, 11 Aug 2026 22:13:48 +0000 Subject: [PATCH 2/9] fix(billing): extend try/finally to cover all post-success side effects The cancel path's updateActiveWorkspace call and dialog/toast calls are now all guarded by the same try/finally, so resolveTerminal fires even if any synchronous side effect throws. --- .../workspace/stores/billingOperationStore.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/platform/workspace/stores/billingOperationStore.ts b/src/platform/workspace/stores/billingOperationStore.ts index 3ddca69c315..495ddeb4646 100644 --- a/src/platform/workspace/stores/billingOperationStore.ts +++ b/src/platform/workspace/stores/billingOperationStore.ts @@ -705,13 +705,12 @@ export const useBillingOperationStore = defineStore('billingOperation', () => { ]) } - if (operation.type === 'cancel') { - useTeamWorkspaceStore().updateActiveWorkspace({ isSubscribed: false }) - resolveTerminal(opId) - return - } - try { + if (operation.type === 'cancel') { + useTeamWorkspaceStore().updateActiveWorkspace({ isSubscribed: false }) + return + } + // A subscription checkout shows its own success step in the pricing dialog, // so leave it open. Top-ups have no such step: close and surface settings. if (operation.type === 'topup') { From f7147f81c6d9581ea4c86edca6b5eae9288de9d6 Mon Sep 17 00:00:00 2001 From: bymyself Date: Tue, 11 Aug 2026 22:28:36 +0000 Subject: [PATCH 3/9] fix(billing): move try/finally to cover cleanup, telemetry, and reconciliation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit resolveTerminal now fires even if any synchronous side effect in handleSuccess throws — including cleanup, telemetry dispatches, billing context reconciliation, or the cancel workspace update. Adds a regression test verifying the terminal promise resolves when reconcileSubscriptionSuccess throws synchronously. --- .../stores/billingOperationStore.test.ts | 18 +++ .../workspace/stores/billingOperationStore.ts | 145 +++++++++--------- 2 files changed, 91 insertions(+), 72 deletions(-) diff --git a/src/platform/workspace/stores/billingOperationStore.test.ts b/src/platform/workspace/stores/billingOperationStore.test.ts index 52cfb296d2b..a1463a2bd69 100644 --- a/src/platform/workspace/stores/billingOperationStore.test.ts +++ b/src/platform/workspace/stores/billingOperationStore.test.ts @@ -736,6 +736,24 @@ describe('billingOperationStore', () => { await expect(terminal).resolves.toMatchObject({ status: 'succeeded' }) }) + + it('resolves the terminal promise even if reconciliation throws synchronously', async () => { + vi.mocked(workspaceApi.getBillingOpStatus).mockResolvedValue({ + id: 'op-1', + status: 'succeeded', + started_at: new Date().toISOString() + }) + mockReconcileSubscriptionSuccess.mockImplementationOnce(() => { + throw new Error('reconcile failed') + }) + + const store = useBillingOperationStore() + const terminal = store.startOperation('op-1', 'subscription') + + await vi.advanceTimersByTimeAsync(0) + + await expect(terminal).resolves.toMatchObject({ status: 'succeeded' }) + }) }) describe('polling failure', () => { diff --git a/src/platform/workspace/stores/billingOperationStore.ts b/src/platform/workspace/stores/billingOperationStore.ts index 495ddeb4646..e36bb58b244 100644 --- a/src/platform/workspace/stores/billingOperationStore.ts +++ b/src/platform/workspace/stores/billingOperationStore.ts @@ -616,96 +616,97 @@ export const useBillingOperationStore = defineStore('billingOperation', () => { if (!operation) return updateOperationStatus(opId, 'succeeded', null) - cleanup(opId) - const telemetry = useTelemetry() - const now = Date.now() - const operationDurationMs = now - operation.operationStartedAt - telemetry?.trackBillingEvent({ - operation: 'operation', - stage: 'succeeded', - outcome: 'success', - billing_op_id: opId, - operation_type: operation.type, - tier: operation.tier, - cycle: operation.cycle, - checkout_type: operation.checkoutType, - payment_intent_source: operation.paymentIntentSource, - duration_ms: operationDurationMs - }) + try { + cleanup(opId) - if ( - operation.type === 'subscription' && - operation.businessAttemptStartedAt !== undefined - ) { - const durationMs = now - operation.businessAttemptStartedAt + const telemetry = useTelemetry() + const now = Date.now() + const operationDurationMs = now - operation.operationStartedAt telemetry?.trackBillingEvent({ - operation: 'subscription_checkout', + operation: 'operation', stage: 'succeeded', outcome: 'success', + billing_op_id: opId, + operation_type: operation.type, tier: operation.tier, cycle: operation.cycle, checkout_type: operation.checkoutType, payment_intent_source: operation.paymentIntentSource, - billing_op_id: opId, - duration_ms: durationMs + duration_ms: operationDurationMs }) - // Also fires the legacy event for providers (Mixpanel, GTM) that don't - // implement trackBillingEvent. Gated to actual new/upgraded - // subscriptions — a downgrade-to-personal is churn, not a conversion, - // and this event drives a GA4 "subscription succeeded" conversion goal. - if (!operation.downgradeToPersonal) { - telemetry?.trackMonthlySubscriptionSucceeded({ + + if ( + operation.type === 'subscription' && + operation.businessAttemptStartedAt !== undefined + ) { + const durationMs = now - operation.businessAttemptStartedAt + telemetry?.trackBillingEvent({ + operation: 'subscription_checkout', + stage: 'succeeded', + outcome: 'success', tier: operation.tier, cycle: operation.cycle, checkout_type: operation.checkoutType, payment_intent_source: operation.paymentIntentSource, - billing_op_id: opId + billing_op_id: opId, + duration_ms: durationMs + }) + // Also fires the legacy event for providers (Mixpanel, GTM) that don't + // implement trackBillingEvent. Gated to actual new/upgraded + // subscriptions — a downgrade-to-personal is churn, not a conversion, + // and this event drives a GA4 "subscription succeeded" conversion goal. + if (!operation.downgradeToPersonal) { + telemetry?.trackMonthlySubscriptionSucceeded({ + tier: operation.tier, + cycle: operation.cycle, + checkout_type: operation.checkoutType, + payment_intent_source: operation.paymentIntentSource, + billing_op_id: opId + }) + } + } else if ( + operation.type === 'topup' && + operation.businessAttemptStartedAt !== undefined + ) { + telemetry?.trackBillingEvent({ + operation: 'topup', + stage: 'succeeded', + outcome: 'success', + billing_op_id: opId, + duration_ms: now - operation.businessAttemptStartedAt + }) + } + // Mirrors handleFailure's structure: not gated on businessAttemptStartedAt, + // since a downgrade always has its own startedAt for duration_ms below. + if (operation.downgradeToPersonal) { + telemetry?.trackBillingEvent({ + operation: 'downgrade_to_personal', + stage: 'succeeded', + outcome: 'success', + member_removal_count: operation.downgradeToPersonal.memberRemovalCount, + member_removal_failures: + operation.downgradeToPersonal.memberRemovalFailures, + target_tier: operation.downgradeToPersonal.targetTier, + duration_ms: now - operation.downgradeToPersonal.startedAt }) } - } else if ( - operation.type === 'topup' && - operation.businessAttemptStartedAt !== undefined - ) { - telemetry?.trackBillingEvent({ - operation: 'topup', - stage: 'succeeded', - outcome: 'success', - billing_op_id: opId, - duration_ms: now - operation.businessAttemptStartedAt - }) - } - // Mirrors handleFailure's structure: not gated on businessAttemptStartedAt, - // since a downgrade always has its own startedAt for duration_ms below. - if (operation.downgradeToPersonal) { - telemetry?.trackBillingEvent({ - operation: 'downgrade_to_personal', - stage: 'succeeded', - outcome: 'success', - member_removal_count: operation.downgradeToPersonal.memberRemovalCount, - member_removal_failures: - operation.downgradeToPersonal.memberRemovalFailures, - target_tier: operation.downgradeToPersonal.targetTier, - duration_ms: now - operation.downgradeToPersonal.startedAt - }) - } - const billingContext = useBillingContext() - const capabilities = useBillingCapabilities() - if (operation.type === 'subscription') { - await Promise.allSettled([ - billingContext.reconcileSubscriptionSuccess(), - capabilities.refresh() - ]) - } else { - await Promise.allSettled([ - billingContext.fetchStatus(), - billingContext.fetchBalance(), - capabilities.refresh() - ]) - } + const billingContext = useBillingContext() + const capabilities = useBillingCapabilities() + if (operation.type === 'subscription') { + await Promise.allSettled([ + billingContext.reconcileSubscriptionSuccess(), + capabilities.refresh() + ]) + } else { + await Promise.allSettled([ + billingContext.fetchStatus(), + billingContext.fetchBalance(), + capabilities.refresh() + ]) + } - try { if (operation.type === 'cancel') { useTeamWorkspaceStore().updateActiveWorkspace({ isSubscribed: false }) return From 5b607f427fbe96720a5d80870dcdb651f62d2736 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Tue, 11 Aug 2026 22:31:42 +0000 Subject: [PATCH 4/9] [automated] Apply ESLint and Oxfmt fixes --- src/platform/workspace/stores/billingOperationStore.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/platform/workspace/stores/billingOperationStore.ts b/src/platform/workspace/stores/billingOperationStore.ts index e36bb58b244..d1e81a7c2ce 100644 --- a/src/platform/workspace/stores/billingOperationStore.ts +++ b/src/platform/workspace/stores/billingOperationStore.ts @@ -684,7 +684,8 @@ export const useBillingOperationStore = defineStore('billingOperation', () => { operation: 'downgrade_to_personal', stage: 'succeeded', outcome: 'success', - member_removal_count: operation.downgradeToPersonal.memberRemovalCount, + member_removal_count: + operation.downgradeToPersonal.memberRemovalCount, member_removal_failures: operation.downgradeToPersonal.memberRemovalFailures, target_tier: operation.downgradeToPersonal.targetTier, From 08893ef2e96abfacd21df0015087d6001bb4bcac Mon Sep 17 00:00:00 2001 From: bymyself Date: Tue, 1 Sep 2026 08:36:30 +0000 Subject: [PATCH 5/9] fix(billing): log success handling failures Addresses review feedback: https://github.com/Comfy-Org/ComfyUI_frontend/pull/14964#discussion_r3762206692 --- .../workspace/stores/billingOperationStore.test.ts | 11 ++++++++++- .../workspace/stores/billingOperationStore.ts | 3 +++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/platform/workspace/stores/billingOperationStore.test.ts b/src/platform/workspace/stores/billingOperationStore.test.ts index a1463a2bd69..1f12ba7dfab 100644 --- a/src/platform/workspace/stores/billingOperationStore.test.ts +++ b/src/platform/workspace/stores/billingOperationStore.test.ts @@ -724,9 +724,13 @@ describe('billingOperationStore', () => { status: 'succeeded', started_at: new Date().toISOString() }) + const error = new Error('toast rendering failed') + const consoleErrorSpy = vi + .spyOn(console, 'error') + .mockImplementation(() => {}) mockToastAdd.mockImplementationOnce(() => {}) mockToastAdd.mockImplementationOnce(() => { - throw new Error('toast rendering failed') + throw error }) const store = useBillingOperationStore() @@ -735,6 +739,11 @@ describe('billingOperationStore', () => { await vi.advanceTimersByTimeAsync(0) await expect(terminal).resolves.toMatchObject({ status: 'succeeded' }) + expect(consoleErrorSpy).toHaveBeenCalledWith( + 'Billing operation op-1 success handling failed', + error + ) + consoleErrorSpy.mockRestore() }) it('resolves the terminal promise even if reconciliation throws synchronously', async () => { diff --git a/src/platform/workspace/stores/billingOperationStore.ts b/src/platform/workspace/stores/billingOperationStore.ts index d1e81a7c2ce..f15b9f3ab5c 100644 --- a/src/platform/workspace/stores/billingOperationStore.ts +++ b/src/platform/workspace/stores/billingOperationStore.ts @@ -731,6 +731,9 @@ export const useBillingOperationStore = defineStore('billingOperation', () => { summary: t(messageKey), life: 5000 }) + } catch (error) { + console.error(`Billing operation ${opId} success handling failed`, error) + throw error } finally { resolveTerminal(opId) } From 50023ea07b0712ceded49fa77350e8c5ed0e1456 Mon Sep 17 00:00:00 2001 From: bymyself Date: Wed, 2 Sep 2026 00:33:04 +0000 Subject: [PATCH 6/9] fix(billing): report success-handler failures to Sentry, fix order-dependent toast test - captureException(error, {tags, extra}) instead of console.error, matching the sibling useWorkspaceBilling.ts convention. - Test targets the toast mock by severity instead of call order, so it still catches the right failure if a third toast.add call is introduced. Addresses https://github.com/Comfy-Org/ComfyUI_frontend/pull/14964#discussion_r3902349251 Addresses https://github.com/Comfy-Org/ComfyUI_frontend/pull/14964#discussion_r3902349242 --- .../stores/billingOperationStore.test.ts | 23 ++++++++++--------- .../workspace/stores/billingOperationStore.ts | 6 ++++- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/platform/workspace/stores/billingOperationStore.test.ts b/src/platform/workspace/stores/billingOperationStore.test.ts index 1f12ba7dfab..d42664158f8 100644 --- a/src/platform/workspace/stores/billingOperationStore.test.ts +++ b/src/platform/workspace/stores/billingOperationStore.test.ts @@ -53,6 +53,12 @@ vi.mock('@/platform/updates/common/toastStore', () => ({ }) })) +const mockCaptureException = vi.hoisted(() => vi.fn()) + +vi.mock('@sentry/vue', () => ({ + captureException: mockCaptureException +})) + vi.mock('@/platform/workspace/api/workspaceApi', () => ({ workspaceApi: { getBillingOpStatus: vi.fn() @@ -725,12 +731,8 @@ describe('billingOperationStore', () => { started_at: new Date().toISOString() }) const error = new Error('toast rendering failed') - const consoleErrorSpy = vi - .spyOn(console, 'error') - .mockImplementation(() => {}) - mockToastAdd.mockImplementationOnce(() => {}) - mockToastAdd.mockImplementationOnce(() => { - throw error + mockToastAdd.mockImplementation((toast: { severity: string }) => { + if (toast.severity === 'success') throw error }) const store = useBillingOperationStore() @@ -739,11 +741,10 @@ describe('billingOperationStore', () => { await vi.advanceTimersByTimeAsync(0) await expect(terminal).resolves.toMatchObject({ status: 'succeeded' }) - expect(consoleErrorSpy).toHaveBeenCalledWith( - 'Billing operation op-1 success handling failed', - error - ) - consoleErrorSpy.mockRestore() + expect(mockCaptureException).toHaveBeenCalledWith(error, { + tags: { error_type: 'billing_success_handling_failed' }, + extra: { billing_op_id: 'op-1' } + }) }) it('resolves the terminal promise even if reconciliation throws synchronously', async () => { diff --git a/src/platform/workspace/stores/billingOperationStore.ts b/src/platform/workspace/stores/billingOperationStore.ts index f15b9f3ab5c..1737847354e 100644 --- a/src/platform/workspace/stores/billingOperationStore.ts +++ b/src/platform/workspace/stores/billingOperationStore.ts @@ -1,3 +1,4 @@ +import { captureException } from '@sentry/vue' import type { ToastMessageOptions } from 'primevue/toast' import { loadStripe } from '@stripe/stripe-js/pure' import { useEventListener } from '@vueuse/core' @@ -732,7 +733,10 @@ export const useBillingOperationStore = defineStore('billingOperation', () => { life: 5000 }) } catch (error) { - console.error(`Billing operation ${opId} success handling failed`, error) + captureException(error, { + tags: { error_type: 'billing_success_handling_failed' }, + extra: { billing_op_id: opId } + }) throw error } finally { resolveTerminal(opId) From 2a8ea4c11127408a284dba83bb3af57f34ce146e Mon Sep 17 00:00:00 2001 From: bymyself Date: Thu, 3 Sep 2026 15:39:41 +0000 Subject: [PATCH 7/9] fix(billing): report success handler failures to all sinks Addresses review feedback: https://github.com/Comfy-Org/ComfyUI_frontend/pull/14964#discussion_r3919366360 --- .../workspace/stores/billingOperationStore.test.ts | 12 ++++++------ .../workspace/stores/billingOperationStore.ts | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/platform/workspace/stores/billingOperationStore.test.ts b/src/platform/workspace/stores/billingOperationStore.test.ts index d42664158f8..f6771c77088 100644 --- a/src/platform/workspace/stores/billingOperationStore.test.ts +++ b/src/platform/workspace/stores/billingOperationStore.test.ts @@ -53,10 +53,10 @@ vi.mock('@/platform/updates/common/toastStore', () => ({ }) })) -const mockCaptureException = vi.hoisted(() => vi.fn()) +const mockReportError = vi.hoisted(() => vi.fn()) -vi.mock('@sentry/vue', () => ({ - captureException: mockCaptureException +vi.mock('@/platform/telemetry/reportError', () => ({ + reportError: mockReportError })) vi.mock('@/platform/workspace/api/workspaceApi', () => ({ @@ -741,9 +741,9 @@ describe('billingOperationStore', () => { await vi.advanceTimersByTimeAsync(0) await expect(terminal).resolves.toMatchObject({ status: 'succeeded' }) - expect(mockCaptureException).toHaveBeenCalledWith(error, { - tags: { error_type: 'billing_success_handling_failed' }, - extra: { billing_op_id: 'op-1' } + expect(mockReportError).toHaveBeenCalledWith(error, { + errorType: 'billing_success_handling_failed', + context: { billing_op_id: 'op-1' } }) }) diff --git a/src/platform/workspace/stores/billingOperationStore.ts b/src/platform/workspace/stores/billingOperationStore.ts index 1737847354e..7046ff9f71c 100644 --- a/src/platform/workspace/stores/billingOperationStore.ts +++ b/src/platform/workspace/stores/billingOperationStore.ts @@ -1,4 +1,3 @@ -import { captureException } from '@sentry/vue' import type { ToastMessageOptions } from 'primevue/toast' import { loadStripe } from '@stripe/stripe-js/pure' import { useEventListener } from '@vueuse/core' @@ -13,6 +12,7 @@ import type { BillingCycle } from '@/platform/cloud/subscription/utils/subscript import { useSettingsDialog } from '@/platform/settings/composables/useSettingsDialog' import { isCloud } from '@/platform/distribution/types' import { useTelemetry } from '@/platform/telemetry' +import { reportError } from '@/platform/telemetry/reportError' import type { BillingFailure, PaymentIntentSource, @@ -733,9 +733,9 @@ export const useBillingOperationStore = defineStore('billingOperation', () => { life: 5000 }) } catch (error) { - captureException(error, { - tags: { error_type: 'billing_success_handling_failed' }, - extra: { billing_op_id: opId } + reportError(error, { + errorType: 'billing_success_handling_failed', + context: { billing_op_id: opId } }) throw error } finally { From 6f7ea6c0e522d322c8f5b10f9cd39ef5db48071c Mon Sep 17 00:00:00 2001 From: bymyself Date: Thu, 3 Sep 2026 15:42:34 +0000 Subject: [PATCH 8/9] test(billing): cover cleanup failures after success Addresses review feedback: https://github.com/Comfy-Org/ComfyUI_frontend/pull/14964#discussion_r3919366367 --- .../stores/billingOperationStore.test.ts | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/platform/workspace/stores/billingOperationStore.test.ts b/src/platform/workspace/stores/billingOperationStore.test.ts index f6771c77088..40b060a05fa 100644 --- a/src/platform/workspace/stores/billingOperationStore.test.ts +++ b/src/platform/workspace/stores/billingOperationStore.test.ts @@ -747,6 +747,29 @@ describe('billingOperationStore', () => { }) }) + it('resolves the terminal promise even if cleanup throws', async () => { + vi.mocked(workspaceApi.getBillingOpStatus).mockResolvedValue({ + id: 'op-1', + status: 'succeeded', + started_at: new Date().toISOString() + }) + const error = new Error('toast cleanup failed') + mockToastRemove.mockImplementationOnce(() => { + throw error + }) + + const store = useBillingOperationStore() + const terminal = store.startOperation('op-1', 'subscription') + + await vi.advanceTimersByTimeAsync(0) + + await expect(terminal).resolves.toMatchObject({ status: 'succeeded' }) + expect(mockReportError).toHaveBeenCalledWith(error, { + errorType: 'billing_success_handling_failed', + context: { billing_op_id: 'op-1' } + }) + }) + it('resolves the terminal promise even if reconciliation throws synchronously', async () => { vi.mocked(workspaceApi.getBillingOpStatus).mockResolvedValue({ id: 'op-1', From dabc3c9984987dea69c82f87f1f7b3d3ed390a73 Mon Sep 17 00:00:00 2001 From: christian-byrne Date: Fri, 11 Sep 2026 02:20:30 -0700 Subject: [PATCH 9/9] fix(billing): name the success-handler errorType per the slug convention main's src/AGENTS.md now specifies __ with the operation as a present participle, matching failure_initializing_workspace_auth_gate and failure_loading_node_templates. billing_success_handling_failed predated that section and has never shipped, so rename it rather than add a synonym. Addresses review feedback: https://github.com/Comfy-Org/ComfyUI_frontend/pull/14964#discussion_r3919366360 --- src/platform/workspace/stores/billingOperationStore.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platform/workspace/stores/billingOperationStore.ts b/src/platform/workspace/stores/billingOperationStore.ts index ac902bea175..939bc1988a0 100644 --- a/src/platform/workspace/stores/billingOperationStore.ts +++ b/src/platform/workspace/stores/billingOperationStore.ts @@ -788,7 +788,7 @@ export const useBillingOperationStore = defineStore('billingOperation', () => { }) } catch (error) { reportError(error, { - errorType: 'billing_success_handling_failed', + errorType: 'failure_handling_billing_operation_success', context: { billing_op_id: opId } }) throw error