Skip to content

Commit 8b48d05

Browse files
claude[bot]claude
andauthored
refactor: derive workspaceApi types from @comfyorg/ingest-types (#14771)
&lt;!-- ccr-slack-attribution --&gt; _Requested by **Christian Byrne** · [Slack thread](https://comfy-organization.slack.com/archives/C0BHR8PMK1D/p1785912253845389?thread_ts=1785912253.845389&cid=C0BHR8PMK1D)_ ## Summary `workspaceApi.ts` hand-declared ~40 types that duplicate exports already generated from cloud's ingest OpenAPI spec, letting them silently drift from the real contract. ## Changes - **What**: `workspaceApi.ts` now imports types from `@comfyorg/ingest-types` instead of hand-declaring them. Types with real FE-only extensions (`Member`, `BillingStatusResponse`) keep a thin local intersection on top of the generated type; ~8 pure-literal-union types with no distinct generated export stay local (verified their literals still match). `CurrentTeamCreditStop` is renamed to the generated `TeamCreditStopSummary` (4 call sites). - Two confirmed type/behavior bugs from the drift: - `ResubscribeResponse.status` only allowed `'active'`; the generated type also allows `'pending'`. `useWorkspaceBilling.resubscribe()` now polls the billing op to a terminal state when the response is `'pending'` instead of reporting success immediately (mirrors the existing `cancelSubscription` pattern). - `PaginationInfo` was missing `has_more`/`next_cursor`. Fixed via the generated type; wiring an actual "load more" UI for the member/invite lists is a separate follow-up, not done here. - Refreshed `@comfyorg/ingest-types` and `@comfyorg/registry-types` against current cloud `main` first (both were stale): ingest gained `BillingStatusResponse.pending_billing_op_type`; registry gained new Topaz upscale model fields (unrelated to this refactor, just a freshness byproduct). - **Breaking**: none (all call-site type changes are non-breaking widenings, verified via `pnpm typecheck`). ## Review Focus - `subscription_tier` fields (`WorkspaceWithRole`, `Plan`, `BillingStatusResponse`) intentionally keep the app's registry-derived `SubscriptionTier` (no `'TEAM'`) instead of ingest's wider enum, to match existing downstream usage — flagged in code comments. - `useWorkspaceBilling.resubscribe()` behavior change: added tests for both the pending-succeeds and pending-fails paths. --- _Generated by [Claude Code](https://claude.ai/code/session_013CkfGtjAnvxmBDU56gAzAk)_ Co-authored-by: Claude <noreply@anthropic.com>
1 parent db147c0 commit 8b48d05

10 files changed

Lines changed: 229 additions & 308 deletions

File tree

packages/ingest-types/src/types.gen.ts

Lines changed: 14 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/ingest-types/src/zod.gen.ts

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/registry-types/src/comfyRegistryTypes.ts

Lines changed: 48 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/composables/billing/types.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ import type {
66
BillingStatus,
77
BillingSubscriptionStatus,
88
CreateTopupResponse,
9-
CurrentTeamCreditStop,
109
Plan,
1110
PreviewSubscribeOptions,
1211
PreviewSubscribeResponse,
1312
SubscribeOptions,
1413
SubscribeResponse,
1514
SubscriptionDuration,
1615
SubscriptionTier,
17-
TeamCreditStops
16+
TeamCreditStops,
17+
TeamCreditStopSummary
1818
} from '@/platform/workspace/api/workspaceApi'
1919

2020
export type BillingType = 'legacy' | 'workspace'
@@ -94,7 +94,7 @@ export interface BillingState {
9494
/** Team per-credit pricing ladder; null for personal/legacy. */
9595
teamCreditStops: ComputedRef<TeamCreditStops | null>
9696
/** The team's currently-subscribed credit stop; null for personal/legacy. */
97-
currentTeamCreditStop: ComputedRef<CurrentTeamCreditStop | null>
97+
currentTeamCreditStop: ComputedRef<TeamCreditStopSummary | null>
9898
/** Effective member limit for the current workspace; zero is unlimited. */
9999
maxSeats: ComputedRef<number | null>
100100
/** Seats occupied in the current workspace. */

src/composables/billing/useNextInvoice.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ import { computed } from 'vue'
33
import type { SubscriptionInfo } from '@/composables/billing/types'
44
import { useBillingContext } from '@/composables/billing/useBillingContext'
55
import type {
6-
CurrentTeamCreditStop,
76
Plan,
87
SubscriptionDuration,
9-
TeamCreditStops
8+
TeamCreditStops,
9+
TeamCreditStopSummary
1010
} from '@/platform/workspace/api/workspaceApi'
1111

1212
export interface NextInvoiceInputs {
1313
subscription: SubscriptionInfo | null
1414
planSlug: string | null
1515
plans: Plan[]
1616
teamCreditStops: TeamCreditStops | null
17-
currentTeamCreditStop: CurrentTeamCreditStop | null
17+
currentTeamCreditStop: TeamCreditStopSummary | null
1818
}
1919

2020
export interface NextInvoice {

src/platform/cloud/subscription/components/CreditsTile.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { createI18n } from 'vue-i18n'
66

77
import type { BalanceInfo, SubscriptionInfo } from '@/composables/billing/types'
88
import CreditsTile from '@/platform/cloud/subscription/components/CreditsTile.vue'
9-
import type { CurrentTeamCreditStop } from '@/platform/workspace/api/workspaceApi'
9+
import type { TeamCreditStopSummary } from '@/platform/workspace/api/workspaceApi'
1010

1111
type Balance = Pick<
1212
BalanceInfo,
@@ -15,7 +15,7 @@ type Balance = Pick<
1515
type Subscription = Pick<SubscriptionInfo, 'duration' | 'renewalDate'> & {
1616
tier: SubscriptionInfo['tier'] | 'TEAM'
1717
}
18-
type TeamStop = CurrentTeamCreditStop
18+
type TeamStop = TeamCreditStopSummary
1919

2020
const state = vi.hoisted(() => ({
2121
balance: null as Balance | null,

0 commit comments

Comments
 (0)