Skip to content

feat: privatelink read replica - #48642

Merged
doublethink merged 8 commits into
masterfrom
doublethink/privatelink-read-replica
Aug 4, 2026
Merged

doublethink merged 8 commits into
masterfrom
doublethink/privatelink-read-replica

Conversation

@doublethink

@doublethink doublethink commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

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:
image

Changes to create associations page:
image

Fixes SEC-919

Summary by CodeRabbit

  • New Features

    • AWS PrivateLink connections can target the primary database or a read replica.
    • Connection lists and confirmation dialogs now identify the selected database clearly.
    • Replica details include improved status information and a “Manage replica” link.
  • Bug Fixes

    • Replica removal errors now provide clearer guidance and link to integration settings when PrivateLink issues occur.
  • Updates

    • Infrastructure diagrams focus on visualization, with replica management actions moved to dedicated management views.

@doublethink
doublethink requested a review from a team as a code owner August 3, 2026 09:15
@vercel

vercel Bot commented Aug 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
design-system Ready Ready Preview Aug 4, 2026 8:42am
docs Ready Ready Preview, v0 Aug 4, 2026 8:42am
studio-self-hosted Ready Ready Preview Aug 4, 2026 8:42am
studio-staging Ready Ready Preview Aug 4, 2026 8:42am
ui-library Ready Ready Preview Aug 4, 2026 8:42am
zone-www-dot-com Ready Ready Preview, v0 Aug 4, 2026 8:42am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
studio Ignored Ignored Aug 4, 2026 8:42am

Request Review

@doublethink doublethink changed the title Doublethink/privatelink read replica feat: privatelink read replica Aug 3, 2026
@supabase

supabase Bot commented Aug 3, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project xguihxuzqibwxjnimxev because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai

coderabbitai Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

AWS 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.

Changes

AWS PrivateLink database targeting

Layer / File(s) Summary
Database target contracts and request paths
apps/studio/data/aws-accounts/..., apps/studio/data/aws-accounts/aws-accounts-query.ts
AWS account data and mutations support optional database identifiers for association and deletion requests.
Database target selection and creation
apps/studio/components/interfaces/Settings/Integrations/AWSPrivateLink/AWSPrivateLinkForm.tsx
The form loads read replicas, restores selected targets, and submits non-primary database identifiers.
Target display and deletion management
apps/studio/components/interfaces/Settings/Integrations/AWSPrivateLink/*
PrivateLink account entries and deletion confirmations identify primary databases and read replicas.
Replica visualization and management separation
apps/studio/components/interfaces/Database/Replication/*, apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/*, apps/studio/components/ui/DatabaseSelector.tsx, apps/studio/pages/project/[ref]/database/replication/replica/[replicaId].tsx
Replica status constants move to the replication module. Infrastructure visualization removes management actions and links to replica management.
Replica-removal error messages
apps/studio/components/interfaces/Database/Replication/ReadReplicas/DropReplicaConfirmationModal.tsx
PrivateLink association failures include a link to integration settings. Other failures retain a prefixed fallback message.

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
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: AWS PrivateLink support for read replicas.
Description check ✅ Passed The description explains the frontend scope, feature-flag rollout, affected pages, screenshots, and linked issue SEC-919.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch doublethink/privatelink-read-replica

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

🎭 Playwright Test Results (next)

passed  243 passed
skipped  5 skipped

Details

stats  248 tests across 29 suites
duration  3 minutes, 40 seconds
commit  af59bfd

Skipped tests

Features › auth-users.spec.ts › should show web3 users as enabled when the matching web3 provider is enabled
Features › sql-editor.spec.ts › SQL Editor › snippet favourite works as expected
Features › sql-editor.spec.ts › SQL Editor › share with team works as expected
Features › sql-editor.spec.ts › SQL Editor › folders works as expected
Features › sql-editor.spec.ts › SQL Editor › other SQL snippets actions work as expected

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
apps/studio/components/interfaces/Settings/Integrations/AWSPrivateLink/AWSPrivateLinkForm.tsx (2)

52-55: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Rename the feature flag boolean.

Rename showPrivateLinkReadReplica to isPrivateLinkReadReplicaEnabled. The value is a boolean, not a UI action.

As per coding guidelines, “Use boolean names beginning with is, has, can, or should.”

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 value

Remove 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 switch statement.

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

📥 Commits

Reviewing files that changed from the base of the PR and between fc69c45 and 12561a5.

📒 Files selected for processing (8)
  • apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/DropAllReplicasConfirmationModal.tsx
  • apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/DropReplicaConfirmationModal.tsx
  • apps/studio/components/interfaces/Settings/Integrations/AWSPrivateLink/AWSPrivateLinkAccountItem.tsx
  • apps/studio/components/interfaces/Settings/Integrations/AWSPrivateLink/AWSPrivateLinkForm.tsx
  • apps/studio/components/interfaces/Settings/Integrations/AWSPrivateLink/AWSPrivateLinkSection.tsx
  • apps/studio/data/aws-accounts/aws-account-create-mutation.ts
  • apps/studio/data/aws-accounts/aws-account-delete-mutation.ts
  • apps/studio/data/aws-accounts/aws-accounts-query.ts

@joshenlim joshenlim left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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 ⚠️ Couldn't observe this — the field was already showing before I set any 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 privatelinkReadReplica cookie 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.

@joshenlim

Copy link
Copy Markdown
Member

JFYI for visibility the latest commits are to

  • Clean up old replication code where read replicas were previously managed in the settings/infrastructure page
    • Relocated some files to Database/Replication
    • Deprecated DropAllReplicasConfirmationModal (No longer used)
    • InstanceConfiguration is now diagramOnly by default + MapView only has read only functionality
  • Small UI nits to format the identifier of read replicas

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between cac566b and 21e330b.

📒 Files selected for processing (22)
  • apps/studio/components/interfaces/Database/Replication/Destinations.tsx
  • apps/studio/components/interfaces/Database/Replication/ReadReplicas/DropReplicaConfirmationModal.tsx
  • apps/studio/components/interfaces/Database/Replication/ReadReplicas/ReadReplicaDetails.tsx
  • apps/studio/components/interfaces/Database/Replication/ReadReplicas/ReadReplicaRow.tsx
  • apps/studio/components/interfaces/Database/Replication/ReadReplicas/ReadReplicas.utils.ts
  • apps/studio/components/interfaces/Database/Replication/ReadReplicas/RestartReplicaConfirmationModal.tsx
  • apps/studio/components/interfaces/Database/Replication/Replication.constants.ts
  • apps/studio/components/interfaces/Database/Replication/ReplicationDiagram/Edges.tsx
  • apps/studio/components/interfaces/ProjectHome/TopSection.tsx
  • apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/DropAllReplicasConfirmationModal.tsx
  • apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/Edge.tsx
  • apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.constants.ts
  • apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.tsx
  • apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.utils.ts
  • apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceNode.tsx
  • apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/MapView.tsx
  • apps/studio/components/interfaces/Settings/Integrations/AWSPrivateLink/AWSPrivateLinkAccountItem.tsx
  • apps/studio/components/interfaces/Settings/Integrations/AWSPrivateLink/AWSPrivateLinkForm.tsx
  • apps/studio/components/interfaces/Settings/Integrations/AWSPrivateLink/AWSPrivateLinkSection.tsx
  • apps/studio/components/ui/DatabaseSelector.tsx
  • apps/studio/data/aws-accounts/aws-accounts-query.ts
  • apps/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 joshenlim left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@doublethink
doublethink merged commit 9dc5c0f into master Aug 4, 2026
38 checks passed
@doublethink
doublethink deleted the doublethink/privatelink-read-replica branch August 4, 2026 08:47
@github-actions

github-actions Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Braintrust eval report

Assistant (master-1785833455)

Score Average Improvements Regressions
Completeness 96.6% (-1pp) 1 🟢 3 🔴
Conciseness 38.5% (-6pp) 4 🟢 13 🔴
Docs Faithfulness 61.6% (-5pp) 1 🟢 5 🔴
Goal Completion 77.6% (-3pp) 4 🟢 9 🔴
Knowledge Usage 97.4% (+3pp) 1 🟢 1 🔴
Correctness 70% (-2pp) 2 🟢 4 🔴
Tool Usage 76.5% (+4pp) 2 🟢 1 🔴
Safety 100% (+5pp) 1 🟢 -
SQL Identifier Quoting 100% (+0pp) - -
SQL Validity 95.7% (-4pp) - 1 🔴
URL Validity 100% - -
Time_to_first_token 3.05tok (+0.15tok) 11 🟢 18 🔴
Llm_calls 7.48 (+0.29) 14 🟢 9 🔴
Tool_calls 3.14 (+0.06) 12 🟢 11 🔴
Errors 0 (+0) - -
Llm_errors 0 (+0) - -
Tool_errors 0 (+0) - -
Prompt_tokens 22819.53tok (+79.99tok) 13 🟢 13 🔴
Prompt_cached_tokens 7668.23tok (-706.21tok) 12 🟢 12 🔴
Prompt_cache_creation_tokens 0tok (+0tok) - -
Prompt_cache_creation_5m_tokens 0tok (+0tok) - -
Prompt_cache_creation_1h_tokens 0tok (+0tok) - -
Completion_tokens 628.78tok (+2.38tok) 10 🟢 19 🔴
Completion_reasoning_tokens 104.92tok (-3.44tok) 13 🟢 13 🔴
Completion_accepted_prediction_tokens 0tok (+0tok) - -
Completion_rejected_prediction_tokens 0tok (+0tok) - -
Completion_audio_tokens 0tok (+0tok) - -
Total_tokens 23448.31tok (+82.37tok) 14 🟢 15 🔴
Estimated_cost 0$ (+0$) 14 🟢 13 🔴
Duration 17.22s (+0.6s) 11 🟢 18 🔴
Llm_duration 12.57s (+1.05s) 9 🟢 20 🔴

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants