Files
Manan GuptaandJoshen Lim 6a0518dd86 fix(studio): forward HA flag to project-creation pre-flight checks (#50902)
## Summary

- Fixes MUL-1678: toggling High Availability on in the project-creation
wizard 400'd for orgs that are HA-entitled but not enrolled in the "V3
rollout ramp" feature flag on the backend, because two pre-flight
endpoints Studio calls before project creation didn't know about HA and
hit the ramp check the real create-project call already bypasses.
- Threads `highAvailability` through
`useOrganizationAvailableRegionsQuery` (`GET
/platform/projects/available-regions`, sent as
`high_availability=true|false` on the query string) and
`useProjectCreationPostgresVersionsQuery` /
`useAvailableOrioleImageVersion` (`POST
/platform/organizations/:slug/available-versions`, sent as
`high_availability` in the body), including their query-key cache keys
so HA and non-HA responses for the same org/provider/size don't collide.
- Wires the (already form-tracked) `highAvailability` value into every
call site: `ProjectCreationForm.tsx`, `RegionSelector.tsx`, and a new
`highAvailability` prop on `PostgresVersionSelector.tsx` passed from
`InternalOnlyConfiguration.tsx`.

## Problem

The project-creation wizard's HA toggle is wired into the actual
project-create request, but two pre-flight calls Studio makes before
that (available regions, available Postgres versions) had no way to
signal HA, so the backend's ramp-flag gate rejected them for HA-entitled
orgs outside the ramp.

## Solution

Add an optional `highAvailability` field end-to-end on the Studio side:
query hook variables, cache keys, request serialization, and the
components that already track the toggle via `useWatch`.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Bug Fixes**
* Available regions and database versions in project creation now
reflect the selected high-availability setting.
* The Create button remains disabled while available regions are
loading.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: GuptaManan100 <guptamanan100@gmail.com>
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-09-29 20:39:01 +05:30

44 lines
2.3 KiB
TypeScript

export const organizationKeys = {
list: () => ['organizations'] as const,
detail: (slug?: string) => ['organizations', slug] as const,
members: (slug?: string) => ['organizations', slug, 'members'] as const,
mfa: (slug?: string) => ['organizations', slug, 'mfa'] as const,
paymentMethods: (slug: string | undefined) => ['organizations', slug, 'payment-methods'] as const,
entitlements: (slug: string | undefined) => ['entitlements', slug] as const,
roles: (slug: string | undefined) => ['organizations', slug, 'roles'] as const,
freeProjectLimitCheck: (slug: string | undefined) =>
['organizations', slug, 'free-project-limit-check'] as const,
customerProfile: (slug: string | undefined) =>
['organizations', slug, 'customer-profile'] as const,
auditLogs: (
slug: string | undefined,
{ date_start, date_end }: { date_start: string | undefined; date_end: string | undefined }
) => ['organizations', slug, 'audit-logs', { date_start, date_end }] as const,
subscriptionPreview: (
slug: string | undefined,
tier: string | undefined,
params?: { address?: Record<string, unknown>; taxId?: Record<string, unknown> }
) => ['organizations', slug, 'subscription', 'preview', tier, params] as const,
taxId: (slug: string | undefined) => ['organizations', slug, 'tax-ids'] as const,
tokenValidation: (slug: string | undefined, token: string | undefined) =>
['organizations', slug, 'validate-token', token] as const,
projectClaim: (slug: string, token: string) =>
['organizations', slug, 'project-claim', token] as const,
availableRegions: (
slug: string | undefined,
cloudProvider: string,
size?: string,
highAvailability?: boolean
) => ['organizations', slug, 'available-regions', cloudProvider, size, highAvailability] as const,
creationPreview: (
tier: string | undefined,
params?: { address?: Record<string, unknown>; taxId?: Record<string, unknown> }
) => ['organizations', 'creation-preview', tier, params] as const,
previewCreditCode: (slug: string | undefined, code: string) =>
['organizations', slug, 'preview-credit-code', code] as const,
creditTopUpPreview: (
slug: string | undefined,
params?: { amount?: number; address?: Record<string, unknown>; taxId?: Record<string, unknown> }
) => ['organizations', slug, 'credits', 'preview', params] as const,
}