Repository navigation
feat(studio): point replica deep links at Infrastructure and recommend compute - #48921
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
4 Skipped Deployments
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughRead replica management moves from Database Replication to Settings Infrastructure. The change adds Infrastructure creation and detail flows, updates legacy redirects and links, removes replica handling from replication destinations and diagrams, and adds compute recommendation support. ChangesInfrastructure read replica management
Estimated code review effort: 5 (Critical) | ~120 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant ReplicationPage
participant LegacyRedirect
participant InfrastructurePage
participant ReadReplicaForm
User->>ReplicationPage: open legacy replica route
ReplicationPage->>LegacyRedirect: resolve replica route
LegacyRedirect->>InfrastructurePage: redirect to Infrastructure detail page
InfrastructurePage->>ReadReplicaForm: open replica management flow
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🎭 Playwright Test Results (next)Details
Skipped testsFeatures › auth-users.spec.ts › should show web3 users as enabled when the matching web3 provider is enabled |
There was a problem hiding this comment.
Actionable comments posted: 9
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
apps/studio/components/interfaces/Database/Replication/ReplicationDiagram/Nodes.tsx (1)
37-40: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winRemove the stale
ReadReplicaNodeimport andreadReplicaregistration fromEmptyReplicationDiagram.tsx.ReadReplicaNodeis no longer exported fromNodes.tsx, so this causes a build-time error.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/components/interfaces/Database/Replication/ReplicationDiagram/Nodes.tsx` around lines 37 - 40, Remove the stale ReadReplicaNode import and its readReplica registration from EmptyReplicationDiagram.tsx, leaving the remaining replication node registrations unchanged since ReadReplicaNode is no longer exported by Nodes.tsx.Source: Coding guidelines
apps/studio/components/interfaces/Database/Replication/Destinations.tsx (1)
145-147: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winKeep the read-replica migration path reachable without Pipelines access.
When all Pipelines flags are disabled,
newDestinationDefaultTypeisnull. The page disables the only control that opensDestinationPanel, but the read-replica migration callout only renders inside that panel. Users cannot discover the Infrastructure flow.
apps/studio/components/interfaces/Database/Replication/Destinations.tsx#L145-L147: render an Infrastructure migration link outsideDestinationPanelwhen read replicas are enabled.apps/studio/components/interfaces/Database/Replication/Destinations.tsx#L255-L259: do not make the disabled Add destination control the only route to the migration guidance.apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationTypeSelection.tsx#L224-L228: retain this callout as supplemental guidance, not the only migration path.apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationTypeSelection.test.tsx#L162-L192: add an integration test that rendersDestinationswith all Pipelines flags disabled and verifies that the Infrastructure link remains reachable.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/components/interfaces/Database/Replication/Destinations.tsx` around lines 145 - 147, The Destinations page must expose the Infrastructure migration flow even when all Pipelines flags disable the Add destination control. In apps/studio/components/interfaces/Database/Replication/Destinations.tsx lines 145-147, add an external migration link rendered outside DestinationPanel when read replicas are enabled; at lines 255-259, ensure the disabled Add destination control is not the sole route. Keep the DestinationTypeSelection callout at lines 224-228 as supplemental guidance, and add an integration test in apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationTypeSelection.test.tsx lines 162-192 verifying the Infrastructure link remains reachable with all Pipelines flags disabled.
🧹 Nitpick comments (15)
apps/studio/components/ui/UpgradePlanButton.tsx (1)
71-77: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueReplace the nested ternary.
Line 75 adds another level to an existing nested ternary. Use flat conditional logic for the three URL branches.
Proposed refactor
- const href = isRequestingToDisableSpendCap - ? `/org/${slug ?? '_'}/billing?panel=costControl&source=${source}` - : isOnPaidPlanAndRequestingToPurchaseAddon - ? addon === 'computeSize' - ? `${getInfrastructurePath(ref)}`#compute`` - : `/project/${ref ?? '_'}/settings/addons?panel=${addon}&source=${source}` - : `/org/${slug ?? '_'}/billing?panel=subscriptionPlan&source=${source}` + let href = `/org/${slug ?? '_'}/billing?panel=subscriptionPlan&source=${source}` + if (isRequestingToDisableSpendCap) { + href = `/org/${slug ?? '_'}/billing?panel=costControl&source=${source}` + } else if (isOnPaidPlanAndRequestingToPurchaseAddon) { + href = + addon === 'computeSize' + ? `${getInfrastructurePath(ref)}`#compute`` + : `/project/${ref ?? '_'}/settings/addons?panel=${addon}&source=${source}` + }As per coding guidelines, “Do not nest ternaries.”
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/components/ui/UpgradePlanButton.tsx` around lines 71 - 77, Refactor the href assignment in UpgradePlanButton to remove the nested ternary structure and express the three URL branches with flat conditional logic. Preserve the existing priority and URL behavior for isRequestingToDisableSpendCap, addon === 'computeSize', and the remaining addon and subscription-plan cases.Source: Coding guidelines
apps/studio/tests/components/Settings/Infrastructure/ReadReplicaEligibilityWarnings.test.tsx (2)
25-37: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueKeep the
eligibilityfactory aligned with the hook return type.The factory lists the flags returned by
useCheckEligibilityDeployReplica. It is an untyped object literal, so a field added to or removed from the hook does not fail this file at compile time. Annotate the factory withReturnType<typeof useCheckEligibilityDeployReplica>so the mock and the hook stay in sync.This matters for the entitlement flag proposed on
useCheckEligibilityDeployReplica.ts.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/tests/components/Settings/Infrastructure/ReadReplicaEligibilityWarnings.test.tsx` around lines 25 - 37, Update the eligibility factory to use ReturnType<typeof useCheckEligibilityDeployReplica> as its return type, while preserving the existing delta merge behavior. Ensure the test mock remains compile-time aligned with all fields returned by useCheckEligibilityDeployReplica.
19-19: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd coverage for the free-plan branch and for the recommendation click.
Line 19 pins the mocked organization to
plan.id === 'pro'for every test in the file. TheisFreePlanbranch that rendersUpgradePlanButtonis therefore never exercised, although this PR introduced that branch.The tests also assert only that the buttons render. They do not assert that a click calls
requestRecommendComputewithci_smallorci_xlarge, which is the behavior this PR adds.Add a free-plan test that overrides the organization mock, and add click assertions that spy on
requestRecommendCompute.Also applies to: 55-55
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/tests/components/Settings/Infrastructure/ReadReplicaEligibilityWarnings.test.tsx` at line 19, Add coverage in ReadReplicaEligibilityWarnings tests for the free-plan path by overriding useSelectedOrganizationQuery to return a free plan and asserting UpgradePlanButton renders. Add requestRecommendCompute spy assertions for recommendation button clicks, verifying ci_small and ci_xlarge are passed for their respective buttons while preserving existing rendering checks.apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicas.constants.ts (1)
5-11: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider a typed literal map instead of a string index signature.
The
[key: string]index signature removes key checking. A typo such asREPLICA_STATUS.INIT_READ_REPLICAAresolves without a compile error, and consumers lose literal types.satisfieskeeps the value constraint and preserves the literal keys.♻️ Proposed refactor
-export const REPLICA_STATUS: { - [key: string]: components['schemas']['DatabaseStatusResponse']['status'] -} = { +export const REPLICA_STATUS = { ...PROJECT_STATUS, INIT_READ_REPLICA: 'INIT_READ_REPLICA', INIT_READ_REPLICA_FAILED: 'INIT_READ_REPLICA_FAILED', -} +} satisfies Record<string, components['schemas']['DatabaseStatusResponse']['status']>Note:
PROJECT_STATUSinapps/studio/lib/constants/infrastructure.tsis itself typed with a string index signature, so the spread may widen the keys. Verify the resulting type before applying.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicas.constants.ts` around lines 5 - 11, Replace the string index signature on REPLICA_STATUS with a typed literal map using satisfies, preserving the DatabaseStatusResponse status constraint while retaining literal key checking and value types. Account for PROJECT_STATUS’s widened spread type and verify the resulting REPLICA_STATUS keys remain checked rather than reintroducing an index signature.apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/useCheckEligibilityDeployReplica.ts (1)
23-26: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueDrop the
useMemoaroundisNotOnHigherPlan.The computation is one
Array.prototype.includescall over a three-element literal. The memo costs more than the computation, and the dependency list usesorgrather thanorg?.plan.id.♻️ Proposed refactor
- const isNotOnHigherPlan = useMemo( - () => !['team', 'enterprise', 'platform'].includes(org?.plan.id ?? ''), - [org] - ) + const isNotOnHigherPlan = !['team', 'enterprise', 'platform'].includes(org?.plan.id ?? '')Remove the now-unused
useMemoimport.As per coding guidelines: "Do not use
useMemooruseCallbackby default; use them only for measured expense or referential stability required by a memoized child."🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/useCheckEligibilityDeployReplica.ts` around lines 23 - 26, Remove the useMemo wrapper from isNotOnHigherPlan and compute the plan eligibility directly using the existing three-plan includes check. Remove the now-unused useMemo import, preserving the current fallback for a missing organization or plan.Source: Coding guidelines
apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/index.tsx (1)
142-144: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueWrap the disabled "Deploy replica" button with
ButtonTooltip.The button is disabled when
canDeployReplicaisfalse. The reason appears in the warnings panel only when a matching eligibility flag exists. A tooltip states the reason at the control itself.As per coding guidelines: "use
ButtonTooltipfor explanations of disabled buttons".🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/index.tsx` around lines 142 - 144, Wrap the disabled “Deploy replica” Button in the read-replica form with ButtonTooltip, using the existing canDeployReplica eligibility and warning reason to provide the disabled-state explanation at the control. Preserve the current loading and onSubmit behavior, and follow the established ButtonTooltip usage pattern in the surrounding codebase.Source: Coding guidelines
apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/recommendCompute.test.ts (1)
21-33: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRelease the subscriber after the second test and cover the no-subscriber case.
The second test never unsubscribes, so
secondstays registered in the module singleton after the file finishes. Any test added later in this file would receive the stale listener.The suite also omits the case where no subscriber is registered. That path is the one that fails silently in production.
♻️ Proposed refactor
it('replaces the previous subscriber', () => { const first = vi.fn() const second = vi.fn() - subscribeRecommendCompute(first) - subscribeRecommendCompute(second) + const unsubscribeFirst = subscribeRecommendCompute(first) + const unsubscribeSecond = subscribeRecommendCompute(second) requestRecommendCompute('ci_xlarge') expect(first).not.toHaveBeenCalled() expect(second).toHaveBeenCalledWith('ci_xlarge') + + unsubscribeFirst() + unsubscribeSecond() + }) + + it('does not throw when no subscriber is registered', () => { + expect(() => requestRecommendCompute('ci_small')).not.toThrow() })🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/recommendCompute.test.ts` around lines 21 - 33, Update the recommend-compute subscription tests around subscribeRecommendCompute and requestRecommendCompute to cover request behavior when no subscriber is registered, and ensure the replacement-subscriber test releases its active second subscriber before completion. Preserve the existing assertion that only the latest subscriber receives the request, while preventing module-level subscription state from leaking into later tests.apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/useGetReplicaCost.ts (1)
30-50: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winReplace
@ts-ignoreand theas DiskTypecasts with validated disk-attribute parsing.
diskConfiguration.attributesis a discriminated API union. The suppression hides the union-narrowing error, and the casts bypass validation before values reach the pricing helpers. Parse the attributes with a zod discriminated-union schema, then use the parsedtypeand fields directly. Preserve the platform API’s supportedthroughput_mbpsfield.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/useGetReplicaCost.ts` around lines 30 - 50, Replace the `@ts-ignore` and DiskType casts in the useGetReplicaCost pricing flow with zod discriminated-union parsing of diskConfiguration.attributes. Validate the API union before destructuring, then pass the parsed type and fields directly to DISK_PRICING, calculateIOPSPrice, and calculateThroughputPrice while preserving the supported throughput_mbps field.Source: Coding guidelines
apps/studio/pages/project/[ref]/database/replication/replica/[replicaId].tsx (1)
16-19: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winThe client redirect duplicates the shared redirect rule and drops query and hash.
apps/studio/redirects.shared.tslines 122-126 already map this source path to the infrastructure replica route, andmatchRedirectpreserves query and hash throughpreserveQueryAndHash. This effect callsrouter.replace(getReadReplicaPath(ref, replicaId)), which discardsrouter.asPathquery params and the fragment. If a user reaches this component because the config-level redirect did not apply, deep-link state is lost.Either forward the incoming query and hash here, or document that this component is only a fallback for the runtime that does not evaluate the shared redirect table.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/pages/project/`[ref]/database/replication/replica/[replicaId].tsx around lines 16 - 19, Update the redirect effect using router.replace and getReadReplicaPath to preserve the incoming router.asPath query parameters and hash, matching the shared redirect behavior from matchRedirect and preserveQueryAndHash. Keep the existing ref and replicaId guard and destination path intact while forwarding the deep-link state.apps/studio/components/interfaces/Database/Replication/ReplicationDiagram/Edges.tsx (1)
16-20: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRemove the unused
typefield fromEdgeData.Line 95 now destructures only
identifierandshiftEdgeEnd. Thetypefield is no longer read in this component. Drop it unless a producer still relies on the shape.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/components/interfaces/Database/Replication/ReplicationDiagram/Edges.tsx` around lines 16 - 20, Remove the unused type field from the EdgeData type definition in Edges.tsx, since the component only consumes identifier and shiftEdgeEnd. Verify any EdgeData producers still type-check without it, preserving the existing destructuring and behavior.apps/studio/pages/project/[ref]/settings/infrastructure/replica/[replicaId].tsx (2)
147-154: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExplain the disabled restart button and reuse the status constant.
Line 150 disables the button without any explanation to the user. The established studio pattern wraps a disabled button with a tooltip that states the reason. Line 150 also compares against the string literal
'ACTIVE_HEALTHY'whileREPLICA_STATUSis already imported and used at lines 66-68.Based on learnings: "when a button control is disabled, follow the existing/established button tooltip pattern used elsewhere in
apps/studio".♻️ Proposed fix
- <Button - key="restart" - variant="default" - disabled={status !== 'ACTIVE_HEALTHY'} - onClick={() => setShowConfirmRestart(true)} - > - Restart replica - </Button>, + <ButtonTooltip + key="restart" + variant="default" + disabled={status !== REPLICA_STATUS.ACTIVE_HEALTHY} + tooltip={{ + content: { + side: 'bottom', + text: + status !== REPLICA_STATUS.ACTIVE_HEALTHY + ? 'The replica must be healthy before it can be restarted' + : undefined, + }, + }} + onClick={() => setShowConfirmRestart(true)} + > + Restart replica + </ButtonTooltip>,🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/pages/project/`[ref]/settings/infrastructure/replica/[replicaId].tsx around lines 147 - 154, Update the restart Button to compare against the imported REPLICA_STATUS.ACTIVE_HEALTHY constant and wrap the disabled control in the established studio tooltip pattern, displaying the reason the replica must be healthy before restart is available. Preserve the existing restart confirmation behavior and button styling.Source: Learnings
56-60: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueDefault
useMemoon cheap scalar derivations. Both sites memoize a small pure computation over two scalar inputs. No result feeds a memoized child, and no cost was measured. The studio guideline states: "Do not useuseMemooruseCallbackby default; use them only for measured expense or referential stability required by a memoized child."
apps/studio/pages/project/[ref]/settings/infrastructure/replica/[replicaId].tsx#L56-L60: callgetStatusLabelandgetIsInTransitiondirectly during render.apps/studio/components/interfaces/Database/Replication/ReplicationDiagram/Edges.tsx#L110-L118: build thereplicationStateobject directly during render.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/pages/project/`[ref]/settings/infrastructure/replica/[replicaId].tsx around lines 56 - 60, Remove the unnecessary useMemo wrappers: in apps/studio/pages/project/[ref]/settings/infrastructure/replica/[replicaId].tsx lines 56-60, call getStatusLabel and getIsInTransition directly during render; in apps/studio/components/interfaces/Database/Replication/ReplicationDiagram/Edges.tsx lines 110-118, construct replicationState directly during render. No other behavior changes are needed.Source: Coding guidelines
apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/AddReadReplicaSheet.tsx (1)
24-24: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRename
visibletoisOpen.Line 24 stores a boolean. Use the required boolean-name prefix.
As per coding guidelines, “Use boolean names beginning with
is,has,can, orshould.”🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/AddReadReplicaSheet.tsx` at line 24, Rename the boolean variable visible to isOpen in the AddReadReplicaSheet component and update all references to use isOpen consistently.Source: Coding guidelines
apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicasSection.tsx (1)
49-52: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueDerive
readReplicasduring render.This filter is simple derived data. Remove the default
useMemo, then make the polling effect depend ondatabasesandprojectRefdirectly.As per coding guidelines, “Do not use
useMemooruseCallbackby default.”🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicasSection.tsx` around lines 49 - 52, Update the readReplicas derivation in ReadReplicasSection to filter databases directly during render instead of using useMemo. Adjust the polling effect dependencies to reference databases and projectRef directly, and remove the now-unused useMemo import.Source: Coding guidelines
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationPanel.tsx (1)
154-202: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winFlatten the sheet state rendering.
The nested ternary combines the Pipelines waitlist, enablement, and form states. Use early returns or a named conditional block instead.
As per coding guidelines, “Do not nest ternaries.”
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationPanel.tsx` around lines 154 - 202, Refactor the conditional rendering in DestinationPanel around enablePgReplicate and replicationNotEnabled so the Pipelines waitlist, enablement callout, and DestinationForm states are expressed with early returns or a named conditional block. Remove the nested ternary while preserving the existing rendering order, props, and behavior for each state.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@apps/studio/components/interfaces/Database/Replication/ReplicationDiagram/Edges.tsx`:
- Around line 148-153: Update the edge animation in the component containing the
animated edge element: either define the animate-edge-flow class with its
required keyframes in the tracked styling system, or replace the className usage
with the existing inline animation configuration. Ensure the animation still
runs whenever shouldAnimate is true.
In `@apps/studio/components/interfaces/DiskManagement/DiskManagementForm.tsx`:
- Around line 384-387: Update both recommendation handlers in
DiskManagementForm.tsx at lines 384-387 and 400-403 to trigger validation for
provisionedIOPS and throughput after setting computeSize, matching the dependent
validation performed by ComputeSizeField.
In
`@apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/index.tsx`:
- Around line 44-46: Update the defaultRegion initialization near
AWS_REGIONS_DEFAULT so a failed lookup cannot produce the invalid string
fallback 'ap-southeast-1'. Use a valid AWS_REGIONS key or explicitly handle the
missing entry before the later `.code` access, ensuring the existing
region-selection guards remain safe.
In
`@apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/useCheckEligibilityDeployReplica.ts`:
- Around line 55-77: Add hasReadReplicaAccess to the returned object from
useCheckEligibilityDeployReplica.ts at lines 55-77 so consumers can explain
entitlement failures. In ReadReplicaEligibilityWarnings.tsx at lines 249-277,
add a warning branch for missing read-replica access and a final Admonition
fallback whenever can is false, ensuring the component never returns undefined.
- Around line 45-53: Update the eligibility hook to return an isLoading flag
combining isLoadingReplicas, isLoadingAddons, and the absence of project, while
preserving the existing eligibility calculations after data resolves. In
ReadReplicaEligibilityWarnings, use this flag to render the existing skeleton
instead of warnings until all required queries and project data are available.
In
`@apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/useGetReplicaCost.ts`:
- Around line 66-78: Update the disk, iops, and throughput label construction in
the pricing result to avoid rendering undefined values while diskConfiguration
is unavailable: use the existing readReplicaDiskSizes value for the disk size
instead of recalculating size_gb * 1.25, and provide safe fallback values for
missing type, iops, and throughput_mbps before formatting the labels.
In
`@apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/recommendCompute.ts`:
- Around line 26-39: Update
apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/recommendCompute.ts
lines 26-39 so requestRecommendCompute returns a boolean indicating whether
recommendComputeListener received the recommendation. Update
apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/ReadReplicaEligibilityWarnings.tsx
lines 80-85 so handleRecommendCompute checks that result and, when delivery
fails, shows a toast.error or navigates to the compute section instead of
silently continuing.
In
`@apps/studio/pages/project/`[ref]/settings/infrastructure/replica/[replicaId].tsx:
- Around line 88-98: Flatten the nested ternary used by the Badge `variant` prop
near `statusLabel` by deriving the value through a small lookup or early-return
helper. Preserve `success` for `Healthy`, `destructive` for `Failed`, and
`default` for all other statuses.
In
`@apps/studio/routes/project/`$ref/settings/infrastructure/replica/$replicaId.tsx:
- Around line 5-8: Update the route hierarchy around
InfrastructureReadReplicaRoute so the replica page can render: either add an
Outlet to SettingsInfrastructureRoute or flatten the generated route structure.
Preserve the existing replica route component and settings layout metadata.
---
Outside diff comments:
In `@apps/studio/components/interfaces/Database/Replication/Destinations.tsx`:
- Around line 145-147: The Destinations page must expose the Infrastructure
migration flow even when all Pipelines flags disable the Add destination
control. In
apps/studio/components/interfaces/Database/Replication/Destinations.tsx lines
145-147, add an external migration link rendered outside DestinationPanel when
read replicas are enabled; at lines 255-259, ensure the disabled Add destination
control is not the sole route. Keep the DestinationTypeSelection callout at
lines 224-228 as supplemental guidance, and add an integration test in
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationTypeSelection.test.tsx
lines 162-192 verifying the Infrastructure link remains reachable with all
Pipelines flags disabled.
In
`@apps/studio/components/interfaces/Database/Replication/ReplicationDiagram/Nodes.tsx`:
- Around line 37-40: Remove the stale ReadReplicaNode import and its readReplica
registration from EmptyReplicationDiagram.tsx, leaving the remaining replication
node registrations unchanged since ReadReplicaNode is no longer exported by
Nodes.tsx.
---
Nitpick comments:
In
`@apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationPanel.tsx`:
- Around line 154-202: Refactor the conditional rendering in DestinationPanel
around enablePgReplicate and replicationNotEnabled so the Pipelines waitlist,
enablement callout, and DestinationForm states are expressed with early returns
or a named conditional block. Remove the nested ternary while preserving the
existing rendering order, props, and behavior for each state.
In
`@apps/studio/components/interfaces/Database/Replication/ReplicationDiagram/Edges.tsx`:
- Around line 16-20: Remove the unused type field from the EdgeData type
definition in Edges.tsx, since the component only consumes identifier and
shiftEdgeEnd. Verify any EdgeData producers still type-check without it,
preserving the existing destructuring and behavior.
In
`@apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/AddReadReplicaSheet.tsx`:
- Line 24: Rename the boolean variable visible to isOpen in the
AddReadReplicaSheet component and update all references to use isOpen
consistently.
In
`@apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/index.tsx`:
- Around line 142-144: Wrap the disabled “Deploy replica” Button in the
read-replica form with ButtonTooltip, using the existing canDeployReplica
eligibility and warning reason to provide the disabled-state explanation at the
control. Preserve the current loading and onSubmit behavior, and follow the
established ButtonTooltip usage pattern in the surrounding codebase.
In
`@apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/useCheckEligibilityDeployReplica.ts`:
- Around line 23-26: Remove the useMemo wrapper from isNotOnHigherPlan and
compute the plan eligibility directly using the existing three-plan includes
check. Remove the now-unused useMemo import, preserving the current fallback for
a missing organization or plan.
In
`@apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/useGetReplicaCost.ts`:
- Around line 30-50: Replace the `@ts-ignore` and DiskType casts in the
useGetReplicaCost pricing flow with zod discriminated-union parsing of
diskConfiguration.attributes. Validate the API union before destructuring, then
pass the parsed type and fields directly to DISK_PRICING, calculateIOPSPrice,
and calculateThroughputPrice while preserving the supported throughput_mbps
field.
In
`@apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicas.constants.ts`:
- Around line 5-11: Replace the string index signature on REPLICA_STATUS with a
typed literal map using satisfies, preserving the DatabaseStatusResponse status
constraint while retaining literal key checking and value types. Account for
PROJECT_STATUS’s widened spread type and verify the resulting REPLICA_STATUS
keys remain checked rather than reintroducing an index signature.
In
`@apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicasSection.tsx`:
- Around line 49-52: Update the readReplicas derivation in ReadReplicasSection
to filter databases directly during render instead of using useMemo. Adjust the
polling effect dependencies to reference databases and projectRef directly, and
remove the now-unused useMemo import.
In
`@apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/recommendCompute.test.ts`:
- Around line 21-33: Update the recommend-compute subscription tests around
subscribeRecommendCompute and requestRecommendCompute to cover request behavior
when no subscriber is registered, and ensure the replacement-subscriber test
releases its active second subscriber before completion. Preserve the existing
assertion that only the latest subscriber receives the request, while preventing
module-level subscription state from leaking into later tests.
In `@apps/studio/components/ui/UpgradePlanButton.tsx`:
- Around line 71-77: Refactor the href assignment in UpgradePlanButton to remove
the nested ternary structure and express the three URL branches with flat
conditional logic. Preserve the existing priority and URL behavior for
isRequestingToDisableSpendCap, addon === 'computeSize', and the remaining addon
and subscription-plan cases.
In
`@apps/studio/pages/project/`[ref]/database/replication/replica/[replicaId].tsx:
- Around line 16-19: Update the redirect effect using router.replace and
getReadReplicaPath to preserve the incoming router.asPath query parameters and
hash, matching the shared redirect behavior from matchRedirect and
preserveQueryAndHash. Keep the existing ref and replicaId guard and destination
path intact while forwarding the deep-link state.
In
`@apps/studio/pages/project/`[ref]/settings/infrastructure/replica/[replicaId].tsx:
- Around line 147-154: Update the restart Button to compare against the imported
REPLICA_STATUS.ACTIVE_HEALTHY constant and wrap the disabled control in the
established studio tooltip pattern, displaying the reason the replica must be
healthy before restart is available. Preserve the existing restart confirmation
behavior and button styling.
- Around line 56-60: Remove the unnecessary useMemo wrappers: in
apps/studio/pages/project/[ref]/settings/infrastructure/replica/[replicaId].tsx
lines 56-60, call getStatusLabel and getIsInTransition directly during render;
in
apps/studio/components/interfaces/Database/Replication/ReplicationDiagram/Edges.tsx
lines 110-118, construct replicationState directly during render. No other
behavior changes are needed.
In
`@apps/studio/tests/components/Settings/Infrastructure/ReadReplicaEligibilityWarnings.test.tsx`:
- Around line 25-37: Update the eligibility factory to use ReturnType<typeof
useCheckEligibilityDeployReplica> as its return type, while preserving the
existing delta merge behavior. Ensure the test mock remains compile-time aligned
with all fields returned by useCheckEligibilityDeployReplica.
- Line 19: Add coverage in ReadReplicaEligibilityWarnings tests for the
free-plan path by overriding useSelectedOrganizationQuery to return a free plan
and asserting UpgradePlanButton renders. Add requestRecommendCompute spy
assertions for recommendation button clicks, verifying ci_small and ci_xlarge
are passed for their respective buttons while preserving existing rendering
checks.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: e0c130b3-96e7-4664-887b-9e2d8a230ae5
⛔ Files ignored due to path filters (1)
apps/studio/routeTree.gen.tsis excluded by!**/routeTree.gen.ts
📒 Files selected for processing (59)
apps/studio/TANSTACK_MIGRATION.mdapps/studio/components/interfaces/Database/Replication/DestinationIcon.test.tsxapps/studio/components/interfaces/Database/Replication/DestinationIcon.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationPanel.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationPanel.types.tsapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationTypeSelection.test.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationTypeSelection.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicasMovedCallout.tsxapps/studio/components/interfaces/Database/Replication/DestinationRow.tsxapps/studio/components/interfaces/Database/Replication/Destinations.tsxapps/studio/components/interfaces/Database/Replication/Replication.constants.tsapps/studio/components/interfaces/Database/Replication/ReplicationDiagram/Edges.tsxapps/studio/components/interfaces/Database/Replication/ReplicationDiagram/Nodes.tsxapps/studio/components/interfaces/Database/Replication/ReplicationDiagram/index.tsxapps/studio/components/interfaces/Database/Replication/useRedirectLegacyReadReplicaDestination.test.tsapps/studio/components/interfaces/Database/Replication/useRedirectLegacyReadReplicaDestination.tsapps/studio/components/interfaces/DiskManagement/DiskManagementForm.sections.tsxapps/studio/components/interfaces/DiskManagement/DiskManagementForm.tsxapps/studio/components/interfaces/DiskManagement/DiskManagementPanelForm.tsxapps/studio/components/interfaces/DiskManagement/fields/ComputeSizeField.tsxapps/studio/components/interfaces/Organization/BillingSettings/Subscription/Subscription.tsxapps/studio/components/interfaces/ProjectHome/TopSection.tsxapps/studio/components/interfaces/SQLEditor/UtilityPanel/QuerySourceMenu/DatabaseSubMenu.tsxapps/studio/components/interfaces/Settings/Infrastructure/Infrastructure.utils.test.tsapps/studio/components/interfaces/Settings/Infrastructure/Infrastructure.utils.tsapps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/Edge.tsxapps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.tsxapps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceNode.tsxapps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/MapView.tsxapps/studio/components/interfaces/Settings/Infrastructure/InfrastructureTopology.tsxapps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/AddReadReplicaSheet.tsxapps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/DropReplicaConfirmationModal.tsxapps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaDetails.tsxapps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/ReadReplicaEligibilityWarnings.tsxapps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/ReadReplicaPricingDialog.tsxapps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/index.tsxapps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/useCheckEligibilityDeployReplica.tsapps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/useGetReplicaCost.tsapps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaRow.tsxapps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicas.constants.tsapps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicas.utils.tsapps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicasSection.tsxapps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/RestartReplicaConfirmationModal.tsxapps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/recommendCompute.test.tsapps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/recommendCompute.tsapps/studio/components/layouts/ProjectLayout/ResizingState.tsxapps/studio/components/ui/DatabaseSelector.tsxapps/studio/components/ui/UpgradePlanButton.tsxapps/studio/pages/project/[ref]/database/replication/index.tsxapps/studio/pages/project/[ref]/database/replication/replica/[replicaId].tsxapps/studio/pages/project/[ref]/settings/infrastructure.tsxapps/studio/pages/project/[ref]/settings/infrastructure/replica/[replicaId].tsxapps/studio/redirects.shared.test.tsapps/studio/redirects.shared.tsapps/studio/routes/project/$ref/database/replication/replica/$replicaId.tsxapps/studio/routes/project/$ref/settings/infrastructure/replica/$replicaId.tsxapps/studio/tests/components/Settings/Infrastructure/ReadReplicaEligibilityWarnings.test.tsxapps/studio/tests/components/Settings/Infrastructure/ReadReplicasSection.test.tsxpackages/ui/src/components/radio-group-card.tsx
💤 Files with no reviewable changes (4)
- apps/studio/components/interfaces/Database/Replication/DestinationIcon.test.tsx
- apps/studio/components/interfaces/Database/Replication/Replication.constants.ts
- apps/studio/components/interfaces/Database/Replication/DestinationIcon.tsx
- apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationPanel.types.ts
There was a problem hiding this comment.
Caution
Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.
Actionable comments posted: 9
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
apps/studio/components/interfaces/Database/Replication/ReplicationDiagram/Nodes.tsx (1)
37-40: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winRemove the stale
ReadReplicaNodeimport andreadReplicaregistration fromEmptyReplicationDiagram.tsx.ReadReplicaNodeis no longer exported fromNodes.tsx, so this causes a build-time error.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/components/interfaces/Database/Replication/ReplicationDiagram/Nodes.tsx` around lines 37 - 40, Remove the stale ReadReplicaNode import and its readReplica registration from EmptyReplicationDiagram.tsx, leaving the remaining replication node registrations unchanged since ReadReplicaNode is no longer exported by Nodes.tsx.Source: Coding guidelines
apps/studio/components/interfaces/Database/Replication/Destinations.tsx (1)
145-147: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winKeep the read-replica migration path reachable without Pipelines access.
When all Pipelines flags are disabled,
newDestinationDefaultTypeisnull. The page disables the only control that opensDestinationPanel, but the read-replica migration callout only renders inside that panel. Users cannot discover the Infrastructure flow.
apps/studio/components/interfaces/Database/Replication/Destinations.tsx#L145-L147: render an Infrastructure migration link outsideDestinationPanelwhen read replicas are enabled.apps/studio/components/interfaces/Database/Replication/Destinations.tsx#L255-L259: do not make the disabled Add destination control the only route to the migration guidance.apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationTypeSelection.tsx#L224-L228: retain this callout as supplemental guidance, not the only migration path.apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationTypeSelection.test.tsx#L162-L192: add an integration test that rendersDestinationswith all Pipelines flags disabled and verifies that the Infrastructure link remains reachable.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/components/interfaces/Database/Replication/Destinations.tsx` around lines 145 - 147, The Destinations page must expose the Infrastructure migration flow even when all Pipelines flags disable the Add destination control. In apps/studio/components/interfaces/Database/Replication/Destinations.tsx lines 145-147, add an external migration link rendered outside DestinationPanel when read replicas are enabled; at lines 255-259, ensure the disabled Add destination control is not the sole route. Keep the DestinationTypeSelection callout at lines 224-228 as supplemental guidance, and add an integration test in apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationTypeSelection.test.tsx lines 162-192 verifying the Infrastructure link remains reachable with all Pipelines flags disabled.
🧹 Nitpick comments (15)
apps/studio/components/ui/UpgradePlanButton.tsx (1)
71-77: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueReplace the nested ternary.
Line 75 adds another level to an existing nested ternary. Use flat conditional logic for the three URL branches.
Proposed refactor
- const href = isRequestingToDisableSpendCap - ? `/org/${slug ?? '_'}/billing?panel=costControl&source=${source}` - : isOnPaidPlanAndRequestingToPurchaseAddon - ? addon === 'computeSize' - ? `${getInfrastructurePath(ref)}`#compute`` - : `/project/${ref ?? '_'}/settings/addons?panel=${addon}&source=${source}` - : `/org/${slug ?? '_'}/billing?panel=subscriptionPlan&source=${source}` + let href = `/org/${slug ?? '_'}/billing?panel=subscriptionPlan&source=${source}` + if (isRequestingToDisableSpendCap) { + href = `/org/${slug ?? '_'}/billing?panel=costControl&source=${source}` + } else if (isOnPaidPlanAndRequestingToPurchaseAddon) { + href = + addon === 'computeSize' + ? `${getInfrastructurePath(ref)}`#compute`` + : `/project/${ref ?? '_'}/settings/addons?panel=${addon}&source=${source}` + }As per coding guidelines, “Do not nest ternaries.”
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/components/ui/UpgradePlanButton.tsx` around lines 71 - 77, Refactor the href assignment in UpgradePlanButton to remove the nested ternary structure and express the three URL branches with flat conditional logic. Preserve the existing priority and URL behavior for isRequestingToDisableSpendCap, addon === 'computeSize', and the remaining addon and subscription-plan cases.Source: Coding guidelines
apps/studio/tests/components/Settings/Infrastructure/ReadReplicaEligibilityWarnings.test.tsx (2)
25-37: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueKeep the
eligibilityfactory aligned with the hook return type.The factory lists the flags returned by
useCheckEligibilityDeployReplica. It is an untyped object literal, so a field added to or removed from the hook does not fail this file at compile time. Annotate the factory withReturnType<typeof useCheckEligibilityDeployReplica>so the mock and the hook stay in sync.This matters for the entitlement flag proposed on
useCheckEligibilityDeployReplica.ts.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/tests/components/Settings/Infrastructure/ReadReplicaEligibilityWarnings.test.tsx` around lines 25 - 37, Update the eligibility factory to use ReturnType<typeof useCheckEligibilityDeployReplica> as its return type, while preserving the existing delta merge behavior. Ensure the test mock remains compile-time aligned with all fields returned by useCheckEligibilityDeployReplica.
19-19: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd coverage for the free-plan branch and for the recommendation click.
Line 19 pins the mocked organization to
plan.id === 'pro'for every test in the file. TheisFreePlanbranch that rendersUpgradePlanButtonis therefore never exercised, although this PR introduced that branch.The tests also assert only that the buttons render. They do not assert that a click calls
requestRecommendComputewithci_smallorci_xlarge, which is the behavior this PR adds.Add a free-plan test that overrides the organization mock, and add click assertions that spy on
requestRecommendCompute.Also applies to: 55-55
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/tests/components/Settings/Infrastructure/ReadReplicaEligibilityWarnings.test.tsx` at line 19, Add coverage in ReadReplicaEligibilityWarnings tests for the free-plan path by overriding useSelectedOrganizationQuery to return a free plan and asserting UpgradePlanButton renders. Add requestRecommendCompute spy assertions for recommendation button clicks, verifying ci_small and ci_xlarge are passed for their respective buttons while preserving existing rendering checks.apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicas.constants.ts (1)
5-11: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider a typed literal map instead of a string index signature.
The
[key: string]index signature removes key checking. A typo such asREPLICA_STATUS.INIT_READ_REPLICAAresolves without a compile error, and consumers lose literal types.satisfieskeeps the value constraint and preserves the literal keys.♻️ Proposed refactor
-export const REPLICA_STATUS: { - [key: string]: components['schemas']['DatabaseStatusResponse']['status'] -} = { +export const REPLICA_STATUS = { ...PROJECT_STATUS, INIT_READ_REPLICA: 'INIT_READ_REPLICA', INIT_READ_REPLICA_FAILED: 'INIT_READ_REPLICA_FAILED', -} +} satisfies Record<string, components['schemas']['DatabaseStatusResponse']['status']>Note:
PROJECT_STATUSinapps/studio/lib/constants/infrastructure.tsis itself typed with a string index signature, so the spread may widen the keys. Verify the resulting type before applying.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicas.constants.ts` around lines 5 - 11, Replace the string index signature on REPLICA_STATUS with a typed literal map using satisfies, preserving the DatabaseStatusResponse status constraint while retaining literal key checking and value types. Account for PROJECT_STATUS’s widened spread type and verify the resulting REPLICA_STATUS keys remain checked rather than reintroducing an index signature.apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/useCheckEligibilityDeployReplica.ts (1)
23-26: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueDrop the
useMemoaroundisNotOnHigherPlan.The computation is one
Array.prototype.includescall over a three-element literal. The memo costs more than the computation, and the dependency list usesorgrather thanorg?.plan.id.♻️ Proposed refactor
- const isNotOnHigherPlan = useMemo( - () => !['team', 'enterprise', 'platform'].includes(org?.plan.id ?? ''), - [org] - ) + const isNotOnHigherPlan = !['team', 'enterprise', 'platform'].includes(org?.plan.id ?? '')Remove the now-unused
useMemoimport.As per coding guidelines: "Do not use
useMemooruseCallbackby default; use them only for measured expense or referential stability required by a memoized child."🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/useCheckEligibilityDeployReplica.ts` around lines 23 - 26, Remove the useMemo wrapper from isNotOnHigherPlan and compute the plan eligibility directly using the existing three-plan includes check. Remove the now-unused useMemo import, preserving the current fallback for a missing organization or plan.Source: Coding guidelines
apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/index.tsx (1)
142-144: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueWrap the disabled "Deploy replica" button with
ButtonTooltip.The button is disabled when
canDeployReplicaisfalse. The reason appears in the warnings panel only when a matching eligibility flag exists. A tooltip states the reason at the control itself.As per coding guidelines: "use
ButtonTooltipfor explanations of disabled buttons".🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/index.tsx` around lines 142 - 144, Wrap the disabled “Deploy replica” Button in the read-replica form with ButtonTooltip, using the existing canDeployReplica eligibility and warning reason to provide the disabled-state explanation at the control. Preserve the current loading and onSubmit behavior, and follow the established ButtonTooltip usage pattern in the surrounding codebase.Source: Coding guidelines
apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/recommendCompute.test.ts (1)
21-33: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRelease the subscriber after the second test and cover the no-subscriber case.
The second test never unsubscribes, so
secondstays registered in the module singleton after the file finishes. Any test added later in this file would receive the stale listener.The suite also omits the case where no subscriber is registered. That path is the one that fails silently in production.
♻️ Proposed refactor
it('replaces the previous subscriber', () => { const first = vi.fn() const second = vi.fn() - subscribeRecommendCompute(first) - subscribeRecommendCompute(second) + const unsubscribeFirst = subscribeRecommendCompute(first) + const unsubscribeSecond = subscribeRecommendCompute(second) requestRecommendCompute('ci_xlarge') expect(first).not.toHaveBeenCalled() expect(second).toHaveBeenCalledWith('ci_xlarge') + + unsubscribeFirst() + unsubscribeSecond() + }) + + it('does not throw when no subscriber is registered', () => { + expect(() => requestRecommendCompute('ci_small')).not.toThrow() })🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/recommendCompute.test.ts` around lines 21 - 33, Update the recommend-compute subscription tests around subscribeRecommendCompute and requestRecommendCompute to cover request behavior when no subscriber is registered, and ensure the replacement-subscriber test releases its active second subscriber before completion. Preserve the existing assertion that only the latest subscriber receives the request, while preventing module-level subscription state from leaking into later tests.apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/useGetReplicaCost.ts (1)
30-50: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winReplace
@ts-ignoreand theas DiskTypecasts with validated disk-attribute parsing.
diskConfiguration.attributesis a discriminated API union. The suppression hides the union-narrowing error, and the casts bypass validation before values reach the pricing helpers. Parse the attributes with a zod discriminated-union schema, then use the parsedtypeand fields directly. Preserve the platform API’s supportedthroughput_mbpsfield.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/useGetReplicaCost.ts` around lines 30 - 50, Replace the `@ts-ignore` and DiskType casts in the useGetReplicaCost pricing flow with zod discriminated-union parsing of diskConfiguration.attributes. Validate the API union before destructuring, then pass the parsed type and fields directly to DISK_PRICING, calculateIOPSPrice, and calculateThroughputPrice while preserving the supported throughput_mbps field.Source: Coding guidelines
apps/studio/pages/project/[ref]/database/replication/replica/[replicaId].tsx (1)
16-19: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winThe client redirect duplicates the shared redirect rule and drops query and hash.
apps/studio/redirects.shared.tslines 122-126 already map this source path to the infrastructure replica route, andmatchRedirectpreserves query and hash throughpreserveQueryAndHash. This effect callsrouter.replace(getReadReplicaPath(ref, replicaId)), which discardsrouter.asPathquery params and the fragment. If a user reaches this component because the config-level redirect did not apply, deep-link state is lost.Either forward the incoming query and hash here, or document that this component is only a fallback for the runtime that does not evaluate the shared redirect table.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/pages/project/`[ref]/database/replication/replica/[replicaId].tsx around lines 16 - 19, Update the redirect effect using router.replace and getReadReplicaPath to preserve the incoming router.asPath query parameters and hash, matching the shared redirect behavior from matchRedirect and preserveQueryAndHash. Keep the existing ref and replicaId guard and destination path intact while forwarding the deep-link state.apps/studio/components/interfaces/Database/Replication/ReplicationDiagram/Edges.tsx (1)
16-20: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRemove the unused
typefield fromEdgeData.Line 95 now destructures only
identifierandshiftEdgeEnd. Thetypefield is no longer read in this component. Drop it unless a producer still relies on the shape.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/components/interfaces/Database/Replication/ReplicationDiagram/Edges.tsx` around lines 16 - 20, Remove the unused type field from the EdgeData type definition in Edges.tsx, since the component only consumes identifier and shiftEdgeEnd. Verify any EdgeData producers still type-check without it, preserving the existing destructuring and behavior.apps/studio/pages/project/[ref]/settings/infrastructure/replica/[replicaId].tsx (2)
147-154: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExplain the disabled restart button and reuse the status constant.
Line 150 disables the button without any explanation to the user. The established studio pattern wraps a disabled button with a tooltip that states the reason. Line 150 also compares against the string literal
'ACTIVE_HEALTHY'whileREPLICA_STATUSis already imported and used at lines 66-68.Based on learnings: "when a button control is disabled, follow the existing/established button tooltip pattern used elsewhere in
apps/studio".♻️ Proposed fix
- <Button - key="restart" - variant="default" - disabled={status !== 'ACTIVE_HEALTHY'} - onClick={() => setShowConfirmRestart(true)} - > - Restart replica - </Button>, + <ButtonTooltip + key="restart" + variant="default" + disabled={status !== REPLICA_STATUS.ACTIVE_HEALTHY} + tooltip={{ + content: { + side: 'bottom', + text: + status !== REPLICA_STATUS.ACTIVE_HEALTHY + ? 'The replica must be healthy before it can be restarted' + : undefined, + }, + }} + onClick={() => setShowConfirmRestart(true)} + > + Restart replica + </ButtonTooltip>,🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/pages/project/`[ref]/settings/infrastructure/replica/[replicaId].tsx around lines 147 - 154, Update the restart Button to compare against the imported REPLICA_STATUS.ACTIVE_HEALTHY constant and wrap the disabled control in the established studio tooltip pattern, displaying the reason the replica must be healthy before restart is available. Preserve the existing restart confirmation behavior and button styling.Source: Learnings
56-60: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueDefault
useMemoon cheap scalar derivations. Both sites memoize a small pure computation over two scalar inputs. No result feeds a memoized child, and no cost was measured. The studio guideline states: "Do not useuseMemooruseCallbackby default; use them only for measured expense or referential stability required by a memoized child."
apps/studio/pages/project/[ref]/settings/infrastructure/replica/[replicaId].tsx#L56-L60: callgetStatusLabelandgetIsInTransitiondirectly during render.apps/studio/components/interfaces/Database/Replication/ReplicationDiagram/Edges.tsx#L110-L118: build thereplicationStateobject directly during render.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/pages/project/`[ref]/settings/infrastructure/replica/[replicaId].tsx around lines 56 - 60, Remove the unnecessary useMemo wrappers: in apps/studio/pages/project/[ref]/settings/infrastructure/replica/[replicaId].tsx lines 56-60, call getStatusLabel and getIsInTransition directly during render; in apps/studio/components/interfaces/Database/Replication/ReplicationDiagram/Edges.tsx lines 110-118, construct replicationState directly during render. No other behavior changes are needed.Source: Coding guidelines
apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/AddReadReplicaSheet.tsx (1)
24-24: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRename
visibletoisOpen.Line 24 stores a boolean. Use the required boolean-name prefix.
As per coding guidelines, “Use boolean names beginning with
is,has,can, orshould.”🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/AddReadReplicaSheet.tsx` at line 24, Rename the boolean variable visible to isOpen in the AddReadReplicaSheet component and update all references to use isOpen consistently.Source: Coding guidelines
apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicasSection.tsx (1)
49-52: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueDerive
readReplicasduring render.This filter is simple derived data. Remove the default
useMemo, then make the polling effect depend ondatabasesandprojectRefdirectly.As per coding guidelines, “Do not use
useMemooruseCallbackby default.”🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicasSection.tsx` around lines 49 - 52, Update the readReplicas derivation in ReadReplicasSection to filter databases directly during render instead of using useMemo. Adjust the polling effect dependencies to reference databases and projectRef directly, and remove the now-unused useMemo import.Source: Coding guidelines
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationPanel.tsx (1)
154-202: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winFlatten the sheet state rendering.
The nested ternary combines the Pipelines waitlist, enablement, and form states. Use early returns or a named conditional block instead.
As per coding guidelines, “Do not nest ternaries.”
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationPanel.tsx` around lines 154 - 202, Refactor the conditional rendering in DestinationPanel around enablePgReplicate and replicationNotEnabled so the Pipelines waitlist, enablement callout, and DestinationForm states are expressed with early returns or a named conditional block. Remove the nested ternary while preserving the existing rendering order, props, and behavior for each state.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@apps/studio/components/interfaces/Database/Replication/ReplicationDiagram/Edges.tsx`:
- Around line 148-153: Update the edge animation in the component containing the
animated edge element: either define the animate-edge-flow class with its
required keyframes in the tracked styling system, or replace the className usage
with the existing inline animation configuration. Ensure the animation still
runs whenever shouldAnimate is true.
In `@apps/studio/components/interfaces/DiskManagement/DiskManagementForm.tsx`:
- Around line 384-387: Update both recommendation handlers in
DiskManagementForm.tsx at lines 384-387 and 400-403 to trigger validation for
provisionedIOPS and throughput after setting computeSize, matching the dependent
validation performed by ComputeSizeField.
In
`@apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/index.tsx`:
- Around line 44-46: Update the defaultRegion initialization near
AWS_REGIONS_DEFAULT so a failed lookup cannot produce the invalid string
fallback 'ap-southeast-1'. Use a valid AWS_REGIONS key or explicitly handle the
missing entry before the later `.code` access, ensuring the existing
region-selection guards remain safe.
In
`@apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/useCheckEligibilityDeployReplica.ts`:
- Around line 55-77: Add hasReadReplicaAccess to the returned object from
useCheckEligibilityDeployReplica.ts at lines 55-77 so consumers can explain
entitlement failures. In ReadReplicaEligibilityWarnings.tsx at lines 249-277,
add a warning branch for missing read-replica access and a final Admonition
fallback whenever can is false, ensuring the component never returns undefined.
- Around line 45-53: Update the eligibility hook to return an isLoading flag
combining isLoadingReplicas, isLoadingAddons, and the absence of project, while
preserving the existing eligibility calculations after data resolves. In
ReadReplicaEligibilityWarnings, use this flag to render the existing skeleton
instead of warnings until all required queries and project data are available.
In
`@apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/useGetReplicaCost.ts`:
- Around line 66-78: Update the disk, iops, and throughput label construction in
the pricing result to avoid rendering undefined values while diskConfiguration
is unavailable: use the existing readReplicaDiskSizes value for the disk size
instead of recalculating size_gb * 1.25, and provide safe fallback values for
missing type, iops, and throughput_mbps before formatting the labels.
In
`@apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/recommendCompute.ts`:
- Around line 26-39: Update
apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/recommendCompute.ts
lines 26-39 so requestRecommendCompute returns a boolean indicating whether
recommendComputeListener received the recommendation. Update
apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/ReadReplicaEligibilityWarnings.tsx
lines 80-85 so handleRecommendCompute checks that result and, when delivery
fails, shows a toast.error or navigates to the compute section instead of
silently continuing.
In
`@apps/studio/pages/project/`[ref]/settings/infrastructure/replica/[replicaId].tsx:
- Around line 88-98: Flatten the nested ternary used by the Badge `variant` prop
near `statusLabel` by deriving the value through a small lookup or early-return
helper. Preserve `success` for `Healthy`, `destructive` for `Failed`, and
`default` for all other statuses.
In
`@apps/studio/routes/project/`$ref/settings/infrastructure/replica/$replicaId.tsx:
- Around line 5-8: Update the route hierarchy around
InfrastructureReadReplicaRoute so the replica page can render: either add an
Outlet to SettingsInfrastructureRoute or flatten the generated route structure.
Preserve the existing replica route component and settings layout metadata.
---
Outside diff comments:
In `@apps/studio/components/interfaces/Database/Replication/Destinations.tsx`:
- Around line 145-147: The Destinations page must expose the Infrastructure
migration flow even when all Pipelines flags disable the Add destination
control. In
apps/studio/components/interfaces/Database/Replication/Destinations.tsx lines
145-147, add an external migration link rendered outside DestinationPanel when
read replicas are enabled; at lines 255-259, ensure the disabled Add destination
control is not the sole route. Keep the DestinationTypeSelection callout at
lines 224-228 as supplemental guidance, and add an integration test in
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationTypeSelection.test.tsx
lines 162-192 verifying the Infrastructure link remains reachable with all
Pipelines flags disabled.
In
`@apps/studio/components/interfaces/Database/Replication/ReplicationDiagram/Nodes.tsx`:
- Around line 37-40: Remove the stale ReadReplicaNode import and its readReplica
registration from EmptyReplicationDiagram.tsx, leaving the remaining replication
node registrations unchanged since ReadReplicaNode is no longer exported by
Nodes.tsx.
---
Nitpick comments:
In
`@apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationPanel.tsx`:
- Around line 154-202: Refactor the conditional rendering in DestinationPanel
around enablePgReplicate and replicationNotEnabled so the Pipelines waitlist,
enablement callout, and DestinationForm states are expressed with early returns
or a named conditional block. Remove the nested ternary while preserving the
existing rendering order, props, and behavior for each state.
In
`@apps/studio/components/interfaces/Database/Replication/ReplicationDiagram/Edges.tsx`:
- Around line 16-20: Remove the unused type field from the EdgeData type
definition in Edges.tsx, since the component only consumes identifier and
shiftEdgeEnd. Verify any EdgeData producers still type-check without it,
preserving the existing destructuring and behavior.
In
`@apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/AddReadReplicaSheet.tsx`:
- Line 24: Rename the boolean variable visible to isOpen in the
AddReadReplicaSheet component and update all references to use isOpen
consistently.
In
`@apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/index.tsx`:
- Around line 142-144: Wrap the disabled “Deploy replica” Button in the
read-replica form with ButtonTooltip, using the existing canDeployReplica
eligibility and warning reason to provide the disabled-state explanation at the
control. Preserve the current loading and onSubmit behavior, and follow the
established ButtonTooltip usage pattern in the surrounding codebase.
In
`@apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/useCheckEligibilityDeployReplica.ts`:
- Around line 23-26: Remove the useMemo wrapper from isNotOnHigherPlan and
compute the plan eligibility directly using the existing three-plan includes
check. Remove the now-unused useMemo import, preserving the current fallback for
a missing organization or plan.
In
`@apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/useGetReplicaCost.ts`:
- Around line 30-50: Replace the `@ts-ignore` and DiskType casts in the
useGetReplicaCost pricing flow with zod discriminated-union parsing of
diskConfiguration.attributes. Validate the API union before destructuring, then
pass the parsed type and fields directly to DISK_PRICING, calculateIOPSPrice,
and calculateThroughputPrice while preserving the supported throughput_mbps
field.
In
`@apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicas.constants.ts`:
- Around line 5-11: Replace the string index signature on REPLICA_STATUS with a
typed literal map using satisfies, preserving the DatabaseStatusResponse status
constraint while retaining literal key checking and value types. Account for
PROJECT_STATUS’s widened spread type and verify the resulting REPLICA_STATUS
keys remain checked rather than reintroducing an index signature.
In
`@apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicasSection.tsx`:
- Around line 49-52: Update the readReplicas derivation in ReadReplicasSection
to filter databases directly during render instead of using useMemo. Adjust the
polling effect dependencies to reference databases and projectRef directly, and
remove the now-unused useMemo import.
In
`@apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/recommendCompute.test.ts`:
- Around line 21-33: Update the recommend-compute subscription tests around
subscribeRecommendCompute and requestRecommendCompute to cover request behavior
when no subscriber is registered, and ensure the replacement-subscriber test
releases its active second subscriber before completion. Preserve the existing
assertion that only the latest subscriber receives the request, while preventing
module-level subscription state from leaking into later tests.
In `@apps/studio/components/ui/UpgradePlanButton.tsx`:
- Around line 71-77: Refactor the href assignment in UpgradePlanButton to remove
the nested ternary structure and express the three URL branches with flat
conditional logic. Preserve the existing priority and URL behavior for
isRequestingToDisableSpendCap, addon === 'computeSize', and the remaining addon
and subscription-plan cases.
In
`@apps/studio/pages/project/`[ref]/database/replication/replica/[replicaId].tsx:
- Around line 16-19: Update the redirect effect using router.replace and
getReadReplicaPath to preserve the incoming router.asPath query parameters and
hash, matching the shared redirect behavior from matchRedirect and
preserveQueryAndHash. Keep the existing ref and replicaId guard and destination
path intact while forwarding the deep-link state.
In
`@apps/studio/pages/project/`[ref]/settings/infrastructure/replica/[replicaId].tsx:
- Around line 147-154: Update the restart Button to compare against the imported
REPLICA_STATUS.ACTIVE_HEALTHY constant and wrap the disabled control in the
established studio tooltip pattern, displaying the reason the replica must be
healthy before restart is available. Preserve the existing restart confirmation
behavior and button styling.
- Around line 56-60: Remove the unnecessary useMemo wrappers: in
apps/studio/pages/project/[ref]/settings/infrastructure/replica/[replicaId].tsx
lines 56-60, call getStatusLabel and getIsInTransition directly during render;
in
apps/studio/components/interfaces/Database/Replication/ReplicationDiagram/Edges.tsx
lines 110-118, construct replicationState directly during render. No other
behavior changes are needed.
In
`@apps/studio/tests/components/Settings/Infrastructure/ReadReplicaEligibilityWarnings.test.tsx`:
- Around line 25-37: Update the eligibility factory to use ReturnType<typeof
useCheckEligibilityDeployReplica> as its return type, while preserving the
existing delta merge behavior. Ensure the test mock remains compile-time aligned
with all fields returned by useCheckEligibilityDeployReplica.
- Line 19: Add coverage in ReadReplicaEligibilityWarnings tests for the
free-plan path by overriding useSelectedOrganizationQuery to return a free plan
and asserting UpgradePlanButton renders. Add requestRecommendCompute spy
assertions for recommendation button clicks, verifying ci_small and ci_xlarge
are passed for their respective buttons while preserving existing rendering
checks.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: e0c130b3-96e7-4664-887b-9e2d8a230ae5
⛔ Files ignored due to path filters (1)
apps/studio/routeTree.gen.tsis excluded by!**/routeTree.gen.ts
📒 Files selected for processing (59)
apps/studio/TANSTACK_MIGRATION.mdapps/studio/components/interfaces/Database/Replication/DestinationIcon.test.tsxapps/studio/components/interfaces/Database/Replication/DestinationIcon.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationPanel.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationPanel.types.tsapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationTypeSelection.test.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationTypeSelection.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicasMovedCallout.tsxapps/studio/components/interfaces/Database/Replication/DestinationRow.tsxapps/studio/components/interfaces/Database/Replication/Destinations.tsxapps/studio/components/interfaces/Database/Replication/Replication.constants.tsapps/studio/components/interfaces/Database/Replication/ReplicationDiagram/Edges.tsxapps/studio/components/interfaces/Database/Replication/ReplicationDiagram/Nodes.tsxapps/studio/components/interfaces/Database/Replication/ReplicationDiagram/index.tsxapps/studio/components/interfaces/Database/Replication/useRedirectLegacyReadReplicaDestination.test.tsapps/studio/components/interfaces/Database/Replication/useRedirectLegacyReadReplicaDestination.tsapps/studio/components/interfaces/DiskManagement/DiskManagementForm.sections.tsxapps/studio/components/interfaces/DiskManagement/DiskManagementForm.tsxapps/studio/components/interfaces/DiskManagement/DiskManagementPanelForm.tsxapps/studio/components/interfaces/DiskManagement/fields/ComputeSizeField.tsxapps/studio/components/interfaces/Organization/BillingSettings/Subscription/Subscription.tsxapps/studio/components/interfaces/ProjectHome/TopSection.tsxapps/studio/components/interfaces/SQLEditor/UtilityPanel/QuerySourceMenu/DatabaseSubMenu.tsxapps/studio/components/interfaces/Settings/Infrastructure/Infrastructure.utils.test.tsapps/studio/components/interfaces/Settings/Infrastructure/Infrastructure.utils.tsapps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/Edge.tsxapps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.tsxapps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceNode.tsxapps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/MapView.tsxapps/studio/components/interfaces/Settings/Infrastructure/InfrastructureTopology.tsxapps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/AddReadReplicaSheet.tsxapps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/DropReplicaConfirmationModal.tsxapps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaDetails.tsxapps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/ReadReplicaEligibilityWarnings.tsxapps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/ReadReplicaPricingDialog.tsxapps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/index.tsxapps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/useCheckEligibilityDeployReplica.tsapps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/useGetReplicaCost.tsapps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaRow.tsxapps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicas.constants.tsapps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicas.utils.tsapps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicasSection.tsxapps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/RestartReplicaConfirmationModal.tsxapps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/recommendCompute.test.tsapps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/recommendCompute.tsapps/studio/components/layouts/ProjectLayout/ResizingState.tsxapps/studio/components/ui/DatabaseSelector.tsxapps/studio/components/ui/UpgradePlanButton.tsxapps/studio/pages/project/[ref]/database/replication/index.tsxapps/studio/pages/project/[ref]/database/replication/replica/[replicaId].tsxapps/studio/pages/project/[ref]/settings/infrastructure.tsxapps/studio/pages/project/[ref]/settings/infrastructure/replica/[replicaId].tsxapps/studio/redirects.shared.test.tsapps/studio/redirects.shared.tsapps/studio/routes/project/$ref/database/replication/replica/$replicaId.tsxapps/studio/routes/project/$ref/settings/infrastructure/replica/$replicaId.tsxapps/studio/tests/components/Settings/Infrastructure/ReadReplicaEligibilityWarnings.test.tsxapps/studio/tests/components/Settings/Infrastructure/ReadReplicasSection.test.tsxpackages/ui/src/components/radio-group-card.tsx
💤 Files with no reviewable changes (4)
- apps/studio/components/interfaces/Database/Replication/DestinationIcon.test.tsx
- apps/studio/components/interfaces/Database/Replication/Replication.constants.ts
- apps/studio/components/interfaces/Database/Replication/DestinationIcon.tsx
- apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationPanel.types.ts
🛑 Comments failed to post (4)
apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/index.tsx (1)
44-46: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash # Description: Confirm the AWS_REGIONS key space and the AWS_REGIONS_DEFAULT value. fd -t f -e ts . packages/shared-data --exec rg -n -A5 'AWS_REGIONS(_KEYS)?\s*[:=]' {} rg -n 'AWS_REGIONS_DEFAULT' apps/studio/lib/constantsRepository: supabase/supabase
Length of output: 843
🏁 Script executed:
#!/bin/bash set -e printf '%s\n' '--- AWS region constants ---' cat -n packages/shared-data/src/constants/aws-regions.ts 2>/dev/null || true printf '%s\n' '--- matching shared-data files ---' fd -t f -e ts . packages/shared-data | xargs rg -l 'export const AWS_REGIONS|AWS_REGIONS_DEFAULT' | while read -r f; do echo "FILE: $f" cat -n "$f" done printf '%s\n' '--- infrastructure constants ---' cat -n apps/studio/lib/constants/infrastructure.ts printf '%s\n' '--- form implementation ---' cat -n apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/index.tsxRepository: supabase/supabase
Length of output: 14306
🏁 Script executed:
#!/bin/bash set -e printf '%s\n' '--- available replica regions ---' cat -n apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.constants.ts printf '%s\n' '--- all ReadReplicaForm references ---' rg -n -C 3 'ReadReplicaForm|AVAILABLE_REPLICA_REGIONS|selectedRegion|AWS_REGIONS_DEFAULT' apps/studio/components apps/studio/data apps/studio/lib packages/shared-data -g '*.{ts,tsx}'Repository: supabase/supabase
Length of output: 44804
🏁 Script executed:
#!/bin/bash set -e python3 - <<'PY' regions = { 'WEST_US': 'us-west-1', 'WEST_US_2': 'us-west-2', 'EAST_US': 'us-east-1', 'EAST_US_2': 'us-east-2', 'CENTRAL_CANADA': 'ca-central-1', 'WEST_EU': 'eu-west-1', 'WEST_EU_2': 'eu-west-2', 'WEST_EU_3': 'eu-west-3', 'CENTRAL_EU': 'eu-central-1', 'CENTRAL_EU_2': 'eu-central-2', 'NORTH_EU': 'eu-north-1', 'SOUTH_ASIA': 'ap-south-1', 'SOUTHEAST_ASIA': 'ap-southeast-1', 'NORTHEAST_ASIA': 'ap-northeast-1', 'NORTHEAST_ASIA_2': 'ap-northeast-2', 'OCEANIA': 'ap-southeast-2', 'SOUTH_AMERICA': 'sa-east-1', } defaults = { 'non-prod': ('SOUTHEAST_ASIA', regions['SOUTHEAST_ASIA']), 'prod': ('EAST_US_2', regions['EAST_US_2']), } for environment, (expected_key, default_value) in defaults.items(): matched = next((key for key, code in regions.items() if code == default_value), None) print(environment, 'default key:', matched, 'fallback is valid key:', 'ap-southeast-1' in regions) assert matched == expected_key assert 'ap-southeast-1' not in regions print('all current default lookups resolve to valid keys') PYRepository: supabase/supabase
Length of output: 328
Guard invalid region selections before reading
.code.
AWS_REGIONS_DEFAULTresolves to valid keys in both environments. However,'ap-southeast-1'is not anAWS_REGIONSkey. If the lookup fails, line 78 throws before the guards. Use a valid key or handle the missing lookup, then read.codesafely.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/index.tsx` around lines 44 - 46, Update the defaultRegion initialization near AWS_REGIONS_DEFAULT so a failed lookup cannot produce the invalid string fallback 'ap-southeast-1'. Use a valid AWS_REGIONS key or explicitly handle the missing entry before the later `.code` access, ensuring the existing region-selection guards remain safe.apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/useCheckEligibilityDeployReplica.ts (2)
45-53: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Deriving eligibility before the queries resolve shows a misleading warning.
While
useProjectAddonsQueryis pending,addonsisundefined, socurrentComputeAddonisundefinedandisBelowSmallComputebecomestrue.ReadReplicaEligibilityWarningsthen renders "Project required to at least be on a Small compute" for every project on first open, including projects that already run a Large compute.Also, while
projectis pending,dbVersionis'', socurrentPgVersionisNaN.NaN >= 15andNaN < 15are bothfalse, socanisfalsewhileisPgVersionBelow15isfalse.Expose a loading flag from the hook and render a skeleton in place of the warnings until the queries resolve.
🐛 Proposed direction
- const { data: databases = [] } = useReadReplicasQuery({ projectRef }) - - const { data: addons } = useProjectAddonsQuery({ projectRef }) + const { data: databases = [], isPending: isLoadingReplicas } = useReadReplicasQuery({ projectRef }) + + const { data: addons, isPending: isLoadingAddons } = useProjectAddonsQuery({ projectRef })Return
isLoading: isLoadingReplicas || isLoadingAddons || !projectand gate the warning rendering on it.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/useCheckEligibilityDeployReplica.ts` around lines 45 - 53, Update the eligibility hook to return an isLoading flag combining isLoadingReplicas, isLoadingAddons, and the absence of project, while preserving the existing eligibility calculations after data resolves. In ReadReplicaEligibilityWarnings, use this flag to render the existing skeleton instead of warnings until all required queries and project data are available.
55-77: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
An entitlement block produces a disabled form with no explanation.
canDeployReplicadepends onhasReadReplicaAccess, but that flag is not returned by the hook and no warning branch handles it.ReadReplicaEligibilityWarningsfalls through everyifand returnsundefined, soReadReplicaFormrenders a disabled regionSelectand a disabled "Deploy replica" button with an empty warning area.
apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/useCheckEligibilityDeployReplica.ts#L55-L77: addhasReadReplicaAccessto the returned object so consumers can render a reason.apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/ReadReplicaEligibilityWarnings.tsx#L249-L277: add a branch for the missing entitlement, and add a final fallbackAdmonitionso the component never returnsundefinedwhilecanisfalse.📍 Affects 2 files
apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/useCheckEligibilityDeployReplica.ts#L55-L77(this comment)apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/ReadReplicaEligibilityWarnings.tsx#L249-L277🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/useCheckEligibilityDeployReplica.ts` around lines 55 - 77, Add hasReadReplicaAccess to the returned object from useCheckEligibilityDeployReplica.ts at lines 55-77 so consumers can explain entitlement failures. In ReadReplicaEligibilityWarnings.tsx at lines 249-277, add a warning branch for missing read-replica access and a final Admonition fallback whenever can is false, ensuring the component never returns undefined.apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/useGetReplicaCost.ts (1)
66-78: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Guard the label strings against missing disk attributes.
When
diskConfigurationis not yet loaded,iopsandthroughput_mbpsareundefined.${iops?.toLocaleString()}produces the literal string"undefined IOPS", and the disk label produces"0 GB (undefined)".ReadReplicaPricingDialogrenders these strings directly in the sheet footer table.Line 68 also repeats the
* 1.25calculation already stored inreadReplicaDiskSizes.🐛 Proposed fix
disk: { type, - label: `${((size_gb ?? 0) * 1.25).toLocaleString()} GB (${type})`, + label: `${readReplicaDiskSizes.toLocaleString()} GB${type ? ` (${type})` : ''}`, cost: formatCurrency(additionalCostDiskSize), }, iops: { - label: `${iops?.toLocaleString()} IOPS`, + label: `${(iops ?? 0).toLocaleString()} IOPS`, cost: formatCurrency(+additionalCostIOPS), }, throughput: { - label: `${throughput_mbps?.toLocaleString()} MB/s`, + label: `${(throughput_mbps ?? 0).toLocaleString()} MB/s`, cost: formatCurrency(+additionalCostThroughput), },📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.disk: { type, label: `${readReplicaDiskSizes.toLocaleString()} GB${type ? ` (${type})` : ''}`, cost: formatCurrency(additionalCostDiskSize), }, iops: { label: `${(iops ?? 0).toLocaleString()} IOPS`, cost: formatCurrency(+additionalCostIOPS), }, throughput: { label: `${(throughput_mbps ?? 0).toLocaleString()} MB/s`, cost: formatCurrency(+additionalCostThroughput), },🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/useGetReplicaCost.ts` around lines 66 - 78, Update the disk, iops, and throughput label construction in the pricing result to avoid rendering undefined values while diskConfiguration is unavailable: use the existing readReplicaDiskSizes value for the disk size instead of recalculating size_gb * 1.25, and provide safe fallback values for missing type, iops, and throughput_mbps before formatting the labels.
1233d2d to
bf3fe7a
Compare
) ## What kind of change does this PR introduce? Feature. Stack 1 of 5 for [PIPE-1007](https://linear.app/supabase/issue/PIPE-1007/move-read-replicas-out-of-replication-into-infrastructure). ## What is the current behavior? Read replica UI lives under Database / Replication. ## What is the new behavior? Moves replica form, row, and modals into Settings/Infrastructure and extracts `REPLICA_STATUS` plus path helpers. URLs and user-facing behaviour are unchanged. ## Additional context Keep `infrastructure:read_replicas` off in prod until the full stack lands. Stack: this PR → [#49044](#49044) → [#49045](#49045) → [#49046](#49046) → [#48921](#48921) ## To test Open [Database / Replication](https://studio-staging-git-danny-pipe-1007-01-relocate-701014-supabase.vercel.app/dashboard/project/_/database/replication?destinationType=Read+Replica). Confirm add replica still works as today. No new Infrastructure section yet. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added navigation for viewing a specific read replica and starting the add-replica setup flow. - Improved read-replica setup validation, including unsupported regions and invalid PostgreSQL versions. - **Bug Fixes** - Corrected default region and success messaging behavior. - Prevented incomplete pricing labels and clarified eligibility warnings. - Improved display handling for localized pricing values. - **Tests** - Added coverage for read-replica navigation paths and fallback behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
There was a problem hiding this comment.
Pull request overview
This PR updates Studio’s read replica entry points to deep-link into Settings → Infrastructure and improves the “change compute” call-to-action so it can close the add-replica sheet, preselect a compute size, and scroll users to the Scaling/Compute section.
Changes:
- Redirects “Add replica” entry points (DatabaseSelector + SQL editor submenu) to Infrastructure with
?addReplica=true. - Adds an in-page “recommend compute” bridge so eligibility CTAs can preselect compute size + scroll to Scaling.
- Improves compute selection UX/visuals (RadioGroupCard selected styling + controlled RadioGroup value handling) and updates related tests/copy.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/ui/src/components/radio-group-card.tsx | Improves selected/focus border styling so programmatic selection is visibly reflected. |
| apps/studio/tests/components/Settings/Infrastructure/ReadReplicaEligibilityWarnings.test.tsx | Updates mocks/assertions for the new compute CTA buttons. |
| apps/studio/components/ui/UpgradePlanButton.tsx | Deep-links compute-size addon CTA to Infrastructure #compute. |
| apps/studio/components/ui/DatabaseSelector.tsx | Routes “Add replica” to Infrastructure via getAddReadReplicaPath(). |
| apps/studio/components/layouts/ProjectLayout/ResizingState.tsx | Updates resizing copy shown during compute resize/restart. |
| apps/studio/components/interfaces/SQLEditor/UtilityPanel/QuerySourceMenu/DatabaseSubMenu.tsx | Routes “Add replica” to Infrastructure via getAddReadReplicaPath(). |
| apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/recommendCompute.ts | Adds query parser + in-page bridge API for compute recommendations from the replica sheet. |
| apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/recommendCompute.test.ts | Adds unit tests for the recommend-compute subscriber bridge. |
| apps/studio/components/interfaces/Settings/Infrastructure/ReadReplicas/ReadReplicaForm/ReadReplicaEligibilityWarnings.tsx | Adds compute recommendation actions, closes sheet via addReplica query param, and triggers the recommendation bridge. |
| apps/studio/components/interfaces/Organization/BillingSettings/Subscription/Subscription.tsx | Minor label/copy change for cancellation button. |
| apps/studio/components/interfaces/DiskManagement/fields/ComputeSizeField.tsx | Makes RadioGroupCard controlled and fixes checked-state styling selector usage. |
| apps/studio/components/interfaces/DiskManagement/DiskManagementPanelForm.tsx | Updates the “Disk management has moved” notice copy. |
| apps/studio/components/interfaces/DiskManagement/DiskManagementForm.tsx | Consumes recommend-compute query param + subscriber bridge; adds #compute deep-link scrolling behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
50e1420 to
81979eb
Compare
| className="max-w-3xl" | ||
| // Default close restores focus to Add read replica and the browser | ||
| // scrolls that button into view through nested overflow mains. | ||
| onCloseAutoFocus={(event) => event.preventDefault()} |
There was a problem hiding this comment.
As inline comment suggests: preventDefault here allows focus to go to compute size options, usually triggered by a tap on the Change to Small compute button in this sheet.
Without this, Radix focusses Add read replica instead.
b01b4c8 to
6d4dac0
Compare
…d compute Finish the move: selectors open the Infrastructure add-replica sheet, and eligibility CTAs pre-select compute with a visible selected state.
DiskManagementForm registers the listener in an effect, so a click can land before that. Queue the size instead of toasting an error and closing.
…ning A project has one primary, so it is the primary database's activities.
…page A flex column on the overview section made the charts' h-full resolve against the viewport, which left a large empty region below the sticky review bar once compute was selected.
…arts Charts already use h-full for equal card height. A flex column parent made that resolve against the page, stretching the overview block. Stack them as blocks instead so chart height stays content-sized.
h-full on the cards resolved against ProjectLayout's main in production once topology sat in the same flex section. Use flex-1 inside the grid instead so height stays content-sized.
…lumn The compute form is a flex item of ProjectLayout's h-full main. In production that makes descendant height:100% resolve against the viewport, which next dev does not. Wrap the form in a block box, drop the flex PageSection around topology plus charts, and size the cards to their content.
The Change to Small CTA closed the add-replica sheet and called scrollIntoView 150ms later, in the middle of the 300ms close animation. Nested overflow mains then inflated the overview instead of moving scrollTop. Wait for the sheet to close and scroll the ProjectLayout container directly.
Closing the sheet returns focus to Add read replica. The browser then scrolls that button into view through two nested overflow mains, which is what stretched the overview. Only the Change to Small CTA hits this path. Prevent close auto-focus and keep the compute scroll on the page container.
The overview gap was sheet close restoring focus, not chart h-full or a custom scroller.
6d4dac0 to
6f7cc69
Compare
## What kind of change does this PR introduce? Feature. Stack 2 of 5 for [PIPE-1007](https://linear.app/supabase/issue/PIPE-1007/move-read-replicas-out-of-replication-into-infrastructure). ## What is the current behavior? Settings / Infrastructure only covers compute and disk. ## What is the new behavior? Adds topology, a Read replicas list, and the add-replica sheet on Infrastructure. Still gated on `infrastructure:read_replicas`. | Before | After | | --- | --- | | <img width="1279" height="1323" alt="Infrastructure Settings Chisel Toolshed Supabase" src="https://github.com/user-attachments/assets/34e7b414-a326-415b-984c-00ae0000f46e" /> | <img width="1279" height="1323" alt="Infrastructure Settings Chisel Toolshed Supabase" src="https://github.com/user-attachments/assets/547cd7ac-435e-45d1-80ad-2f35476f579f" /> | ## Additional context [#49043](#49043) is merged. This PR targets `master`. Please review, but do not merge. `infrastructure:read_replicas` is already on, so merging this alone would show replicas on both Infrastructure and Replication. Merge 2→5 ([#49045](#49045), [#49046](#49046), [#48921](#48921)) in succession once they are all reviewed. Replica detail still uses the old Replication URL until #49045. ## To test `infrastructure:read_replicas` is an enabled-feature, on by default in `enabled-features.json`. There is no Feature Preview or ConfigCat switch. On this preview you should already see it: Settings → Infrastructure shows topology and a Read replicas section. If those are missing, your profile lists `infrastructure:read_replicas` in `disabled_features` (from `/platform/profile`), and you cannot flip it in the UI. Open [Settings / Infrastructure](https://studio-staging-git-danny-pipe-1007-02-infra-section-supabase.vercel.app/dashboard/project/_/settings/infrastructure). Confirm the topology, Read replicas section, and Add read replica sheet. Replication should still list replicas too. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added infrastructure topology visibility to project infrastructure settings. * Added read replica management, including status monitoring, empty states, creation flow, documentation access, and discard-change confirmation. * Infrastructure settings now include read replicas alongside compute and disk configuration. * Added flexible placement for supplemental disk overview and scaling content. * **Bug Fixes** * Simplified project configuration rendering for more reliable display. * **Tests** * Added coverage for enabled and disabled read replica states. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
## What kind of change does this PR introduce? Feature. Stack 4 of 5 for [PIPE-1007](https://linear.app/supabase/issue/PIPE-1007/move-read-replicas-out-of-replication-into-infrastructure). Contributes to PIPE-1008. ## What is the current behavior? Database / Replication lists, creates, and diagrams read replicas alongside pipelines. ## What is the new behavior? Replication is pipelines-only. No replica rows, type, or diagram nodes. `?destinationType=Read+Replica` redirects to Infrastructure. A short callout points create-mode users at the new home. ## Additional context Please review, but do not merge until [#48921](#48921) is ready to follow immediately. The flag is already on, so this PR is the user-facing cutover off Replication. ## To test `infrastructure:read_replicas` is an enabled-feature, on by default. There is no Feature Preview or ConfigCat switch. You should already see the Infrastructure Read replicas section. If you do not, your profile lists `infrastructure:read_replicas` in `disabled_features`. Open [Database / Replication](https://studio-staging-git-danny-pipe-1007-04-cut-from-77ef95-supabase.vercel.app/dashboard/project/_/database/replication?destinationType=Read+Replica). You should land on Infrastructure with the add-replica sheet, not a replica destination type. The Replication page itself should be pipelines-only. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added guidance directing users to Infrastructure to create read replicas. * Added automatic redirection for legacy read-replica links. * **Updates** * Replication destinations now focus exclusively on external analytics and pipeline destinations. * Updated destination selection, empty states, descriptions, and diagrams to reflect the streamlined experience. * Removed read replicas from the replication destination list and related creation flow. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Jeremias Menichelli <[email protected]>
Braintrust eval report
|
What kind of change does this PR introduce?
Feature. Stack 5 of 5 (tip) for PIPE-1007.
What is the current behavior?
Selectors still open Replication with
destinationType=Read+Replica. Compute eligibility actions leave the add-replica flow without carrying a recommended size into the Infrastructure form.What is the new behavior?
DatabaseSelector and the SQL submenu open Infrastructure
?addReplica=true. Change to Small/XL compute waits for the sheet to close, pre-selects that size, then focuses and scrolls the Infrastructure form to Compute without shifting the page footer.Additional context
Last stack PR. #49043 has merged. Please review, but do not merge until 2→4 are also approved. Then merge #49044 → #49045 → #49046 → this PR in succession, and drop the
do-not-mergelabels.Update the read replicas getting-started doc in the same sitting so it points only at Infrastructure (it currently also links Database → Replication).
Remaining stack: #49044 → #49045 → #49046 → this PR
To test
infrastructure:read_replicasis an enabled-feature, on by default. There is no Feature Preview or ConfigCat switch. You should already see the Infrastructure Read replicas section. If you do not, your profile listsinfrastructure:read_replicasindisabled_features.