From 7244648b4ccd56c12202e291c34b0587fba0a79c Mon Sep 17 00:00:00 2001 From: bchanot Date: Tue, 27 Oct 2026 14:44:03 +0100 Subject: [PATCH] test(supabase): pgTAP 007 and 010 independent of the base's data --- docs/development/SUPABASE.md | 22 +++++++++++-- supabase/tests/007_equine_seed.sql | 28 ++++++++++++---- supabase/tests/010_files_foundation.sql | 43 ++++++++++++++++++++++--- 3 files changed, 80 insertions(+), 13 deletions(-) diff --git a/docs/development/SUPABASE.md b/docs/development/SUPABASE.md index 423bc80d..e95f2c24 100644 --- a/docs/development/SUPABASE.md +++ b/docs/development/SUPABASE.md @@ -481,7 +481,7 @@ devsql postgres < "$B/counts.sql" > "$B/counts-after.txt"; diff "$B/counts-befor # tables private 1 → 2, public 7 → 12; functions private 41 → 54, public 26 → 40; policies 15 → 20; # rls tables public 7 → 12. Every count and md5 of the existing rows is unchanged. pnpm db:types:check # no diff -pnpm db:test; echo "db:test exit $?" # pgTAP 001-014, exit 0 (see its effects below) +pnpm db:test; echo "db:test exit $?" # pgTAP 001-014, 921 assertions, exit 0 (see its effects and the 2026-10-27 run below) echo "select 'pgtap ' || count(*) from pg_extension where extname = 'pgtap';" | devsql postgres # 0, as before the run; 1 = left installed (interrupted run): report it, do not drop it by hand devsql postgres < "$B/counts.sql" | diff "$B/counts-after.txt" - # no diff: the tests left no row @@ -495,7 +495,25 @@ the scripts: the `pgtap` extension before the run and drops it after when it was absent (DEV: absent), a transient schema change; an interrupted run can leave `pgtap` installed (`post.sql` shows it). Run it before the browser - acceptance, with no app session open. + acceptance, with no app session open and the worker stopped (010 leases + the queue rows it finds until its rollback). The files share the stack with the + data it already holds: 007 and 010 count only their own keys, and 010 + first leases the base's own queued work (due purge entries, avatar jobs, + uploads begun more than 24 h ago) inside its transaction. Assumptions that + stay: the avatars bucket far below its 10 GiB ceiling; fewer than about 90 + quarantine leftovers of the base (the sweep returns at most 100, oldest + first); the official equine sheet still at its seeded single draft (007 + checks the seed as delivered). +- First run on DEV after M1 to M3 (2026-10-27, suites at `6c36e2f`): exit 1, + 919 assertions planned, 915 run, 914 passed. 007 stopped at its storage + insert (the drawing was already uploaded and confirmed on DEV: duplicate + key, 4 assertions never run); 010 failed « nothing is due before its grace + elapsed » (13 due purge entries of DEV counted). 012 to 014 (V1-1) passed; + data, privileges and `pgtap` (absent) identical before and after. Both + files were fixed on the branch (007: 20 assertions, 010: 141) and validated + on the sandbox, clean and with those conditions reproduced (scenarios and + mutations in the journal of 2026-10-27). DEV is not validated by `db:test` + until a run there passes. - `pnpm e2e:avatar`: not part of this procedure; optional, the owner's call. It writes on DEV beyond its own fixture: it creates a temporary confirmed account `e2e-avatar-