Skip to content

BE-M0-34 · Access: pools named, new pools for super_admin, grant only what you hold

ID BE-M0-34 · Level L0 · Pack Pack G1 · The review's schema changes · Run order row 22b · Issue #150

Every role and override names its pool, and nothing holds at a pool no role names (R-ACC-04). A new pool goes to every super_admin of its organization (R-ACC-47). Without user:read a member reads only the permissions they hold (R-ACC-33). A member grants a role, a grant or a deny at a pool only for permissions they hold there, or it is refused with access.grant_not_held (R-ACC-50). The catalogue has 46 codes, gate:write in and vehicle:delete out, and the 11 system roles hold 198 grants (R-ACC-35, R-ACC-36).

This step changes no file: the code arrived with pack G1's pull request. It proves the change on your Mac's local stack.

  • Pack G1's pull request is merged into main.
  • You are in ~/opleet-v2/opleet, the local stack is running (pnpm supabase start), and git status --short prints nothing.

The migration files were edited in place (D11), so the local database is rebuilt, never migrated.

Terminal window
git switch main && git pull
pnpm supabase db reset
Terminal window
pnpm supabase test db supabase/tests/database/13_tenancy_access.test.sql supabase/tests/database/22_seed_system.test.sql
  • Block 1: "Finished supabase db reset".
  • Block 2: ok on every line, then All tests successful., Files=2, Tests=64 and Result: PASS.
Terminal window
pnpm supabase db query --local "select count(*) from public.member_roles where pool_id is null"

0. No role is held at every pool by an empty pool any more.

  • supabase db reset stops on a migration: paste the file name and the error into #150. Don't edit the file.
  • A test fails: paste the not ok line and the lines under it that start with #. The test's description starts with the rule it proves.
  • "permission denied" or "must be owner" on auth.sessions: stop and paste it. That means a migration can't end sessions on this stack (D37); BE says so on the issue before changing anything.

Nothing to undo: the step changes no file. pnpm supabase db reset rebuilds the local database from main at any time. Never run any part of it against staging or production.

Log each run as a comment on #150: the date, the last lines of block 2, and the check's output.