Repository navigation
feat: privatelink read replica - #48642
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAWS PrivateLink connections can target the primary database or a read replica. Account creation and deletion send database identifiers when required. Infrastructure visualization no longer manages replicas directly and links to the replica management view. Replica-removal errors include integration-settings guidance. ChangesAWS PrivateLink database targeting
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant AWSPrivateLinkForm
participant ReadReplicasQuery
participant createAWSAccount
participant AWSAssociationAPI
AWSPrivateLinkForm->>ReadReplicasQuery: Load available read replicas
ReadReplicasQuery-->>AWSPrivateLinkForm: Return replica identifiers
AWSPrivateLinkForm->>createAWSAccount: Submit selected database identifier
createAWSAccount->>AWSAssociationAPI: Send database_identifier
AWSAssociationAPI-->>createAWSAccount: Return association result
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 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: 2
🧹 Nitpick comments (2)
apps/studio/components/interfaces/Settings/Integrations/AWSPrivateLink/AWSPrivateLinkForm.tsx (2)
52-55: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRename the feature flag boolean.
Rename
showPrivateLinkReadReplicatoisPrivateLinkReadReplicaEnabled. The value is a boolean, not a UI action.As per coding guidelines, “Use boolean names beginning with
is,has,can, orshould.”Also applies to: 197-197
🤖 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/Integrations/AWSPrivateLink/AWSPrivateLinkForm.tsx` around lines 52 - 55, Rename the boolean variable showPrivateLinkReadReplica to isPrivateLinkReadReplicaEnabled throughout AWSPrivateLinkForm, including its use in the useReadReplicasQuery enabled condition, without changing the feature-flag behavior.Source: Coding guidelines
69-73: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRemove the nested status ternary.
The ternary that begins on Line 69 continues through Line 82. Replace it with a status-to-title map or a
switchstatement.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/Settings/Integrations/AWSPrivateLink/AWSPrivateLinkForm.tsx` around lines 69 - 73, Replace the nested status ternary used to compute the title with a status-to-title map or switch statement. Update the title logic near the account status checks while preserving the existing title for each status and fallback behavior.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/Settings/Integrations/AWSPrivateLink/AWSPrivateLinkForm.tsx`:
- Around line 53-56: Update the enabled condition in the useReadReplicasQuery
call so replica options load both when creating a new association and when an
existing read-replica account is displayed, while retaining the project
reference and showPrivateLinkReadReplica requirements.
In
`@apps/studio/components/interfaces/Settings/Integrations/AWSPrivateLink/AWSPrivateLinkSection.tsx`:
- Around line 143-147: Update the delete confirmation rendering in
AWSPrivateLinkSection to include database_identifier for the primary database as
well as READ_REPLICA accounts, matching the target label behavior in
AWSPrivateLinkAccountItem; preserve the existing AWS account ID and conditional
“on” formatting.
---
Nitpick comments:
In
`@apps/studio/components/interfaces/Settings/Integrations/AWSPrivateLink/AWSPrivateLinkForm.tsx`:
- Around line 52-55: Rename the boolean variable showPrivateLinkReadReplica to
isPrivateLinkReadReplicaEnabled throughout AWSPrivateLinkForm, including its use
in the useReadReplicasQuery enabled condition, without changing the feature-flag
behavior.
- Around line 69-73: Replace the nested status ternary used to compute the title
with a status-to-title map or switch statement. Update the title logic near the
account status checks while preserving the existing title for each status and
fallback behavior.
🪄 Autofix (Beta)
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: 2c8bf82f-f2e4-4c55-b0a0-9e867e534bab
📒 Files selected for processing (8)
apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/DropAllReplicasConfirmationModal.tsxapps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/DropReplicaConfirmationModal.tsxapps/studio/components/interfaces/Settings/Integrations/AWSPrivateLink/AWSPrivateLinkAccountItem.tsxapps/studio/components/interfaces/Settings/Integrations/AWSPrivateLink/AWSPrivateLinkForm.tsxapps/studio/components/interfaces/Settings/Integrations/AWSPrivateLink/AWSPrivateLinkSection.tsxapps/studio/data/aws-accounts/aws-account-create-mutation.tsapps/studio/data/aws-accounts/aws-account-delete-mutation.tsapps/studio/data/aws-accounts/aws-accounts-query.ts
There was a problem hiding this comment.
[JFYI this is just an automated test that I run as a first pass - will still do one more check on top of this]
Preview test — ✅ all pass (two notes worth a look)
No explicit "To test" section on this one, so I inferred the checklist from the diff (new "Database target" on AWS PrivateLink connections, gated by the privatelinkReadReplica flag) and ran through it on the studio-staging preview, using a project with an existing read replica.
| # | Test | Result |
|---|---|---|
| 1 | AWS PrivateLink section reachable | ✅ Settings → Integrations shows the section fine |
| 2 | New-connection form shows "Database target" (Primary / Read replica) | ✅ Both options present: "Primary database" and "Read replica (Singapore - jqusn)" |
| 3 | Flag gating — field hidden when flag is off | privatelinkReadReplica override cookie. See notes. |
| 4 | Create connection targeting Primary | ✅ Saved fine, list shows "Primary database" sub-label |
| 5 | Create connection targeting the read replica | ✅ Saved fine, list shows "Read replica (cdfkalgzdwdepvkkwewk-rr-ap-southeast-1-jqusn)" |
| 6 | Edit primary-targeted connection | ✅ "Database target" shown, disabled, "Primary database" |
| 7 | Edit replica-targeted connection | ✅ "Database target" shown, disabled, correct replica |
| 8 | Delete dialog wording — replica-targeted | ✅ "...delete the AWS account connection for 123456789013 on cdfkalgzdwdepvkkwewk-rr-ap-southeast-1-jqusn?" |
| 9 | Delete dialog wording — primary-targeted | ✅ "...delete the AWS account connection for 123456789012?" — no "on X" suffix |
| 10 | Drop single read replica while a PrivateLink association is active | ✅ Blocked as designed — backend returned 400 with the PrivateLink-association message, replica stayed put (confirmed still ACTIVE_HEALTHY after) |
| 11 | Remove the association, confirm it unblocks | ✅ Deleted the replica-targeted connection successfully, no side effects |
Notes:
- Flag gating (#3): the "Database target" field showed up on the new-connection form even before I applied any
privatelinkReadReplicacookie override, so I never actually saw the "off" state — worth a quick check that the flag's default/rollout is what you expect for this account, in case it's live for everyone already rather than gated. - Minor, likely pre-existing and not scoped to this PR: reopening "Add AWS Account" for a second new connection pre-fills the previous submission's values instead of resetting blank (Account ID, name, and now also Database target carry over) — you have to manually overwrite them. Flagging since the new field inherits it too, but the underlying form-reset behavior looks unrelated to this diff.
- Didn't directly see the rendered toast text for the blocked-removal case (#10) — it had auto-dismissed by the time I checked — but confirmed via the network response that the backend error matches what the frontend's regex expects, so the mapped toast text should be showing correctly.
- Didn't test "drop all replicas" blocked by association (only a single-replica drop) — same code path, lower value to duplicate.
- Side effects: created two throwaway AWS PrivateLink connections for testing, both deleted afterward — nothing left over. Did not touch the read replica itself (left running, untouched, as requested) and didn't create or delete any projects.
|
JFYI for visibility the latest commits are to
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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/Settings/Infrastructure/InfrastructureConfiguration/MapView.tsx`:
- Around line 305-314: Wrap the disabled Manage replica item in
DropdownMenuItemTooltip and provide tooltip text stating that the replica must
be healthy before it can be managed. Preserve the existing disabled condition
based on database.status and keep the Link destination and label unchanged.
In `@apps/studio/data/aws-accounts/aws-accounts-query.ts`:
- Around line 14-19: The AWSAccount type currently permits READ_REPLICA
associations without a database_identifier, allowing deletion to fall back to
the account-level path. Update AWSAccount to use a required discriminated union:
PRIMARY associations may omit the identifier, while READ_REPLICA associations
must require database_identifier; preserve the existing API fields and
generated-schema intersection.
🪄 Autofix (Beta)
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: 3e84a81d-01c1-47f7-a53d-7611237466b7
📒 Files selected for processing (22)
apps/studio/components/interfaces/Database/Replication/Destinations.tsxapps/studio/components/interfaces/Database/Replication/ReadReplicas/DropReplicaConfirmationModal.tsxapps/studio/components/interfaces/Database/Replication/ReadReplicas/ReadReplicaDetails.tsxapps/studio/components/interfaces/Database/Replication/ReadReplicas/ReadReplicaRow.tsxapps/studio/components/interfaces/Database/Replication/ReadReplicas/ReadReplicas.utils.tsapps/studio/components/interfaces/Database/Replication/ReadReplicas/RestartReplicaConfirmationModal.tsxapps/studio/components/interfaces/Database/Replication/Replication.constants.tsapps/studio/components/interfaces/Database/Replication/ReplicationDiagram/Edges.tsxapps/studio/components/interfaces/ProjectHome/TopSection.tsxapps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/DropAllReplicasConfirmationModal.tsxapps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/Edge.tsxapps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.constants.tsapps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.tsxapps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.utils.tsapps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceNode.tsxapps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/MapView.tsxapps/studio/components/interfaces/Settings/Integrations/AWSPrivateLink/AWSPrivateLinkAccountItem.tsxapps/studio/components/interfaces/Settings/Integrations/AWSPrivateLink/AWSPrivateLinkForm.tsxapps/studio/components/interfaces/Settings/Integrations/AWSPrivateLink/AWSPrivateLinkSection.tsxapps/studio/components/ui/DatabaseSelector.tsxapps/studio/data/aws-accounts/aws-accounts-query.tsapps/studio/pages/project/[ref]/database/replication/replica/[replicaId].tsx
💤 Files with no reviewable changes (3)
- apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.utils.ts
- apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/DropAllReplicasConfirmationModal.tsx
- apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.constants.ts
🚧 Files skipped from review as they are similar to previous changes (3)
- apps/studio/components/interfaces/Settings/Integrations/AWSPrivateLink/AWSPrivateLinkSection.tsx
- apps/studio/components/interfaces/Settings/Integrations/AWSPrivateLink/AWSPrivateLinkAccountItem.tsx
- apps/studio/components/interfaces/Settings/Integrations/AWSPrivateLink/AWSPrivateLinkForm.tsx
joshenlim
left a comment
There was a problem hiding this comment.
Changes LGTM - although just flagging something that i ran into while testing on staging preview
After adding a private link on a read replica - could verify that the API returns the private link error when trying to drop the read replica
However, after deleting the private link, the API still returns the private link error when im trying to drop the replica
Wondering if its because deletion of the private link takes a while in the background?
Braintrust eval report
|
Frontend changes for new privatelink functionality.
The updates to the API are already live, but will be putting the UI changes behind a feature flag while we do some full end to end testing.
Changes to Integration page:

Changes to create associations page:

Fixes SEC-919
Summary by CodeRabbit
New Features
Bug Fixes
Updates