Skip to content

fix(stack): apply roles.sql once and as postgres (CLI-3130) - #7595

Merged
7ttp merged 1 commit into
developfrom
7ttp/cli-3130-stack-apply-rolessql-once-and-as-postgres
Nov 12, 2026
Merged

7ttp merged 1 commit into
developfrom
7ttp/cli-3130-stack-apply-rolessql-once-and-as-postgres

Conversation

@7ttp

@7ttp 7ttp commented Nov 12, 2026

Copy link
Copy Markdown
Member

TL;DR

fixes the stack replaying supabase/roles.sql on a later start and running it as supabase_admin

what's missing?

adding or dropping a service between starts ran roles.sql again, so a plain create role failed with role "…" already exists

it also ran as supabase_admin instead of postgres, so a migration using a schema from roles.sql failed with permission denied for schema

now fixed by?

the stack runs it once on first setup, as postgres, like the legacy backend

visual rep
flowchart TD
  A["roles.sql<br/>create role app_user; create schema app"] --> B["first supabase start"]
  B -- before --> C["runs as supabase_admin<br/>app owned by supabase_admin"]
  C -.-> D["migration: create table app.t<br/>permission denied for schema app"]
  B -- now --> E["runs as postgres<br/>app owned by postgres"]
  E --> F["migration: create table app.t<br/>ok"]
  B --> G["stop, then start with another service set"]
  G -- before --> H["roles.sql runs again"]
  H -.-> I["role app_user already exists<br/>start fails"]
  G -- now --> J["roles.sql already applied<br/>start ok"]
  classDef t fill:transparent
  classDef bad fill:transparent,stroke-dasharray:5 4
  class A,B,C,E,F,G,H,J t
  class D,I bad
Loading

ref:

@7ttp 7ttp self-assigned this Nov 12, 2026
@7ttp
7ttp requested a review from a team as a code owner November 12, 2026 10:01
@7ttp
7ttp requested a review from Coly010 November 12, 2026 10:02
@github-actions

Copy link
Copy Markdown
Contributor

CLI benchmark (Lightweight Commands): no changes found

Commit 66dc64f against develop at 74a9afc · 10 runs each · report only, never blocks merging

Command Workload Before After Change
supabase --version version 188 ms 188 ms no real change
supabase --help help 218 ms 211 ms no real change
supabase init init 201 ms 200 ms no real change
supabase migration new bench migration-new 197 ms 206 ms no real change
supabase config convert config-convert 224 ms 223 ms no real change
supabase gen types --lang typescript --project-id replayfixtureprojref gen-types 260 ms 254 ms no real change
supabase projects list projects-list 226 ms 222 ms no real change
supabase functions list --project-ref replayfixtureprojref functions-list 224 ms 226 ms no real change

API calls: unchanged for all 8 commands.

Binary size: 135.0 MB, unchanged.

Details: timing ranges, API calls per command, slowest phases

Timing ranges

Command Workload Before range After range Change Verdict
supabase --version version 179-209 ms 172-199 ms +0 ms (+0%) within noise
supabase --help help 199-247 ms 168-246 ms -7 ms (-3%) within noise
supabase init init 180-230 ms 192-225 ms -1 ms (0%) within noise
supabase migration new bench migration-new 190-221 ms 177-261 ms +9 ms (+5%) within noise
supabase config convert config-convert 220-254 ms 199-236 ms -1 ms (0%) within noise
supabase gen types --lang typescript --project-id replayfixtureprojref gen-types 213-278 ms 220-289 ms -5 ms (-2%) within noise
supabase projects list projects-list 208-267 ms 205-271 ms -4 ms (-2%) within noise
supabase functions list --project-ref replayfixtureprojref functions-list 210-257 ms 202-284 ms +2 ms (+1%) within noise

API calls per command

Command Workload Before After Endpoint changes
supabase --version version 0 0
supabase --help help 0 0
supabase init init 0 0
supabase migration new bench migration-new 0 0
supabase config convert config-convert 0 0
supabase gen types --lang typescript --project-id replayfixtureprojref gen-types 2 2
supabase projects list projects-list 1 1
supabase functions list --project-ref replayfixtureprojref functions-list 2 2

Slowest phases

No command moved beyond noise, so there are no phase deltas.

Workflow run

Comment /bench to run the lightweight benchmark (this comment) again on the latest commit, or /bench full to also run the integration-heavy benchmark, which posts in its own comment.

@github-actions github-actions 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.

🤖 AI Review

Both independent reviews completed with no findings. Inspection of the diff and surrounding code confirmed the overlay lifecycle, postgres credentials and ownership, webhook refresh, and shadow-cache invalidation. No actionable issues or fundamental conflicts with the pending next-branch work were found. Tests were inspected but not executed.

Findings

No issues found.

Stats

Claude findings: 0 · Codex findings: 0 · Confirmed: 0 · Refuted: 0 · Uncertain: 0


Models: claude-opus-5-5 + gpt-6.1-sol · Trigger: auto · Workflow run

This review runs once per PR. A maintainer can request another with a /ai-review comment.

@jgoux jgoux 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.

Looks good: the overlay now runs once on first setup as postgres, later starts still reapply webhooks, and the shadow cache key bump drops baselines built under the old owner.

@7ttp
7ttp added this pull request to the merge queue Nov 12, 2026
Merged via the queue into develop with commit bc3b960 Nov 12, 2026
59 checks passed
@7ttp
7ttp deleted the 7ttp/cli-3130-stack-apply-rolessql-once-and-as-postgres branch November 12, 2026 11:12
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