agent-native icon indicating copy to clipboard operation
agent-native copied to clipboard

Preview Database Isolation Fix

Open shomix opened this issue 4 months ago • 19 comments

Every PR preview was sharing one database connection. When two PRs were open at the same time, opening or closing one could point another PR's preview at the wrong database — or break it entirely. This showed up as failed sign-ins and 502 errors on active previews, even though the setup workflow reported success.

The fix

Each PR preview now gets its own database, scoped to that PR's branch. Opening, updating, or closing one PR no longer affects any other PR's preview. Production is unaffected.

Everything is contained in .github/workflows/neon-preview-branches.yml:

  • When a PR opens, its database URL is saved as a value tied to that PR's branch, so PRs can't overwrite each other.
  • When a PR closes, only that PR's own database URL is removed. Other PRs and production keep theirs.
  • The workflow now fails loudly if the Netlify API call fails, instead of reporting a false success.
  • Database connection strings are stored as secrets.

Testing

Verified with two concurrent preview PRs: each had its own working database and sign-in, and opening or closing one did not affect the other.

shomix avatar Jul 16 '26 15:07 shomix

Deploy Preview for agent-native-design ready!

Name Link
Latest commit 4b8217c9af6ef874a868c9186b7e72515e1f0b01
Latest deploy log https://app.netlify.com/projects/agent-native-design/deploys/6a5a1eab223ac100078a5637
Deploy Preview https://deploy-preview-2185--agent-native-design.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

netlify avatar Jul 16 '26 15:07 netlify

Deploy Preview for agent-native-images ready!

Name Link
Latest commit 4b8217c9af6ef874a868c9186b7e72515e1f0b01
Latest deploy log https://app.netlify.com/projects/agent-native-images/deploys/6a5a1eabdcde3800086332dd
Deploy Preview https://deploy-preview-2185--agent-native-images.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

netlify avatar Jul 16 '26 15:07 netlify

Deploy Preview for agent-native-brain ready!

Name Link
Latest commit 4b8217c9af6ef874a868c9186b7e72515e1f0b01
Latest deploy log https://app.netlify.com/projects/agent-native-brain/deploys/6a5a1eab673156000856420f
Deploy Preview https://deploy-preview-2185--agent-native-brain.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

netlify avatar Jul 16 '26 15:07 netlify

Deploy Preview for nutritrack-daily-calories canceled.

Name Link
Latest commit 67d2d6fea614c3048f9c87871fdd968459cc4a2d
Latest deploy log https://app.netlify.com/projects/nutritrack-daily-calories/deploys/6a5916c43405af0008a20458

netlify avatar Jul 16 '26 15:07 netlify

Deploy Preview for agent-native-mail canceled.

Name Link
Latest commit 71bde771d47fa2cea0aa8f4f6e1ce88df3d1d4e3
Latest deploy log https://app.netlify.com/projects/agent-native-mail/deploys/6a58fdd03a267d0008537ff2

netlify avatar Jul 16 '26 15:07 netlify

Deploy Preview for agent-native-macros canceled.

Name Link
Latest commit 71bde771d47fa2cea0aa8f4f6e1ce88df3d1d4e3
Latest deploy log https://app.netlify.com/projects/agent-native-macros/deploys/6a58fdd03309d20008698953

netlify avatar Jul 16 '26 15:07 netlify

Deploy Preview for agent-native-starter canceled.

Name Link
Latest commit 71bde771d47fa2cea0aa8f4f6e1ce88df3d1d4e3
Latest deploy log https://app.netlify.com/projects/agent-native-starter/deploys/6a58fdd19afde90007cf69cf

netlify avatar Jul 16 '26 15:07 netlify

Deploy Preview for agent-native-content canceled.

Name Link
Latest commit 71bde771d47fa2cea0aa8f4f6e1ce88df3d1d4e3
Latest deploy log https://app.netlify.com/projects/agent-native-content/deploys/6a58fdd04081ca00082cac36

netlify avatar Jul 16 '26 15:07 netlify

Deploy Preview for agent-native-slides canceled.

Name Link
Latest commit 71bde771d47fa2cea0aa8f4f6e1ce88df3d1d4e3
Latest deploy log https://app.netlify.com/projects/agent-native-slides/deploys/6a58fdd16d5a14000996d77a

netlify avatar Jul 16 '26 15:07 netlify

Deploy Preview for agent-native-dispatch canceled.

Name Link
Latest commit 71bde771d47fa2cea0aa8f4f6e1ce88df3d1d4e3
Latest deploy log https://app.netlify.com/projects/agent-native-dispatch/deploys/6a58fdd047df990008f829b8

netlify avatar Jul 16 '26 15:07 netlify

Here's a visual recap of what changed:

Visual recap

Open the full interactive recap

github-actions[bot] avatar Jul 16 '26 15:07 github-actions[bot]

Deploy Preview for agent-native-calendar canceled.

Name Link
Latest commit 67d2d6fea614c3048f9c87871fdd968459cc4a2d
Latest deploy log https://app.netlify.com/projects/agent-native-calendar/deploys/6a5916c465fe7d0008177832

netlify avatar Jul 16 '26 16:07 netlify

Deploy Preview for agent-native-forms canceled.

Name Link
Latest commit 67d2d6fea614c3048f9c87871fdd968459cc4a2d
Latest deploy log https://app.netlify.com/projects/agent-native-forms/deploys/6a5916c41a4bf90008c462c1

netlify avatar Jul 16 '26 16:07 netlify

Deploy Preview for agent-native-starter canceled.

Name Link
Latest commit 67d2d6fea614c3048f9c87871fdd968459cc4a2d
Latest deploy log https://app.netlify.com/projects/agent-native-starter/deploys/6a5916c41752ce0008c69850

netlify avatar Jul 16 '26 16:07 netlify

Deploy Preview for agent-native-content canceled.

Name Link
Latest commit 67d2d6fea614c3048f9c87871fdd968459cc4a2d
Latest deploy log https://app.netlify.com/projects/agent-native-content/deploys/6a5916c41612c10008921ca3

netlify avatar Jul 16 '26 16:07 netlify

Deploy Preview for agent-native-dispatch canceled.

Name Link
Latest commit 67d2d6fea614c3048f9c87871fdd968459cc4a2d
Latest deploy log https://app.netlify.com/projects/agent-native-dispatch/deploys/6a5916c4b1a6f2000896c7bf

netlify avatar Jul 16 '26 16:07 netlify

Deploy Preview for agent-native-slides canceled.

Name Link
Latest commit 67d2d6fea614c3048f9c87871fdd968459cc4a2d
Latest deploy log https://app.netlify.com/projects/agent-native-slides/deploys/6a5916c4bd9e9d00081737b0

netlify avatar Jul 16 '26 16:07 netlify

Deploy Preview for agent-native-mail canceled.

Name Link
Latest commit 67d2d6fea614c3048f9c87871fdd968459cc4a2d
Latest deploy log https://app.netlify.com/projects/agent-native-mail/deploys/6a5916c4a23a8c0008032b64

netlify avatar Jul 16 '26 16:07 netlify

Deploy Preview for agent-native-macros canceled.

Name Link
Latest commit 67d2d6fea614c3048f9c87871fdd968459cc4a2d
Latest deploy log https://app.netlify.com/projects/agent-native-macros/deploys/6a5916c47b66dc00081d325f

netlify avatar Jul 16 '26 16:07 netlify