From 5710e66946c56135a7d0cd18189151d73afdb5e2 Mon Sep 17 00:00:00 2001 From: dante01yoon Date: Sat, 14 Nov 2026 03:06:58 -0500 Subject: [PATCH 1/2] chore(ingest-types): sync from cloud@9d3282f6 and fix the type fallout Take the generated output of the bot sync (update-ingest-types at d4a238ccc7) unchanged. It adds GET /api/billing/ops/{id}/outcome (BillingOpOutcomeResponse) and makes three response fields required: capabilities.can_set_budgets, capabilities.can_set_hard_caps, and auto_top_up_conflict on the auto top-up settings. Fixtures and mocks that build those responses gain the new fields as false, the value ingest serves when billing-api omits them. No code reads them yet. CapabilityDenialReason gains plan_not_enterprise, the one new denial reason, so the client union equals the server union again. Billing web maps it to the generic refusal copy, which an unrecognized reason already gets. --- apps/billing-web/e2e/fixtures/scenario.ts | 2 + apps/billing-web/src/checkout/endingScreen.ts | 1 + .../billing-web/src/test/fakeBillingClient.ts | 2 + .../fixtures/data/autoTopUpAtCheckout.ts | 1 + .../fixtures/data/billingCapabilities.ts | 2 + .../addCredits/addCreditsAutoTopUp.test.ts | 1 + .../src/core/billing/autoTopUp.test.ts | 1 + .../billing/billingTab/autoTopUpCard.test.ts | 1 + .../src/core/billing/capabilities.test.ts | 2 + .../billing/capabilitiesCrossUser.test.ts | 2 + .../src/core/billing/capabilityDenials.ts | 2 + .../billingCapabilities.contract.test.ts | 4 + .../src/core/billing/scopedReader.test.ts | 3 + .../src/core/billing/topup.test.ts | 2 + .../billing/__fixtures__/billingHarness.ts | 2 + .../tab/__fixtures__/autoTopUpSettings.ts | 1 + packages/ingest-types/src/index.ts | 12 +- packages/ingest-types/src/types.gen.ts | 316 ++++++++++++++++-- packages/ingest-types/src/zod.gen.ts | 56 +++- src/platform/auth/webSessionFlagOff.test.ts | 2 + src/platform/auth/webSessionFlagOn.test.ts | 2 + .../billing/api/__mocks__/billingApi.ts | 3 + .../__mocks__/useBillingAutoTopUpCard.ts | 1 + .../useAutoTopUpCardSection.test.ts | 1 + .../useBillingAutoTopUpCard.test.ts | 1 + .../useBillingCapabilities.crossUser.test.ts | 2 + .../useBillingCapabilities.test.ts | 4 + .../useCreditBanner.capabilities.test.ts | 2 + .../billingTab/BillingAutoTopUpCard.test.ts | 1 + ...lingLocalCreditBanner.capabilities.test.ts | 2 + .../useBillingAutoTopUpCard.test.ts | 1 + .../sdk/billingCapabilitiesView.test.ts | 2 + .../sdk/billingSdkTelemetryOwnership.test.ts | 2 + .../billing/sdk/createBillingSdk.test.ts | 2 + .../workspaceTelemetryContext.test.ts | 2 + 35 files changed, 395 insertions(+), 48 deletions(-) diff --git a/apps/billing-web/e2e/fixtures/scenario.ts b/apps/billing-web/e2e/fixtures/scenario.ts index bc1fc2a3ab1..dbcf0548823 100644 --- a/apps/billing-web/e2e/fixtures/scenario.ts +++ b/apps/billing-web/e2e/fixtures/scenario.ts @@ -58,6 +58,8 @@ export function capabilitiesWith( can_reactivate: false, can_revert_scheduled_change: false, can_run_workflows: true, + can_set_budgets: false, + can_set_hard_caps: false, can_subscribe_self_serve: true, can_top_up: true, can_upgrade: true, diff --git a/apps/billing-web/src/checkout/endingScreen.ts b/apps/billing-web/src/checkout/endingScreen.ts index 1c541f77c07..a43d39b67a5 100644 --- a/apps/billing-web/src/checkout/endingScreen.ts +++ b/apps/billing-web/src/checkout/endingScreen.ts @@ -68,6 +68,7 @@ const REFUSAL_COPY: Readonly> = { no_upgrade_available: 'unknown', partner_governance_not_entitled: 'unknown', plan_ending: 'unknown', + plan_not_enterprise: 'unknown', project_cap_exceeded: 'unknown', rollout_disabled: 'unknown', sales_managed: 'sales_managed', diff --git a/apps/billing-web/src/test/fakeBillingClient.ts b/apps/billing-web/src/test/fakeBillingClient.ts index 9efef9e60f3..163d30240d1 100644 --- a/apps/billing-web/src/test/fakeBillingClient.ts +++ b/apps/billing-web/src/test/fakeBillingClient.ts @@ -250,6 +250,8 @@ export function createFakeBillingClient( can_reactivate: false, can_revert_scheduled_change: false, can_run_workflows: false, + can_set_budgets: false, + can_set_hard_caps: false, can_subscribe_self_serve: false, can_top_up: false, can_upgrade: false, diff --git a/browser_tests/fixtures/data/autoTopUpAtCheckout.ts b/browser_tests/fixtures/data/autoTopUpAtCheckout.ts index 7a7876ba28c..3e5beab5efc 100644 --- a/browser_tests/fixtures/data/autoTopUpAtCheckout.ts +++ b/browser_tests/fixtures/data/autoTopUpAtCheckout.ts @@ -29,6 +29,7 @@ export const FIFTY_DOLLAR_QUOTE: TopupQuoteResponse = { } export const AUTO_TOP_UP_OFF: AutoReloadSettings = { + auto_top_up_conflict: false, card_expiry: null, configured: false, cycle_resets_at: null, diff --git a/browser_tests/fixtures/data/billingCapabilities.ts b/browser_tests/fixtures/data/billingCapabilities.ts index bc87933743c..ab16b66c13f 100644 --- a/browser_tests/fixtures/data/billingCapabilities.ts +++ b/browser_tests/fixtures/data/billingCapabilities.ts @@ -35,6 +35,8 @@ export function createBillingCapabilities( can_manage_subscription: true, can_open_plans: true, can_run_workflows: false, + can_set_budgets: false, + can_set_hard_caps: false, can_upgrade: false, can_reactivate: false, can_revert_scheduled_change: false, diff --git a/packages/account-core/src/core/billing/addCredits/addCreditsAutoTopUp.test.ts b/packages/account-core/src/core/billing/addCredits/addCreditsAutoTopUp.test.ts index c0fae7cc5aa..aa8a6065fc9 100644 --- a/packages/account-core/src/core/billing/addCredits/addCreditsAutoTopUp.test.ts +++ b/packages/account-core/src/core/billing/addCredits/addCreditsAutoTopUp.test.ts @@ -160,6 +160,7 @@ describe('autoTopUpActivationFor', () => { function settings(status: AutoReloadSettings['status']): AutoReloadSettings { return { + auto_top_up_conflict: false, card_expiry: null, configured: false, cycle_resets_at: null, diff --git a/packages/account-core/src/core/billing/autoTopUp.test.ts b/packages/account-core/src/core/billing/autoTopUp.test.ts index cfb6ec1515b..4570cd3b639 100644 --- a/packages/account-core/src/core/billing/autoTopUp.test.ts +++ b/packages/account-core/src/core/billing/autoTopUp.test.ts @@ -44,6 +44,7 @@ function fakeSession(initial: SessionSnapshot = authenticated(credential())) { } const SETTINGS = { + auto_top_up_conflict: false, card_expiring_soon: false, card_expiry: { expired: false, month: 4, year: 2030 }, configured: true, diff --git a/packages/account-core/src/core/billing/billingTab/autoTopUpCard.test.ts b/packages/account-core/src/core/billing/billingTab/autoTopUpCard.test.ts index a6032438a16..9f0245ff73f 100644 --- a/packages/account-core/src/core/billing/billingTab/autoTopUpCard.test.ts +++ b/packages/account-core/src/core/billing/billingTab/autoTopUpCard.test.ts @@ -14,6 +14,7 @@ import type { } from './autoTopUpCard' const settings: AutoReloadSettings = { + auto_top_up_conflict: false, card_expiry: null, configured: true, cycle_resets_at: null, diff --git a/packages/account-core/src/core/billing/capabilities.test.ts b/packages/account-core/src/core/billing/capabilities.test.ts index 749c7f96e50..1e52876eace 100644 --- a/packages/account-core/src/core/billing/capabilities.test.ts +++ b/packages/account-core/src/core/billing/capabilities.test.ts @@ -59,6 +59,8 @@ const CAPABILITIES = { can_manage_subscription: false, can_open_plans: false, can_run_workflows: false, + can_set_budgets: false, + can_set_hard_caps: false, can_upgrade: false, can_subscribe_self_serve: false, can_top_up: true diff --git a/packages/account-core/src/core/billing/capabilitiesCrossUser.test.ts b/packages/account-core/src/core/billing/capabilitiesCrossUser.test.ts index 3cfec94f5ef..371d23b2b65 100644 --- a/packages/account-core/src/core/billing/capabilitiesCrossUser.test.ts +++ b/packages/account-core/src/core/billing/capabilitiesCrossUser.test.ts @@ -71,6 +71,8 @@ const NO_RIGHTS: BillingCapabilities = { can_reactivate: false, can_revert_scheduled_change: false, can_run_workflows: false, + can_set_budgets: false, + can_set_hard_caps: false, can_subscribe_self_serve: false, can_top_up: false, can_upgrade: false diff --git a/packages/account-core/src/core/billing/capabilityDenials.ts b/packages/account-core/src/core/billing/capabilityDenials.ts index 46d7d729e29..4ecfe00c32c 100644 --- a/packages/account-core/src/core/billing/capabilityDenials.ts +++ b/packages/account-core/src/core/billing/capabilityDenials.ts @@ -55,6 +55,7 @@ export type CapabilityDenialReason = | 'no_upgrade_available' | 'partner_governance_not_entitled' | 'plan_ending' + | 'plan_not_enterprise' | 'project_cap_exceeded' | 'rollout_disabled' | 'sales_managed' @@ -107,6 +108,7 @@ const KNOWN_REASONS: Readonly< no_upgrade_available: true, partner_governance_not_entitled: true, plan_ending: true, + plan_not_enterprise: true, project_cap_exceeded: true, rollout_disabled: true, sales_managed: true, diff --git a/packages/account-core/src/core/billing/contracts/billingCapabilities.contract.test.ts b/packages/account-core/src/core/billing/contracts/billingCapabilities.contract.test.ts index 06f919328ed..574c1a861d7 100644 --- a/packages/account-core/src/core/billing/contracts/billingCapabilities.contract.test.ts +++ b/packages/account-core/src/core/billing/contracts/billingCapabilities.contract.test.ts @@ -39,6 +39,8 @@ function capabilities(): Capabilities { can_reactivate: false, can_revert_scheduled_change: false, can_run_workflows: true, + can_set_budgets: false, + can_set_hard_caps: false, can_subscribe_self_serve: true, can_top_up: true, can_upgrade: true @@ -81,6 +83,8 @@ expectTypeOf().toEqualTypeOf<{ can_reactivate: boolean can_revert_scheduled_change: boolean can_run_workflows: boolean + can_set_budgets: boolean + can_set_hard_caps: boolean can_subscribe_self_serve: boolean can_top_up: boolean can_upgrade: boolean diff --git a/packages/account-core/src/core/billing/scopedReader.test.ts b/packages/account-core/src/core/billing/scopedReader.test.ts index 5984ca3219b..655d9a10996 100644 --- a/packages/account-core/src/core/billing/scopedReader.test.ts +++ b/packages/account-core/src/core/billing/scopedReader.test.ts @@ -113,6 +113,7 @@ const PLAN = { } const AUTO_TOP_UP_OFF = { + auto_top_up_conflict: false, card_expiry: null, configured: false, cycle_resets_at: null, @@ -184,6 +185,8 @@ function capabilitiesBody(overrides: Record = {}) { can_manage_subscription: false, can_open_plans: false, can_run_workflows: false, + can_set_budgets: false, + can_set_hard_caps: false, can_upgrade: false, can_subscribe_self_serve: false, can_top_up: true diff --git a/packages/account-core/src/core/billing/topup.test.ts b/packages/account-core/src/core/billing/topup.test.ts index 919a9141e77..efbcb43a3c4 100644 --- a/packages/account-core/src/core/billing/topup.test.ts +++ b/packages/account-core/src/core/billing/topup.test.ts @@ -110,6 +110,8 @@ const CAPABILITIES = { can_manage_subscription: false, can_open_plans: false, can_run_workflows: false, + can_set_budgets: false, + can_set_hard_caps: false, can_upgrade: false, can_subscribe_self_serve: false, can_top_up: true diff --git a/packages/account-ui/src/billing/__fixtures__/billingHarness.ts b/packages/account-ui/src/billing/__fixtures__/billingHarness.ts index ef756298e9f..0da43e64945 100644 --- a/packages/account-ui/src/billing/__fixtures__/billingHarness.ts +++ b/packages/account-ui/src/billing/__fixtures__/billingHarness.ts @@ -131,6 +131,8 @@ export const CAPABILITIES = { can_manage_subscription: false, can_open_plans: false, can_run_workflows: false, + can_set_budgets: false, + can_set_hard_caps: false, can_upgrade: false, can_subscribe_self_serve: true, can_top_up: true diff --git a/packages/account-ui/src/billing/tab/__fixtures__/autoTopUpSettings.ts b/packages/account-ui/src/billing/tab/__fixtures__/autoTopUpSettings.ts index e4460272fcb..edd6e48ca5b 100644 --- a/packages/account-ui/src/billing/tab/__fixtures__/autoTopUpSettings.ts +++ b/packages/account-ui/src/billing/tab/__fixtures__/autoTopUpSettings.ts @@ -6,6 +6,7 @@ type AutoReloadSettings = Extract< >['settings'] export const configuredSettings: AutoReloadSettings = { + auto_top_up_conflict: false, card_expiry: null, configured: true, cycle_resets_at: '2026-11-28T00:00:00Z', diff --git a/packages/ingest-types/src/index.ts b/packages/ingest-types/src/index.ts index 0dd5d9e4aba..80290ec1769 100644 --- a/packages/ingest-types/src/index.ts +++ b/packages/ingest-types/src/index.ts @@ -223,6 +223,7 @@ export type { BillingOpCancelResponse, BillingOpChargeBreakdown, BillingOpChargeReason, + BillingOpOutcomeResponse, BillingOpReceiptPlan, BillingOpStatusResponse, BillingPlansResponse, @@ -712,6 +713,11 @@ export type { GetBillingEventsErrors, GetBillingEventsResponse, GetBillingEventsResponses, + GetBillingOpOutcomeData, + GetBillingOpOutcomeError, + GetBillingOpOutcomeErrors, + GetBillingOpOutcomeResponse, + GetBillingOpOutcomeResponses, GetBillingOpStatusData, GetBillingOpStatusError, GetBillingOpStatusErrors, @@ -733,14 +739,12 @@ export type { GetBillingUsageTimeSeriesResponse, GetBillingUsageTimeSeriesResponses, GetCatalogAgentInstructionsData, + GetCatalogAgentInstructionsError, GetCatalogAgentInstructionsErrors, GetCatalogAgentInstructionsResponse, GetCatalogAgentInstructionsResponses, - GetCatalogDocsData, - GetCatalogDocsErrors, - GetCatalogDocsResponse, - GetCatalogDocsResponses, GetCatalogOpenApiData, + GetCatalogOpenApiError, GetCatalogOpenApiErrors, GetCatalogOpenApiResponse, GetCatalogOpenApiResponses, diff --git a/packages/ingest-types/src/types.gen.ts b/packages/ingest-types/src/types.gen.ts index 14b97e1b35a..daa50a42798 100644 --- a/packages/ingest-types/src/types.gen.ts +++ b/packages/ingest-types/src/types.gen.ts @@ -1453,6 +1453,26 @@ export type AutoReloadPreview = { * */ export type AutoReloadSettings = { + /** + * Answers one UI question: should the UI warn that auto top-up can + * refill credits past a hard cap? + * True: auto top-up's `status` is `on` (enabled and currently able to + * charge) and the workspace has at least one live budget with + * `mode: hard`. Show the warning. + * False: show no warning, and read it as unknown, not as proof that + * there is no conflict. Either half is missing, or the half this + * response does not carry could not be read (the server then reports + * false and logs it). When billing-api omits this field, ingest serves + * false, so during a rollout false carries no information. + * On a save it reflects the settings just saved. + * Not a gate: it never blocks saving a budget or auto top-up, and it is + * not authorization. Render it as received; do not compare the budget + * list with the auto top-up settings to rebuild it. The same value is + * served on the budget list, the budget write results and the auto + * top-up settings. + * + */ + auto_top_up_conflict: boolean /** * True when the validated default card is already expired or its expiry-month boundary (00:00 UTC on the first day of the following month) is within the next 30 days. Absent or null means unknown, never a healthy-card claim. This includes non-card methods, malformed data, provider errors or a live Stripe default that differs from the recorded default payment method (for example, before a portal-change webhook syncs). Independent of status and charge eligibility; save responses omit the fact. Missing on an older server also means unknown. * @@ -2062,6 +2082,41 @@ export type BillingCapabilities = { * Point-in-time Cloud billing guidance for this actor, combining the supplied workflow_run decision with ingest's existing account gate and cutover mode, local enrollment, Google-session requirement, and acting-user allowance. Legacy authority includes the same fail-open behavior as submission. True means these account gates allow the attempt; false has a denial when recognized. Billing-disabled environments return true. False without a reason is unknown where authoritative guidance is unavailable. No allowance is consumed or reserved. This is not authorization for a specific job or project: the submission path rechecks its full context. */ can_run_workflows: boolean + /** + * - Answers: should the client offer creating and changing workspace + * budgets (the Budgets controls)? + * - True: the actor is a workspace owner (the creator alone while a + * personal workspace's billing identity is not provisioned, as for + * can_manage_billing), and the workspace has a + * subscription whose term is open (active or canceled, with any + * cancellation date still ahead) on a plan other than FREE. + * - False: denied_reasons.can_set_budgets names the first refusal. + * False with no reason means no recognised explanation. + * - Not: authorization; the budget write endpoints decide again with + * the same rule. A caller who is not a member is refused before + * this rule runs, with FORBIDDEN and no reason from this list. Not whether a hard cap may be set + * (can_set_hard_caps). Not whether budgets may be read: any member + * may read the budget on themselves. Payment state (past due, + * paused top-ups) does not affect it. + * - When billing-api omits this field, ingest serves false, with no reason. + * + */ + can_set_budgets: boolean + /** + * - Answers: should the client unlock the hard-cap control on a + * budget, or show it locked with the path to sales? + * - True: can_set_budgets is true and the plan is Enterprise. + * - False: denied_reasons.can_set_hard_caps names the first refusal. + * False with no reason means no recognised explanation. + * `plan_not_enterprise` is the one case where budgets are available + * and only the hard cap is locked. + * - Not: authorization. Not whether soft budgets may be set + * (can_set_budgets). A budget that is already hard stays editable + * after a downgrade; this field is about setting a new hard cap. + * - When billing-api omits this field, ingest serves false, with no reason. + * + */ + can_set_hard_caps: boolean /** * - Answers: may this user start, recover or change a self-serve plan? * - True: the user is a workspace owner and no resolver branch closed it. When @@ -2747,6 +2802,50 @@ export type BillingCapabilityDenials = { | 'project_cap_exceeded' | 'user_cap_exceeded' | 'free_tier_exhausted' + /** + * Why can_set_budgets is false. Present only when that capability is false; absent means no recognized explanation, never permission. This does not authorize the action or explain a sibling capability. First reached wins in the order below: the role refusals, then the plan refusals. The status branches never compete, since a subscription has one status. + * - not_a_member: The actor is not a workspace member. + * - not_workspace_owner: The actor is a member whose role is not owner. + * - creator_only_provisioning: Only the creator can act on this personal workspace's billing until its billing identity is provisioned. + * - no_subscription: The workspace has no subscription, so it has no billing period to budget over. + * - free_plan: The plan is FREE, whose usage is not charged spend. + * - subscription_ended: The subscription has stopped for good, ended or canceled with no end date ahead. + * - subscription_not_started: The subscription is scheduled and has not started. + * - subscription_status_unrecognized: The subscription status is one the resolver has no guidance for. + * + */ + can_set_budgets?: + | 'not_a_member' + | 'not_workspace_owner' + | 'creator_only_provisioning' + | 'no_subscription' + | 'free_plan' + | 'subscription_ended' + | 'subscription_not_started' + | 'subscription_status_unrecognized' + /** + * Why can_set_hard_caps is false. Present only when that capability is false; absent means no recognized explanation, never permission. This does not authorize the action or explain a sibling capability. First reached wins in the order below: every can_set_budgets refusal in its order, then the plan check. + * - not_a_member: The actor is not a workspace member. + * - not_workspace_owner: The actor is a member whose role is not owner. + * - creator_only_provisioning: Only the creator can act on this personal workspace's billing until its billing identity is provisioned. + * - no_subscription: The workspace has no subscription. + * - free_plan: The plan is FREE. + * - subscription_ended: The subscription has stopped for good. + * - subscription_not_started: The subscription is scheduled and has not started. + * - subscription_status_unrecognized: The subscription status is one the resolver has no guidance for. + * - plan_not_enterprise: Budgets are available, but hard caps are an Enterprise feature. Show the control locked and offer the path to sales. + * + */ + can_set_hard_caps?: + | 'not_a_member' + | 'not_workspace_owner' + | 'creator_only_provisioning' + | 'no_subscription' + | 'free_plan' + | 'subscription_ended' + | 'subscription_not_started' + | 'subscription_status_unrecognized' + | 'plan_not_enterprise' /** * Present only when can_subscribe_self_serve is false. The value names the * resolver branch that decided, not customer wording. Values are listed in the @@ -3213,6 +3312,21 @@ export type BillingOpChargeReason = { kind: 'promo_code' | 'subscription_discount' | 'account_balance' } +/** + * How a billing operation ended, for a billing handoff tab whose scoped session has ended. + */ +export type BillingOpOutcomeResponse = { + /** + * The `status` that `GET /api/billing/ops/{id}` reports for the same + * operation. It answers whether the payment has finished and how: + * pending means keep polling, the other three are final for polling. + * It does not say why a payment failed or what the customer can do + * next. + * + */ + status: 'pending' | 'succeeded' | 'failed' | 'reconciliation_needed' +} + /** * Display only. The plan the operation targets; for a scheduled change, * the plan it switches to at period end. Present for plan changes, @@ -3299,8 +3413,10 @@ export type BillingOpStatusResponse = { authentication_deadline?: string /** * State derived from the PaymentIntent attached to this operation's - * exact stored Stripe invoice. Absent when the operation has no - * correlated PaymentIntent. + * exact stored Stripe invoice. One exception: a pending plan change + * saving a new card reports requires_action while that card's + * SetupIntent awaits 3-D Secure, before any invoice exists. Absent + * when the operation has neither. * */ authentication_state?: @@ -3381,9 +3497,11 @@ export type BillingOpStatusResponse = { */ id: string /** - * Stripe PaymentIntent client secret for completing requires_action. - * This bearer capability is returned only to workspace billing managers - * and is absent otherwise. + * Stripe client secret for completing requires_action: the invoice's + * PaymentIntent, or for a plan change saving a new card, that card's + * SetupIntent (pass either to Stripe.js handleNextAction). This bearer + * capability is returned only to workspace billing managers and is + * absent otherwise. * */ payment_intent_client_secret?: string @@ -3393,7 +3511,11 @@ export type BillingOpStatusResponse = { * The two awaiting_ values are blocked on the customer and will not * advance on their own: awaiting_payment_method is parked on a hosted * checkout needing a card, awaiting_invoice_payment on an invoice - * needing payment or authentication. in_progress means the operation + * needing payment or authentication, or on a plan change's new card + * awaiting 3-D Secure before any invoice exists (then + * authentication_state is requires_action and + * payment_intent_client_secret is that card's SetupIntent secret). + * in_progress means the operation * is ours to finish, so polling is the right response. Deliberately * coarser than the internal phase — phases that differ only in what * the workflow is doing all report in_progress. Absent for a terminal @@ -3749,6 +3871,26 @@ export type BudgetHistory = { } export type BudgetList = { + /** + * Answers one UI question: should the UI warn that auto top-up can + * refill credits past a hard cap? + * True: auto top-up's `status` is `on` (enabled and currently able to + * charge) and the workspace has at least one live budget with + * `mode: hard`. Show the warning. + * False: show no warning, and read it as unknown, not as proof that + * there is no conflict. Either half is missing, or the half this + * response does not carry could not be read (the server then reports + * false and logs it). When billing-api omits this field, ingest serves + * false, so during a rollout false carries no information. + * Always false for a member who is not an owner: it is an owner-facing warning. + * Not a gate: it never blocks saving a budget or auto top-up, and it is + * not authorization. Render it as received; do not compare the budget + * list with the auto top-up settings to rebuild it. The same value is + * served on the budget list, the budget write results and the auto + * top-up settings. + * + */ + auto_top_up_conflict: boolean budgets: Array } @@ -3792,6 +3934,26 @@ export type BudgetUpdateRequest = { } export type BudgetWriteResult = { + /** + * Answers one UI question: should the UI warn that auto top-up can + * refill credits past a hard cap? + * True: auto top-up's `status` is `on` (enabled and currently able to + * charge) and the workspace has at least one live budget with + * `mode: hard`. Show the warning. + * False: show no warning, and read it as unknown, not as proof that + * there is no conflict. Either half is missing, or the half this + * response does not carry could not be read (the server then reports + * false and logs it). When billing-api omits this field, ingest serves + * false, so during a rollout false carries no information. + * Reflects the workspace after this write, the written budget included. + * Not a gate: it never blocks saving a budget or auto top-up, and it is + * not authorization. Render it as received; do not compare the budget + * list with the auto top-up settings to rebuild it. The same value is + * served on the budget list, the budget write results and the auto + * top-up settings. + * + */ + auto_top_up_conflict: boolean budget: Budget } @@ -4115,6 +4277,10 @@ export type CccPageRow = { * Deleted in Draft. */ is_deleted: boolean + /** + * The Draft head lists desktop_starters in available_surfaces. status does not read it. + */ + on_desktop: boolean /** * The Draft head lists hub in available_surfaces. The website serves only such pages. */ @@ -8627,7 +8793,16 @@ export type SubscribeRequest = { /** * Stripe ConfirmationToken created from deferred Payment Element * details. For an initial subscription, the backend creates the exact - * invoice PaymentIntent and confirms it with this token. + * invoice PaymentIntent and confirms it with this token. For a change + * of an existing plan (upgrade, billing-cycle reset or scheduled + * downgrade), the backend saves the card with a SetupIntent first; if + * that needs 3-D Secure, the operation's payment_intent_client_secret + * on /billing/ops/{id} carries the SetupIntent's client secret for + * Stripe.js handleNextAction. An immediate upgrade then charges the + * prorated amount to this card. On success the card becomes the + * workspace default (Stripe customer default and the subscription's); + * a declined or unauthenticated card changes no default. Requires + * return_url. Mutually exclusive with saved_payment_method_id. * */ confirmation_token?: string @@ -8678,9 +8853,15 @@ export type SubscribeRequest = { */ return_url?: string /** - * Optional saved payment method selected for this subscription. It - * must be attached to the current workspace's Stripe customer. - * Mutually exclusive with confirmation_token. + * Optional saved payment method selected at checkout, for a new + * subscription or a change of an existing plan (upgrade, billing-cycle + * reset or scheduled downgrade). It must be attached to the current + * workspace's Stripe customer. An immediate upgrade charges the + * prorated amount to this card; a scheduled downgrade charges nothing. + * On success the card becomes the workspace default (Stripe customer + * default and the subscription's); a declined charge changes no + * default. Omitted, the plan change charges the current default as + * before. Mutually exclusive with confirmation_token. * */ saved_payment_method_id?: string @@ -13635,6 +13816,9 @@ export type CreateBillingBudgetErrors = { /** * `not_workspace_owner` (the caller is a member, not an owner), * `plan_not_enterprise` (`mode: hard` on a plan without hard caps), + * a plan refusal whose code is the `can_set_budgets` denial reason + * (`creator_only_provisioning`, `no_subscription`, `free_plan`, `subscription_ended`, + * `subscription_not_started`, `subscription_status_unrecognized`), * `WORKSPACE_BLOCKED`, `api_key_not_allowed` (the request was made * with an API key; budgets are changed from a signed-in session * only), `INSUFFICIENT_SCOPE` (an OAuth session without the billing @@ -13764,7 +13948,11 @@ export type UpdateBillingBudgetErrors = { 401: ErrorResponse /** * `not_workspace_owner`, `plan_not_enterprise` (changing a soft - * budget to hard on a plan without hard caps), `WORKSPACE_BLOCKED`, + * budget to hard on a plan without hard caps), a plan refusal whose + * code is the `can_set_budgets` denial reason + * (`creator_only_provisioning`, `no_subscription`, + * `free_plan`, `subscription_ended`, `subscription_not_started`, + * `subscription_status_unrecognized`), `WORKSPACE_BLOCKED`, * `api_key_not_allowed` (the request was made with an API key), * `INSUFFICIENT_SCOPE` (sent with a `WWW-Authenticate` * insufficient_scope challenge), `FORBIDDEN` (the caller is no @@ -14200,6 +14388,54 @@ export type CancelBillingOpResponses = { export type CancelBillingOpResponse = CancelBillingOpResponses[keyof CancelBillingOpResponses] +export type GetBillingOpOutcomeData = { + body?: never + path: { + /** + * The billing operation ID + */ + id: string + } + query?: never + url: '/api/billing/ops/{id}/outcome' +} + +export type GetBillingOpOutcomeErrors = { + /** + * `INVALID_CREDENTIAL`: no scoped-session bearer, or the session is unknown, revoked or expired 30 minutes ago or more + */ + 401: ErrorResponse + /** + * `HANDOFF_DISABLED`, `BILLING_FORBIDDEN` or another billing policy refusal + */ + 403: ErrorResponse + /** + * Billing operation not found in the session's workspace + */ + 404: ErrorResponse + /** + * Internal server error + */ + 500: ErrorResponse + /** + * `SERVICE_UNAVAILABLE`: the session or billing policy check could not be made + */ + 503: ErrorResponse +} + +export type GetBillingOpOutcomeError = + GetBillingOpOutcomeErrors[keyof GetBillingOpOutcomeErrors] + +export type GetBillingOpOutcomeResponses = { + /** + * Billing operation outcome + */ + 200: BillingOpOutcomeResponse +} + +export type GetBillingOpOutcomeResponse = + GetBillingOpOutcomeResponses[keyof GetBillingOpOutcomeResponses] + export type ListSavedPaymentMethodsData = { body?: never path?: never @@ -19103,15 +19339,30 @@ export type GetCatalogAgentInstructionsData = { } export type GetCatalogAgentInstructionsErrors = { + /** + * `code` is `workspace_id_invalid`: the `X-Comfy-Workspace-ID` header or `workspace_id` query value is malformed, or conflicts with another value or with the workspace the credential resolves to. Answered only while `web_session_enabled` is on for the user. See the `WebSessionAuth` scheme. + */ + 400: ErrorResponse + /** + * No valid credential, or an `Authorization` header, `X-API-Key` header or `?token=` next to the session cookie that could not be read, which is refused rather than answered with the session. `code` is `UNAUTHORIZED`. + */ + 401: ErrorResponse + /** + * A refused request. For a web session, `code` is `workspace_access_denied` (the selected workspace is unknown, deleted, or the user is not a member; the three look the same), `no_workspace_access` (the account has no personal workspace and is a member of no live workspace), `origin_not_allowed` or `cross_site_request`; see the `WebSessionAuth` scheme. For any credential, `sso_required` means an SSO organization holds the account (its email is on the organization's verified domains) and the credential is not an SSO sign-in, or the workspace is an SSO organization's and the account is not on its domains or the credential is not an SSO sign-in; `organization_id`, when present, names the organization to sign in with. `account_outside_organization` means the workspace is an SSO organization's and the account is on none of its domains, so no sign-in admits it; `organization_id` names the workspace's organization. `personal_workspace_disabled` means the workspace is the account's personal one and an SSO organization holds the account, so it cannot use it; `organization_id` names that organization. `FORBIDDEN` is the route's own authorization check failing, such as an unverified email. On `GET /api/billing/churnkey/auth`, `NOT_ORIGINAL_OWNER` means the caller is not the workspace's creator; it is returned only when the rollout mode is `creator`. A credential this route does not take gets AuthTypeNotAllowedError instead, and so does the session while `web_session_enabled` is off for the user, unless the operation says it takes the session whatever `web_session_enabled` says. + */ + 403: ForbiddenError /** * Catalog disabled or unavailable */ 503: unknown } +export type GetCatalogAgentInstructionsError = + GetCatalogAgentInstructionsErrors[keyof GetCatalogAgentInstructionsErrors] + export type GetCatalogAgentInstructionsResponses = { /** - * Editing instructions from this deployed catalog API build + * Editing instructions from this deployed catalog API build; private no-store */ 200: string } @@ -19282,30 +19533,6 @@ export type GetCccCreatorResponses = { export type GetCccCreatorResponse = GetCccCreatorResponses[keyof GetCccCreatorResponses] -export type GetCatalogDocsData = { - body?: never - path?: never - query?: never - url: '/api/v1/catalog/docs' -} - -export type GetCatalogDocsErrors = { - /** - * Catalog disabled or unavailable - */ - 503: unknown -} - -export type GetCatalogDocsResponses = { - /** - * Build-coupled catalog instructions, permissions and endpoint contracts - */ - 200: string -} - -export type GetCatalogDocsResponse = - GetCatalogDocsResponses[keyof GetCatalogDocsResponses] - export type BatchCccItemsData = { body: { expected_draft_rev: number @@ -20491,15 +20718,30 @@ export type GetCatalogOpenApiData = { } export type GetCatalogOpenApiErrors = { + /** + * `code` is `workspace_id_invalid`: the `X-Comfy-Workspace-ID` header or `workspace_id` query value is malformed, or conflicts with another value or with the workspace the credential resolves to. Answered only while `web_session_enabled` is on for the user. See the `WebSessionAuth` scheme. + */ + 400: ErrorResponse + /** + * No valid credential, or an `Authorization` header, `X-API-Key` header or `?token=` next to the session cookie that could not be read, which is refused rather than answered with the session. `code` is `UNAUTHORIZED`. + */ + 401: ErrorResponse + /** + * A refused request. For a web session, `code` is `workspace_access_denied` (the selected workspace is unknown, deleted, or the user is not a member; the three look the same), `no_workspace_access` (the account has no personal workspace and is a member of no live workspace), `origin_not_allowed` or `cross_site_request`; see the `WebSessionAuth` scheme. For any credential, `sso_required` means an SSO organization holds the account (its email is on the organization's verified domains) and the credential is not an SSO sign-in, or the workspace is an SSO organization's and the account is not on its domains or the credential is not an SSO sign-in; `organization_id`, when present, names the organization to sign in with. `account_outside_organization` means the workspace is an SSO organization's and the account is on none of its domains, so no sign-in admits it; `organization_id` names the workspace's organization. `personal_workspace_disabled` means the workspace is the account's personal one and an SSO organization holds the account, so it cannot use it; `organization_id` names that organization. `FORBIDDEN` is the route's own authorization check failing, such as an unverified email. On `GET /api/billing/churnkey/auth`, `NOT_ORIGINAL_OWNER` means the caller is not the workspace's creator; it is returned only when the rollout mode is `creator`. A credential this route does not take gets AuthTypeNotAllowedError instead, and so does the session while `web_session_enabled` is off for the user, unless the operation says it takes the session whatever `web_session_enabled` says. + */ + 403: ForbiddenError /** * Catalog disabled or unavailable */ 503: unknown } +export type GetCatalogOpenApiError = + GetCatalogOpenApiErrors[keyof GetCatalogOpenApiErrors] + export type GetCatalogOpenApiResponses = { /** - * Catalog OpenAPI with contract fingerprint and environment + * Catalog OpenAPI with contract fingerprint and environment; private no-store */ 200: Cccjson } diff --git a/packages/ingest-types/src/zod.gen.ts b/packages/ingest-types/src/zod.gen.ts index 2e6bfefa6b6..d7a4d5849d4 100644 --- a/packages/ingest-types/src/zod.gen.ts +++ b/packages/ingest-types/src/zod.gen.ts @@ -969,6 +969,7 @@ export const zAutoReloadPreview = z.object({ * */ export const zAutoReloadSettings = z.object({ + auto_top_up_conflict: z.boolean(), card_expiring_soon: z.boolean().nullish(), card_expiry: zAutoReloadCardExpiry.nullable(), configured: z.boolean(), @@ -1258,6 +1259,8 @@ export const zBillingCapabilities = z.object({ can_reactivate: z.boolean(), can_revert_scheduled_change: z.boolean(), can_run_workflows: z.boolean(), + can_set_budgets: z.boolean(), + can_set_hard_caps: z.boolean(), can_subscribe_self_serve: z.boolean(), can_top_up: z.boolean(), can_upgrade: z.boolean(), @@ -1443,6 +1446,31 @@ export const zBillingCapabilityDenials = z.object({ 'free_tier_exhausted' ]) .optional(), + can_set_budgets: z + .enum([ + 'not_a_member', + 'not_workspace_owner', + 'creator_only_provisioning', + 'no_subscription', + 'free_plan', + 'subscription_ended', + 'subscription_not_started', + 'subscription_status_unrecognized' + ]) + .optional(), + can_set_hard_caps: z + .enum([ + 'not_a_member', + 'not_workspace_owner', + 'creator_only_provisioning', + 'no_subscription', + 'free_plan', + 'subscription_ended', + 'subscription_not_started', + 'subscription_status_unrecognized', + 'plan_not_enterprise' + ]) + .optional(), can_subscribe_self_serve: z .enum([ 'not_a_member', @@ -1639,6 +1667,13 @@ export const zBillingOpCancelResponse = z.object({ status: z.enum(['canceled', 'cancel_requested']) }) +/** + * How a billing operation ended, for a billing handoff tab whose scoped session has ended. + */ +export const zBillingOpOutcomeResponse = z.object({ + status: z.enum(['pending', 'succeeded', 'failed', 'reconciliation_needed']) +}) + /** * Payment lifecycle status */ @@ -1812,6 +1847,7 @@ export const zBudgetCreateRequest = z.object({ }) export const zBudgetList = z.object({ + auto_top_up_conflict: z.boolean(), budgets: z.array(zBudget) }) @@ -1841,6 +1877,7 @@ export const zBudgetUpdateRequest = z.object({ }) export const zBudgetWriteResult = z.object({ + auto_top_up_conflict: z.boolean(), budget: zBudget }) @@ -2145,6 +2182,7 @@ export const zCccPageRow = z.object({ has_live: z.boolean(), held_until_start: z.boolean(), is_deleted: z.boolean(), + on_desktop: z.boolean(), on_hub: z.boolean(), presentation: zCccPagePresentation, revision_uid: z.uuid(), @@ -7077,6 +7115,15 @@ export const zCancelBillingOpPath = z.object({ */ export const zCancelBillingOpResponse = zBillingOpCancelResponse +export const zGetBillingOpOutcomePath = z.object({ + id: z.string() +}) + +/** + * Billing operation outcome + */ +export const zGetBillingOpOutcomeResponse = zBillingOpOutcomeResponse + /** * Saved payment methods */ @@ -8020,7 +8067,7 @@ export const zGetCccActivityQuery = z.object({ export const zGetCccActivityResponse = zCccActivityPage /** - * Editing instructions from this deployed catalog API build + * Editing instructions from this deployed catalog API build; private no-store */ export const zGetCatalogAgentInstructionsResponse = z.string() @@ -8076,11 +8123,6 @@ export const zGetCccCreatorPath = z.object({ */ export const zGetCccCreatorResponse = zCccCreatorProfile -/** - * Build-coupled catalog instructions, permissions and endpoint contracts - */ -export const zGetCatalogDocsResponse = z.string() - export const zBatchCccItemsBody = z.object({ expected_draft_rev: z.coerce .bigint() @@ -8443,7 +8485,7 @@ export const zListCccWebsiteModelDirectoryQuery = z.object({ export const zListCccWebsiteModelDirectoryResponse = zCccWebsiteModelDirectory /** - * Catalog OpenAPI with contract fingerprint and environment + * Catalog OpenAPI with contract fingerprint and environment; private no-store */ export const zGetCatalogOpenApiResponse = zCccjson diff --git a/src/platform/auth/webSessionFlagOff.test.ts b/src/platform/auth/webSessionFlagOff.test.ts index 05002823407..b4a18c17f78 100644 --- a/src/platform/auth/webSessionFlagOff.test.ts +++ b/src/platform/auth/webSessionFlagOff.test.ts @@ -181,6 +181,8 @@ const CAPABILITIES = { can_manage_subscription: false, can_open_plans: false, can_run_workflows: false, + can_set_budgets: false, + can_set_hard_caps: false, can_upgrade: false } satisfies BillingCapabilities, rollout_defaults_applied: { diff --git a/src/platform/auth/webSessionFlagOn.test.ts b/src/platform/auth/webSessionFlagOn.test.ts index 466e542f45e..0b1b7cb38ae 100644 --- a/src/platform/auth/webSessionFlagOn.test.ts +++ b/src/platform/auth/webSessionFlagOn.test.ts @@ -680,6 +680,8 @@ function capabilitiesResponse({ can_manage_subscription: false, can_open_plans: false, can_run_workflows: false, + can_set_budgets: false, + can_set_hard_caps: false, can_upgrade: false, can_downgrade_to_personal: false }, diff --git a/src/platform/billing/api/__mocks__/billingApi.ts b/src/platform/billing/api/__mocks__/billingApi.ts index 1b7b3567610..ae7cbfed533 100644 --- a/src/platform/billing/api/__mocks__/billingApi.ts +++ b/src/platform/billing/api/__mocks__/billingApi.ts @@ -42,6 +42,8 @@ export const billingApi = vi.mockObject( can_manage_subscription: false, can_open_plans: false, can_run_workflows: false, + can_set_budgets: false, + can_set_hard_caps: false, can_upgrade: false, can_reactivate: false, can_revert_scheduled_change: false, @@ -59,6 +61,7 @@ export const billingApi = vi.mockObject( } }, getBillingAutoReload: async () => ({ + auto_top_up_conflict: false, card_expiry: null, configured: false, cycle_resets_at: null, diff --git a/src/platform/billing/composables/__mocks__/useBillingAutoTopUpCard.ts b/src/platform/billing/composables/__mocks__/useBillingAutoTopUpCard.ts index ddefd34aa03..01890b8f730 100644 --- a/src/platform/billing/composables/__mocks__/useBillingAutoTopUpCard.ts +++ b/src/platform/billing/composables/__mocks__/useBillingAutoTopUpCard.ts @@ -8,6 +8,7 @@ type AutoTopUpCard = ReturnType type AutoTopUpCardState = AutoTopUpCard['state']['value'] const offSettings: AutoReloadSettings = { + auto_top_up_conflict: false, card_expiry: null, configured: false, cycle_resets_at: null, diff --git a/src/platform/billing/composables/useAutoTopUpCardSection.test.ts b/src/platform/billing/composables/useAutoTopUpCardSection.test.ts index da505f66c6c..82ca5ca5623 100644 --- a/src/platform/billing/composables/useAutoTopUpCardSection.test.ts +++ b/src/platform/billing/composables/useAutoTopUpCardSection.test.ts @@ -52,6 +52,7 @@ const BILLING_HREF = /^https:\/\/platform\.test\/profile\/billing\?correlation_id=.+$/ const configured: AutoReloadSettings = { + auto_top_up_conflict: false, card_expiry: null, configured: true, cycle_resets_at: '2026-11-28T00:00:00Z', diff --git a/src/platform/billing/composables/useBillingAutoTopUpCard.test.ts b/src/platform/billing/composables/useBillingAutoTopUpCard.test.ts index 78f91e09900..bce3d7d27de 100644 --- a/src/platform/billing/composables/useBillingAutoTopUpCard.test.ts +++ b/src/platform/billing/composables/useBillingAutoTopUpCard.test.ts @@ -54,6 +54,7 @@ function settingsWith( status: AutoReloadSettings['status'] ): AutoReloadSettings { return { + auto_top_up_conflict: false, card_expiry: null, configured: status !== 'off', cycle_resets_at: '2026-11-28T00:00:00Z', diff --git a/src/platform/billing/composables/useBillingCapabilities.crossUser.test.ts b/src/platform/billing/composables/useBillingCapabilities.crossUser.test.ts index d5cddadacf4..d5d15c10ef4 100644 --- a/src/platform/billing/composables/useBillingCapabilities.crossUser.test.ts +++ b/src/platform/billing/composables/useBillingCapabilities.crossUser.test.ts @@ -65,6 +65,8 @@ function capabilitiesFor( can_manage_subscription: isOwner, can_open_plans: isOwner, can_run_workflows: isOwner, + can_set_budgets: false, + can_set_hard_caps: false, can_upgrade: isOwner }, rollout_defaults_applied: { diff --git a/src/platform/billing/composables/useBillingCapabilities.test.ts b/src/platform/billing/composables/useBillingCapabilities.test.ts index b65f080b4bd..dfde022cce7 100644 --- a/src/platform/billing/composables/useBillingCapabilities.test.ts +++ b/src/platform/billing/composables/useBillingCapabilities.test.ts @@ -93,6 +93,8 @@ function capabilitiesResponse( can_manage_subscription: false, can_open_plans: false, can_run_workflows: false, + can_set_budgets: false, + can_set_hard_caps: false, can_upgrade: false, can_downgrade_to_personal: true, ...overrides @@ -1645,6 +1647,8 @@ describe('useBillingCapabilities on the SDK rail', () => { can_manage_subscription: false, can_open_plans: false, can_run_workflows: false, + can_set_budgets: false, + can_set_hard_caps: false, can_upgrade: false }, denials: { diff --git a/src/platform/billing/composables/useCreditBanner.capabilities.test.ts b/src/platform/billing/composables/useCreditBanner.capabilities.test.ts index 9172c9f61f5..bf1627d1f91 100644 --- a/src/platform/billing/composables/useCreditBanner.capabilities.test.ts +++ b/src/platform/billing/composables/useCreditBanner.capabilities.test.ts @@ -85,6 +85,8 @@ function capabilitiesBody( can_reactivate: false, can_revert_scheduled_change: false, can_run_workflows: false, + can_set_budgets: false, + can_set_hard_caps: false, can_subscribe_self_serve: false, can_top_up: false, can_upgrade: false, diff --git a/src/platform/billing/legacy160/platform/billing/components/billingTab/BillingAutoTopUpCard.test.ts b/src/platform/billing/legacy160/platform/billing/components/billingTab/BillingAutoTopUpCard.test.ts index 7854e38fdbc..5271730b9ad 100644 --- a/src/platform/billing/legacy160/platform/billing/components/billingTab/BillingAutoTopUpCard.test.ts +++ b/src/platform/billing/legacy160/platform/billing/components/billingTab/BillingAutoTopUpCard.test.ts @@ -51,6 +51,7 @@ const BILLING_HREF = /^https:\/\/platform\.test\/profile\/billing\?correlation_id=.+$/ const configured: AutoReloadSettings = { + auto_top_up_conflict: false, card_expiry: null, configured: true, cycle_resets_at: '2026-11-28T00:00:00Z', diff --git a/src/platform/billing/legacy160/platform/billing/components/billingTab/BillingLocalCreditBanner.capabilities.test.ts b/src/platform/billing/legacy160/platform/billing/components/billingTab/BillingLocalCreditBanner.capabilities.test.ts index 79709c054d9..856e353dd04 100644 --- a/src/platform/billing/legacy160/platform/billing/components/billingTab/BillingLocalCreditBanner.capabilities.test.ts +++ b/src/platform/billing/legacy160/platform/billing/components/billingTab/BillingLocalCreditBanner.capabilities.test.ts @@ -87,6 +87,8 @@ function capabilitiesBody( can_reactivate: false, can_revert_scheduled_change: false, can_run_workflows: false, + can_set_budgets: false, + can_set_hard_caps: false, can_subscribe_self_serve: false, can_top_up: false, can_upgrade: false, diff --git a/src/platform/billing/legacy160/platform/billing/composables/useBillingAutoTopUpCard.test.ts b/src/platform/billing/legacy160/platform/billing/composables/useBillingAutoTopUpCard.test.ts index 4a08d0b5142..be4df8dffa7 100644 --- a/src/platform/billing/legacy160/platform/billing/composables/useBillingAutoTopUpCard.test.ts +++ b/src/platform/billing/legacy160/platform/billing/composables/useBillingAutoTopUpCard.test.ts @@ -54,6 +54,7 @@ function settingsWith( status: AutoReloadSettings['status'] ): AutoReloadSettings { return { + auto_top_up_conflict: false, card_expiry: null, configured: status !== 'off', cycle_resets_at: '2026-11-28T00:00:00Z', diff --git a/src/platform/billing/sdk/billingCapabilitiesView.test.ts b/src/platform/billing/sdk/billingCapabilitiesView.test.ts index 9b3c0b92cf5..fd7cca83fed 100644 --- a/src/platform/billing/sdk/billingCapabilitiesView.test.ts +++ b/src/platform/billing/sdk/billingCapabilitiesView.test.ts @@ -24,6 +24,8 @@ const SNAPSHOT: CapabilitiesSnapshot = { can_manage_subscription: false, can_open_plans: false, can_run_workflows: false, + can_set_budgets: false, + can_set_hard_caps: false, can_upgrade: false, can_reactivate: false, can_revert_scheduled_change: false, diff --git a/src/platform/billing/sdk/billingSdkTelemetryOwnership.test.ts b/src/platform/billing/sdk/billingSdkTelemetryOwnership.test.ts index 9ab7b4aca20..01cf06f5e43 100644 --- a/src/platform/billing/sdk/billingSdkTelemetryOwnership.test.ts +++ b/src/platform/billing/sdk/billingSdkTelemetryOwnership.test.ts @@ -163,6 +163,8 @@ const CAPABILITIES = { can_manage_subscription: false, can_open_plans: false, can_run_workflows: false, + can_set_budgets: false, + can_set_hard_caps: false, can_upgrade: false, can_reactivate: true, can_revert_scheduled_change: false, diff --git a/src/platform/billing/sdk/createBillingSdk.test.ts b/src/platform/billing/sdk/createBillingSdk.test.ts index 3c4e5b310b9..7ea94715558 100644 --- a/src/platform/billing/sdk/createBillingSdk.test.ts +++ b/src/platform/billing/sdk/createBillingSdk.test.ts @@ -76,6 +76,8 @@ const CAPABILITIES = { can_manage_subscription: false, can_open_plans: false, can_run_workflows: false, + can_set_budgets: false, + can_set_hard_caps: false, can_upgrade: false, can_reactivate: false, can_revert_scheduled_change: false, diff --git a/src/platform/billing/telemetry/workspaceTelemetryContext.test.ts b/src/platform/billing/telemetry/workspaceTelemetryContext.test.ts index 80146bf5fb3..d9349de1692 100644 --- a/src/platform/billing/telemetry/workspaceTelemetryContext.test.ts +++ b/src/platform/billing/telemetry/workspaceTelemetryContext.test.ts @@ -185,6 +185,8 @@ describe('useBillingCapabilities workspace scope mismatch', () => { can_manage_subscription: false, can_open_plans: false, can_run_workflows: false, + can_set_budgets: false, + can_set_hard_caps: false, can_upgrade: false }, rollout_defaults_applied: { From 9ede43ae555bf3083793f39f5ba250f6c1c97244 Mon Sep 17 00:00:00 2001 From: dante01yoon Date: Sat, 14 Nov 2026 09:13:14 -0500 Subject: [PATCH 2/2] test(billing-web): give the top-up capability fixture the two synced capability fields The fixture arrived from main after this branch synced ingest-types, which made can_set_budgets and can_set_hard_caps required. --- apps/billing-web/src/session/billingWebClient.test.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/billing-web/src/session/billingWebClient.test.ts b/apps/billing-web/src/session/billingWebClient.test.ts index 0ca9b9b82a1..698e5f22fec 100644 --- a/apps/billing-web/src/session/billingWebClient.test.ts +++ b/apps/billing-web/src/session/billingWebClient.test.ts @@ -478,6 +478,8 @@ describe('createHandoffBillingClient', () => { can_reactivate: false, can_revert_scheduled_change: false, can_run_workflows: true, + can_set_budgets: false, + can_set_hard_caps: false, can_subscribe_self_serve: true, can_top_up: true, can_upgrade: true,