Skip to content

Rebuild seed.sql for the #755 revokes, and catch seed drift before main #808

Open

Description

@HMarzban

Summary

The weekly "Supabase Policy Tests" run fails at its first check, Check seed.sql matches scripts/.
So the pgTAP tests have not run since 2026-11-08.
The cause is commit fbff54d6d (#755, 2026-11-12).
It edited two scripts/*.sql files but did not rebuild packages/supabase/seed.sql.
This is the second time in three weeks that seed drift has stopped this workflow.

Evidence

Source: gh run list --workflow supabase-policies.yml and gh run view <id> --log-failed, read 2026-11-22.
The workflow has only 4 runs in all, so the last 10 runs are these 4.

Run Started (UTC) Event Commit Result Failed step
44986311138 2026-11-22 04:43 schedule 6da3a609e failure Check seed.sql matches scripts/
43676934259 2026-11-15 04:28 schedule 9f0e2be02 failure Check seed.sql matches scripts/
42444903359 2026-11-08 03:58 schedule d31ed9033 success none
42271557674 2026-11-06 18:32 workflow_dispatch 44be02585 failure Check seed.sql matches scripts/
  • n = 4 runs, 2026-11-06 to 2026-11-22. 3 failed and 1 passed. All 3 failures stopped at the same step.
  • The runs on 2026-11-15 and 2026-11-22 show the same diff: 10 added lines and 0 removed lines, in 2 hunks.
    Every added line comes from Revoke anon and public EXECUTE on three invoker notification RPCs #755. The run on 2026-11-06 had a different drift, which f05dfeed3 fixed.
  • In each failed run, Start Supabase and Run the pgTAP tests were skipped.
  • At HEAD (3468060ca), grep -c '#755' packages/supabase/seed.sql prints 0.
    The same grep finds 1 line in each of the two scripts.

The lines that the check adds, from run 44986311138:

+-- Signed-in only (#755): close public and anon.
+revoke execute on function public.get_workspace_notifications(uuid, character varying, integer, integer, boolean) from public, anon;
+grant execute on function public.get_workspace_notifications(uuid, character varying, integer, integer, boolean) to authenticated;
...
+-- Signed-in only (#755): close public and anon.
+revoke execute on function public.get_unread_notifications_paginated(character varying, text, integer, integer) from public, anon;
+grant execute on function public.get_unread_notifications_paginated(character varying, text, integer, integer) to authenticated;
+revoke execute on function public.get_channel_notif_state(character varying) from public, anon;
+grant execute on function public.get_channel_notif_state(character varying) to authenticated;

Cause

fbff54d6d changed scripts/07-1-notification-functions.sql (+4 lines) and scripts/10-functions.sql (+6 lines).
It added the migration 20261112120000_revoke_anon_invoker_notification_rpcs.sql too.
It did not run generate-seed.ts, so seed.sql kept the old grants.

Three gaps let the drift reach main:

  1. The commit went to main without a pull request. The workflow's pull_request trigger never ran.
  2. The workflow runs only on pull requests and on the weekly schedule, as the Build an SQL test harness for chat RLS and storage policies, and run it in CI #583 ruling of 2026-10-24 set.
    So the next check was the Sunday schedule, up to 7 days later.
  3. check:ci runs supabase parity and supabase grants. Neither compares seed.sql to scripts/.
    The parity check does not compare grants and revokes. packages/supabase/CLAUDE.md states this limit.

This is a real repo bug, not a flake and not a runner change.
The two #755 runs print the same diff, and the step is a plain git diff --exit-code.

Impact:

  • The pgTAP policy tests have not run for 14 days.
    A new policy bug in that window would not show in CI.
  • A fresh supabase start on empty volumes seeds from the committed seed.sql.
    There, anon can still run the three RPCs.
    bun run --filter @docs.plus/supabase_back reset rebuilds the seed first, so it is not affected.
  • Production gets the revoke from the migration, not from seed.sql. This issue does not change production.
  • No file under packages/supabase changed since, so the next scheduled run on 2026-11-29 fails the same way unless the seed is rebuilt.

Proposed fix

  1. Rebuild the seed with bun run --filter @docs.plus/supabase_back seed, not by hand.
    Commit only packages/supabase/seed.sql, in the same shape as f05dfeed3.
  2. Add a supabase seed gate to scripts/check-ci.ts, next to supabase parity and supabase grants.
    It fails when the output of generate-seed.ts differs from the committed seed.sql.
    Give generate-seed.ts a --check flag that compares in memory, so the gate does not write the file.

Step 1 alone makes the workflow pass. Step 2 stops the next drift. A push trigger on main stays out of scope: it would reopen the #583 ruling, and step 2 already catches the drift before a deploy push.

Acceptance

  • bun generate-seed.ts && git diff --exit-code -- seed.sql exits 0 in packages/supabase at the fix commit.
  • grep -c '#755' packages/supabase/seed.sql prints 2.
  • A workflow_dispatch run of "Supabase Policy Tests" passes all three steps. The pgTAP step runs and passes.
  • bun run check:ci fails on a branch that edits a scripts/*.sql file without rebuilding seed.sql.
    It passes once the seed is rebuilt.

Activity

  1. added this to the v2.3.7 milestone on Nov 22, 2026
  2. added
    bugSomething isn't working
    SecuritySecurity, access control, and data exposure
    on Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    DevOpsSecuritySecurity, access control, and data exposurebugSomething isn't working

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions