Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions browser_tests/fixtures/ComfyPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ import {
PERSONAL_BILLING_STATUS
} from '@e2e/fixtures/data/cloudWorkspace'
import { createBillingCapabilities } from '@e2e/fixtures/data/billingCapabilities'
import {
UNSUBSCRIBED,
ZERO_BALANCE
} from '@e2e/fixtures/data/subscriptionFixtures'
import { ComfyActionbar } from '@e2e/fixtures/components/Actionbar'
import { ComfyTemplates } from '@e2e/fixtures/components/Templates'
import { ComfyMouse } from '@e2e/fixtures/ComfyMouse'
Expand Down Expand Up @@ -721,12 +717,6 @@ export const comfyPageFixture = base.extend<{
await context.route('**/api/billing/plans', (route) =>
route.fulfill({ json: EMPTY_BILLING_PLANS })
)
await context.route('**/customers/cloud-subscription-status', (route) =>
route.fulfill({ json: UNSUBSCRIBED })
)
await context.route('**/customers/balance', (route) =>
route.fulfill({ json: ZERO_BALANCE })
)
await mockWorkspace(context, workspace('personal', 'owner'), [])
}
if (testInfo.tags.includes('@cloud') || testInfo.tags.includes('@auth')) {
Expand Down
24 changes: 2 additions & 22 deletions browser_tests/fixtures/apiKeyAuthFixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,33 +56,13 @@ const API_KEY_WORKSPACE_EVENT_ID = 'evt-api-key-workspace'
* user, a stored `comfy_api_key`, and the cloud API resolving that key to a
* single bound workspace. Mirrors the QA flow behind the 1.51 API-key billing
* findings: workspace context, balance, and activity must all come from the
* key's workspace via `/api/workspaces/current` and `/api/billing/*`, never
* from the legacy user-scoped `/customers/*` rail.
*
* The fixture records any legacy-rail read so specs can assert the session
* never falls back to it.
* key's workspace via `/api/workspaces/current` and `/api/billing/*`.
*/
export const apiKeyAuthFixture = base.extend<{
comfyPage: ComfyPage
legacyBillingReads: string[]
}>({
legacyBillingReads: async ({ page }, use) => {
const reads: string[] = []
await page.route('**/customers/balance', (route) => {
reads.push(route.request().url())
return route.fulfill(jsonRoute({ amount_micros: 0, currency: 'usd' }))
})
await page.route('**/customers/events**', (route) => {
reads.push(route.request().url())
return route.fulfill(
jsonRoute({ events: [], page: 1, limit: 7, total: 0, totalPages: 0 })
)
})
await use(reads)
},
comfyPage: async ({ page, request, legacyBillingReads }, use, testInfo) => {
comfyPage: async ({ page, request }, use, testInfo) => {
testInfo.setTimeout(45_000)
void legacyBillingReads

const comfyPage = new ComfyPage(page, request)
const userId = await comfyPage.setupUser(
Expand Down
34 changes: 0 additions & 34 deletions browser_tests/fixtures/helpers/SubscriptionHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,40 +122,6 @@ export class SubscriptionHelper {
}
this.routeHandlers.push({ pattern: statusPattern, handler: statusHandler })
await this.page.route(statusPattern, statusHandler)

const balancePattern = '**/customers/balance'
const balanceHandler = async (route: Route) => {
await route.fulfill({ json: this.balanceResponse })
}
this.routeHandlers.push({
pattern: balancePattern,
handler: balanceHandler
})
await this.page.route(balancePattern, balanceHandler)

const checkoutPattern = '**/customers/cloud-subscription-checkout**'
const checkoutHandler = async (route: Route) => {
await route.fulfill({
json: { checkout_url: 'https://checkout.stripe.com/mock' }
})
}
this.routeHandlers.push({
pattern: checkoutPattern,
handler: checkoutHandler
})
await this.page.route(checkoutPattern, checkoutHandler)

const billingPortalPattern = '**/customers/billing'
const billingPortalHandler = async (route: Route) => {
await route.fulfill({
json: { billing_portal_url: 'https://billing.example/portal' }
})
}
this.routeHandlers.push({
pattern: billingPortalPattern,
handler: billingPortalHandler
})
await this.page.route(billingPortalPattern, billingPortalHandler)
}

configure(...operators: SubscriptionOperator[]): void {
Expand Down
3 changes: 0 additions & 3 deletions browser_tests/fixtures/utils/cloudBillingMocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,4 @@ export async function mockBilling(
await page.route('**/api/billing/plans', (r) =>
r.fulfill(jsonRoute({ plans: [] }))
)
await page.route('**/customers/balance', (r) =>
r.fulfill(jsonRoute({ amount_micros: 0, currency: 'usd' }))
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ describe('live Cloud mutation policy', () => {
{ method: 'POST', path: '/api/auth/session', allowed: true },
{ method: 'POST', path: '/api/billing/subscribe', allowed: false },
{ method: 'POST', path: '/api/billing/payment-portal', allowed: false },
{ method: 'POST', path: '/customers/credit', allowed: false },
{ method: 'DELETE', path: '/customers', allowed: false },
{ method: 'PATCH', path: '/api/billing/payment-methods', allowed: false },
{ method: 'PUT', path: '/api/billing/subscription', allowed: false },
Expand Down
3 changes: 0 additions & 3 deletions browser_tests/tests/billing/cloudCreditsLockedRefusal.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ test.describe('Run refused for locked credits', { tag: '@cloud' }, () => {
await page.route('**/api/features', (route) =>
route.fulfill(jsonRoute({ subscription_required: true }))
)
await page.route('**/customers/balance', (route) =>
route.fulfill(jsonRoute({ amount_micros: 0, currency: 'usd' }))
)
})

test(
Expand Down
8 changes: 0 additions & 8 deletions browser_tests/tests/currentUserPopoverCredits.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,6 @@ const test = comfyPageFixture.extend({
route.fulfill({ status: 204 })
)

await page.route('**/customers/balance', (route) =>
route.fulfill({
status: 200,
contentType: 'application/json',
body: JSON.stringify(mockBalance)
})
)

// The popover sources its data from the workspace billing endpoints.
await page.route('**/api/billing/capabilities', (route) => {
if (route.request().method() !== 'GET') return route.fallback()
Expand Down
3 changes: 0 additions & 3 deletions browser_tests/tests/dialogs/billingPortalOrigin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,6 @@ async function setupRefusedPlanChange(page: Page, portalUrl: string) {
await page.route('**/api/billing/balance', (r) =>
r.fulfill(jsonRoute({ amount_micros: 6000, currency: 'usd' }))
)
await page.route('**/customers/balance', (r) =>
r.fulfill(jsonRoute({ amount_micros: 6000, currency: 'usd' }))
)
await page.route('**/api/billing/capabilities', (r) => {
if (r.request().method() !== 'GET') return r.fallback()
return r.fulfill(jsonRoute(createWorkspaceBillingCapabilities(PERSONAL)))
Expand Down
3 changes: 0 additions & 3 deletions browser_tests/tests/dialogs/billingRailParitySdkRail.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,6 @@ async function setupParity(
routes.balanceRequests.push(route.request())
return route.fulfill(jsonRoute(balance(server.balanceMicros)))
})
await page.route('**/customers/balance', (route) =>
route.fulfill(jsonRoute(balance(server.balanceMicros)))
)
await page.route('**/api/billing/plans', (route) =>
route.fulfill(jsonRoute(PLAN_CATALOG))
)
Expand Down
1 change: 0 additions & 1 deletion browser_tests/tests/dialogs/billingReadsSdkRail.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ async function mockCloudBoot(
eventPages.push(requested)
return r.fulfill(jsonRoute(eventsPage(Number(requested ?? 1))))
})
await page.route('**/customers/balance', (r) => r.fulfill(jsonRoute(BALANCE)))

return { reads, eventPages }
}
Expand Down
5 changes: 0 additions & 5 deletions browser_tests/tests/dialogs/billingSessionSdkRail.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,6 @@ const PENDING_TOPUP = {
started_at: '2026-09-20T00:00:00Z'
} satisfies BillingOpStatusResponse

/** The legacy personal balance read, which a rail-on load must not issue. */
const LEGACY_BALANCE_ROUTE = '/customers/balance'

interface BillingServer {
status: BillingStatusResponse
balance: BillingBalanceResponse
Expand Down Expand Up @@ -145,7 +142,6 @@ async function bootWithRailsOn(
return route.fulfill(jsonRoute(server.balance))
}
await page.route('**/api/billing/balance', answerBalance)
await page.route(`**${LEGACY_BALANCE_ROUTE}`, answerBalance)
await page.route(
`**/api/billing/ops/${PENDING_OPERATION_ID}`,
async (route) => {
Expand Down Expand Up @@ -330,7 +326,6 @@ test.describe('Billing SDK rails across a session', { tag: '@cloud' }, () => {
])
).toEqual(['fetch', 'fetch'])
expect(transports(wire.reads)).not.toContain('xhr')
expect(readsOf(wire.reads, LEGACY_BALANCE_ROUTE)).toEqual([])
})

test('never shows the balance as 0 or blank across five reloads', async ({
Expand Down
3 changes: 0 additions & 3 deletions browser_tests/tests/dialogs/cancelSubscriptionSdkRail.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,6 @@ async function mockCloudBoot(page: Page): Promise<CancelRoute> {
jsonRoute(createBillingCapabilities('ws-personal', { can_cancel: true }))
)
)
await page.route('**/customers/balance', (r) =>
r.fulfill(jsonRoute({ amount_micros: 0, currency: 'usd' }))
)

await page.route('**/api/billing/subscription/cancel', async (r) => {
requests.push(r.request())
Expand Down
10 changes: 0 additions & 10 deletions browser_tests/tests/dialogs/creditsTile.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ const jsonRoute = (body: unknown) => ({
body: JSON.stringify(body)
})

// Legacy `/customers/balance` and workspace `/api/billing/balance` share the
// same response shape, so one body fulfills both endpoints.
const balanceRoute = (balance: {
amount: number
monthly: number
Expand Down Expand Up @@ -168,10 +166,6 @@ async function mockCloudBoot(
)
)

await page.route('**/customers/balance', (r) =>
r.fulfill(balanceRoute(DEFAULT_BALANCE))
)

// Workspace billing (flag-on path) — a personal workspace now routes through
// `/api/billing/*`.
await page.route('**/api/billing/status', (r) =>
Expand Down Expand Up @@ -200,11 +194,7 @@ async function mockBalance(
page: Page,
balance: { amount: number; monthly: number; prepaid: number }
) {
await page.unroute('**/customers/balance')
await page.unroute('**/api/billing/balance')
await page.route('**/customers/balance', (r) =>
r.fulfill(balanceRoute(balance))
)
await page.route('**/api/billing/balance', (r) =>
r.fulfill(balanceRoute(balance))
)
Expand Down
3 changes: 0 additions & 3 deletions browser_tests/tests/dialogs/hostedBillingDestination.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,6 @@ async function mockCloudBoot(page: Page): Promise<CloudBootRequests> {
await page.route('**/api/billing/balance', (r) =>
r.fulfill(jsonRoute({ amount_micros: 6000, currency: 'usd' }))
)
await page.route('**/customers/balance', (r) =>
r.fulfill(jsonRoute({ amount_micros: 6000, currency: 'usd' }))
)
await page.route('**/api/billing/plans', (r) =>
r.fulfill(jsonRoute({ plans: [] }))
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,6 @@ async function mockCloudBoot(
)
)
})
await page.route('**/customers/balance', (r) =>
r.fulfill(
jsonRoute({
amount_micros: 0,
currency: 'usd'
} satisfies BillingBalanceResponse)
)
)

// Both lifecycle routes answer POST only. A regression to GET would
// otherwise be served the success fixture and pass every assertion below,
Expand Down
5 changes: 1 addition & 4 deletions browser_tests/tests/workspace/apiKeyLoginBilling.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ import {
*/
test.describe('API-key login billing surfaces', () => {
test('shows the key workspace context, balance, and activity from the workspace rail', async ({
comfyPage,
legacyBillingReads
comfyPage
}) => {
const page = comfyPage.page

Expand Down Expand Up @@ -52,7 +51,5 @@ test.describe('API-key login billing surfaces', () => {
.getByRole('button', { name: 'Activity' })
.click()
await expect(settingsDialog.contentArea).toContainText('Credits Added')

expect(legacyBillingReads).toEqual([])
})
})
7 changes: 2 additions & 5 deletions docs/architecture/domains/boundaries.json
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,7 @@
"src/platform/billing/composables/deriveBillingBanner.test.ts",
"src/platform/billing/composables/readOnRail.ts",
"src/platform/billing/composables/readOnRail.test.ts",
"src/platform/billing/composables/readWorkspaceBillingEvents.ts",
"src/platform/billing/composables/useBillingBanner.ts",
"src/platform/billing/composables/useBillingBanner.test.ts",
"src/platform/billing/composables/useBillingCapabilities.ts",
Expand All @@ -736,9 +737,7 @@
"src/platform/billing/composables/useWorkspaceBilling.test.ts",
"src/platform/billing/composables/useWorkspacePlanPricing.ts",
"src/platform/billing/stores/billingOperationStore.ts",
"src/platform/billing/stores/billingOperationStore.test.ts",
"src/platform/billing/subscription/utils/subscriptionCheckoutUtil.ts",
"src/platform/billing/subscription/utils/subscriptionCheckoutUtil.test.ts"
"src/platform/billing/stores/billingOperationStore.test.ts"
]
},
{
Expand All @@ -750,7 +749,6 @@
"src/platform/billing/hostedBillingRoutes.ts",
"src/platform/billing/hostedBillingRoutes.test.ts",
"src/platform/billing/subscribeInput.ts",
"src/platform/billing/subscription/utils/checkoutAttributionLoader.ts",
"src/platform/billing/subscription/utils/paymentReturnUrl.ts",
"src/platform/billing/subscription/utils/paymentReturnUrl.test.ts",
"src/platform/billing/subscription/utils/subscriptionCheckoutTracker.ts",
Expand Down Expand Up @@ -1014,7 +1012,6 @@
"patterns": [
"src/components/actionbar/ComfyRunButton/CloudRunButtonWrapper.vue",
"src/components/actionbar/ComfyRunButton/CloudRunButtonWrapper.test.ts",
"src/components/topbar/CloudBadge.vue",
"src/platform/cloud/notification/components/**",
"src/platform/cloud/oauth/OAuthConsentView.stories.ts",
"src/platform/cloud/oauth/OAuthConsentView.vue",
Expand Down
13 changes: 4 additions & 9 deletions docs/architecture/domains/records/billing.domain.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"id": "billing",
"capability": "Billing",
Expand Down Expand Up @@ -227,6 +227,10 @@
"path": "src/platform/billing/composables/readOnRail.ts",
"role": "application"
},
{
"path": "src/platform/billing/composables/readWorkspaceBillingEvents.ts",
"role": "application"
},
{
"path": "src/platform/billing/composables/useBillingBanner.ts",
"role": "application"
Expand Down Expand Up @@ -311,10 +315,6 @@
"path": "src/platform/billing/subscription/utils/**",
"role": "domain"
},
{
"path": "src/platform/billing/subscription/utils/checkoutAttributionLoader.ts",
"role": "infrastructure"
},
{
"path": "src/platform/billing/subscription/utils/paymentReturnUrl.ts",
"role": "infrastructure"
Expand All @@ -323,10 +323,6 @@
"path": "src/platform/billing/subscription/utils/subscriptionCheckoutTracker.ts",
"role": "infrastructure"
},
{
"path": "src/platform/billing/subscription/utils/subscriptionCheckoutUtil.ts",
"role": "application"
},
{
"path": "src/platform/billing/utils/**",
"role": "infrastructure"
Expand Down Expand Up @@ -479,7 +475,6 @@
"src/platform/billing/subscription/constants/tierPricing.test.ts",
"src/platform/billing/subscription/utils/subscriptionTierRank.test.ts",
"src/platform/billing/subscription/utils/subscriptionCheckoutTracker.test.ts",
"src/platform/billing/subscription/utils/subscriptionCheckoutUtil.test.ts",
"src/platform/billing/subscription/utils/retentionOffer.test.ts",
"src/platform/billing/subscription/composables/useSubscription.test.ts",
"src/platform/billing/subscription/launchCancellationFlow.test.ts",
Expand Down
4 changes: 0 additions & 4 deletions docs/architecture/domains/records/cloud.domain.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
"path": "src/components/actionbar/ComfyRunButton/CloudRunButtonWrapper.vue",
"role": "presentation"
},
{
"path": "src/components/topbar/CloudBadge.vue",
"role": "presentation"
},
{
"path": "src/extensions/core/cloudBadges.ts",
"role": "integration"
Expand Down
Loading
Loading