Skip to content

BE-M0-22 · The system rows: permissions, roles, charge types and lead sources

ID BE-M0-22 · Level L0 · Pack Pack D · Seed and Storage · Run order row 21 · Issue #13

The system rows, written by tools/db/gen_seed.py (45 permissions, 11 system roles with 193 grants, 8 charge types and 11 lead sources), pass their tests with every earlier test (265 in 12 files); committed on the branch supabase/seed-storage.

  • Timeline row 20 (pack C) is Done: pack C is merged into main.
  • be-pack-d.zip, sent in the BE chat on 2026-10-07, is in ~/Downloads.
  • You are in ~/opleet-v2/opleet, git status --short prints nothing, and the stack is running.

1 · Check the zip, unzip it next to the repository, and check every file in it

Section titled “1 · Check the zip, unzip it next to the repository, and check every file in it”
Terminal window
shasum -a 256 ~/Downloads/be-pack-d.zip
unzip -q -o ~/Downloads/be-pack-d.zip -d ~/opleet-v2/packs
(cd ~/opleet-v2/packs/be-pack-d && shasum -a 256 -c SHA256SUMS)

2 · A branch for pack D, with this step's files

Section titled “2 · A branch for pack D, with this step's files”
Terminal window
cd ~/opleet-v2/opleet
git switch main && git pull
git switch -c supabase/seed-storage
cp -R ~/opleet-v2/packs/be-pack-d/BE-M0-22/. .
git status --short

3 · Run the generator, and confirm it writes the file the pack holds

Section titled “3 · Run the generator, and confirm it writes the file the pack holds”
Terminal window
python3 tools/db/gen_seed.py
cmp supabase/migrations/20261006001200_seed_system.sql ~/opleet-v2/packs/be-pack-d/BE-M0-22/supabase/migrations/20261006001200_seed_system.sql && echo "same as the pack"

4 · Rebuild the local database from every migration, then run every test

Section titled “4 · Rebuild the local database from every migration, then run every test”
Terminal window
pnpm supabase db reset
pnpm supabase test db
Terminal window
git add supabase tools/db
git commit -m "feat(supabase): the system rows: permissions, roles, charge types and lead sources"
  • Block 1: be-pack-d.zip's SHA-256 as written under Pack D, then 10 lines ending in “: OK”.
  • Block 2: “Switched to a new branch 'supabase/seed-storage'”, then ?? supabase/migrations/20261006001200_seed_system.sql, ?? supabase/tests/database/22_seed_system.test.sql and ?? tools/db/gen_seed.py.
  • Block 3: supabase/migrations/20261006001200_seed_system.sql: 45 permissions, 11 roles, 193 grants, 8 charge types, 11 lead sources, then “same as the pack”.
  • Block 4: db reset applies 20261006001200_seed_system.sql last and ends with “Finished supabase db reset”; test db ends with “All tests successful.”, “Files=12, Tests=265” and “Result: PASS”.
  • Block 5: Lefthook skips Biome and shows ✔️ commitlint, then the commit line with 3 files changed.
Terminal window
docker exec supabase_db_opleet psql -U postgres -At -c "select r.code, count(*) from public.roles r join public.role_permissions rp on rp.role_id = r.id where r.organization_id is null group by r.code order by r.code"
git log --oneline -1

Eleven lines: admin|40, admin_driver|15, admin_fleet|21, asuransi|16, background_check|4, checker|13, finance|6, maintenance|13, satpam|2, super_admin|45, viewer|18. Then “feat(supabase): the system rows: permissions, roles, charge types and lead sources”.

  • Block 1's hash differs, or a line says FAILED: download the zip again; if it still differs, stop and tell the BE session.
  • Block 3 prints “differ”: don't commit; paste the output and the output of python3 --version.
  • db reset stops at a migration: paste the error into the BE chat; don't edit the file.
  • test db prints “not ok”: paste every “not ok” line and the lines under it. Don't commit.

Not committed yet: git clean -fd supabase/migrations supabase/tests tools/db, then pnpm supabase db reset. Committed: git reset --hard HEAD~1, then pnpm supabase db reset. Nothing has been pushed.

Not run yet. Log each run as a comment on #13.