echo "URL: $SUPABASE_URL"; echo "REF: $SUPABASE_PROJECT_REF"; echo "DB_URL set: $([ -n "$SUPABASE_DB_URL" ] && echo yes)"; which pg_dump psql; pg_dump --version; psql --version
URL: https://<ref>.supabase.co REF: <ref> DB_URL set: yes /usr/bin/pg_dump /usr/bin/psql pg_dump (PostgreSQL) 18.4 (Debian 18.4-1.pgdg12+1) psql (PostgreSQL) 18.4 (Debian 18.4-1.pgdg12+1)
psql "$SUPABASE_DB_URL" -c "\d public.payments" 2>&1 | head -50; echo "---ROWCOUNT---"; psql "$SUPABASE_DB_URL" -tAc "SELECT count(*) FROM public.payments;"
Table "public.payments"
Column | Type | Collation | Nullable | Default
--------------+--------------------------+-----------+----------+---------
id | integer | | not null |
ref_code | text | | not null |
payer | text | | not null |
amount_cents | integer | | not null |
paid_at | timestamp with time zone | | not null |
Indexes:
"payments_pkey" PRIMARY KEY, btree (id)
---ROWCOUNT---
80
psql "$SUPABASE_DB_URL" -c "\d public.incident_log" 2>&1 | head -30; echo "---CURRENT LOG---"; psql "$SUPABASE_DB_URL" -c "SELECT * FROM public.incident_log;" 2>&1 | head -20
Table "public.incident_log"
Column | Type | Collation | Nullable | Default
---------+--------------------------+-----------+----------+----------------------------------
id | bigint | | not null | generated by default as identity
ran_at | timestamp with time zone | | not null | now()
details | text | | not null |
Indexes:
"incident_log_pkey" PRIMARY KEY, btree (id)
---CURRENT LOG---
id | ran_at | details
----+--------+---------
(0 rows)
mkdir -p /tmp/drill && cd /tmp/drill # Full custom-format dump of just public.payments (schema + data) pg_dump "$SUPABASE_DB_URL" --table=public.payments --format=custom --file=/tmp/drill/payments.dump 2>&1 echo "custom dump exit=$?" # Plain SQL dump too (data-only, column-inserts for maximum portability) pg_dump "$SUPABASE_DB_URL" --table=public.payments --data-only --column-inserts --file=/tmp/drill/payments_data.sql 2>&1 echo "sql dump exit=$?" ls -la /tmp/drill
custom dump exit=0 sql dump exit=0 total 32 drwxr-xr-x 2 root root 4096 Jul 26 02:02 . drwxrwxrwt 1 root root 4096 Jul 26 02:02 .. -rw-r--r-- 1 root root 4864 Jul 26 02:02 payments.dump -rw-r--r-- 1 root root 13237 Jul 26 02:02 payments_data.sql
cd /tmp/drill echo "=== custom dump TOC ==="; pg_restore --list /tmp/drill/payments.dump 2>&1 echo "=== INSERT count in sql dump ==="; grep -c "^INSERT INTO" /tmp/drill/payments_data.sql echo "=== sample INSERTs ==="; grep "^INSERT INTO" /tmp/drill/payments_data.sql | head -2
=== custom dump TOC === ; ; Archive created at 2026-07-26 02:02:18 UTC ; dbname: postgres ; TOC Entries: 11 ; Compression: gzip ; Dump Version: 1.16-0 ; Format: CUSTOM ; Integer: 4 bytes ; Offset: 8 bytes ; Dumped from database version: 17.6 ; Dumped by pg_dump version: 18.4 (Debian 18.4-1.pgdg12+1) ; ; ; Selected TOC Entries: ; 288; 1259 25729 TABLE public payments postgres 3732; 0 0 ACL public TABLE payments postgres 3722; 0 25729 TABLE DATA public payments postgres 3572; 2606 25735 CONSTRAINT public payments payments_pkey postgres === INSERT count in sql dump === 80 === sample INSERTs === INSERT INTO public.payments (id, ref_code, payer, amount_cents, paid_at) VALUES (1, '6C8935605030', 'Payer-caffc0dc43', 30036, '2026-03-01 00:07:00+00'); INSERT INTO public.payments (id, ref_code, payer, amount_cents, paid_at) VALUES (2, '300351D74397', 'Payer-b964e8caa9', 101426, '2026-03-01 00:14:00+00');
cd /tmp/drill # Deterministic snapshot of full table content, ordered, for exact comparison later psql "$SUPABASE_DB_URL" -tAc "SELECT id, ref_code, payer, amount_cents, paid_at FROM public.payments ORDER BY id;" > /tmp/drill/pre_incident_rows.txt wc -l /tmp/drill/pre_incident_rows.txt echo "=== md5 of ordered content ===" md5sum /tmp/drill/pre_incident_rows.txt echo "=== aggregate checksum from DB ===" psql "$SUPABASE_DB_URL" -tAc "SELECT md5(string_agg(id||'|'||ref_code||'|'||payer||'|'||amount_cents||'|'||paid_at, ',' ORDER BY id)) FROM public.payments;"
80 /tmp/drill/pre_incident_rows.txt === md5 of ordered content === 9d0ef619eb98c1d6d8d2f882354e481e /tmp/drill/pre_incident_rows.txt === aggregate checksum from DB === 79714b284d34896199c939bdacc0b5d6
psql "$SUPABASE_DB_URL" -c "SELECT public.run_incident();" echo "=== incident_log after ===" psql "$SUPABASE_DB_URL" -c "SELECT * FROM public.incident_log;" echo "=== payments state after incident ===" psql "$SUPABASE_DB_URL" -tAc "SELECT count(*) FROM public.payments;" psql "$SUPABASE_DB_URL" -tAc "SELECT md5(string_agg(id||'|'||ref_code||'|'||payer||'|'||amount_cents||'|'||paid_at, ',' ORDER BY id)) FROM public.payments;"
run_incident ------------------- incident executed (1 row) === incident_log after === id | ran_at | details ----+-------------------------------+-------------------------------------- 1 | 2026-07-26 02:02:50.429407+00 | payments corrupted by incident drill (1 row) === payments state after incident === 54 8ff6cea77adb50d68f02efe08faae7b6
cd /tmp/drill # Generate data-only INSERTs from the custom dump into SQL, wrap in a transaction with TRUNCATE. # Using --data-only from the custom dump ensures we only touch table data, not the incident_log. pg_restore --data-only --table=payments -f /tmp/drill/restore_data.sql /tmp/drill/payments.dump 2>&1 echo "generate exit=$?" grep -c "COPY\|INSERT" /tmp/drill/restore_data.sql head -20 /tmp/drill/restore_data.sql
generate exit=0
1
--
-- PostgreSQL database dump
--
\restrict VFOBAVefsC7aX6lgRfWkjWynZVumJnzsqisXstCYdCKrlltAVbunvJ7MGPYic38
-- Dumped from database version 17.6
-- Dumped by pg_dump version 18.4 (Debian 18.4-1.pgdg12+1)
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET transaction_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
cd /tmp/drill cat > /tmp/drill/do_restore.sql <<'EOF' BEGIN; TRUNCATE TABLE public.payments; \i /tmp/drill/payments_data.sql COMMIT; EOF psql "$SUPABASE_DB_URL" -v ON_ERROR_STOP=1 -f /tmp/drill/do_restore.sql 2>&1
BEGIN TRUNCATE TABLE SET SET SET SET SET SET set_config ------------ (1 row) SET SET SET SET INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 COMMIT
echo "=== payments rowcount ===" psql "$SUPABASE_DB_URL" -tAc "SELECT count(*) FROM public.payments;" echo "=== post-restore checksum ===" psql "$SUPABASE_DB_URL" -tAc "SELECT md5(string_agg(id||'|'||ref_code||'|'||payer||'|'||amount_cents||'|'||paid_at, ',' ORDER BY id)) FROM public.payments;" echo " (pre-incident was: 79714b284d34896199c939bdacc0b5d6)" echo "=== full content diff vs pre-incident snapshot ===" psql "$SUPABASE_DB_URL" -tAc "SELECT id, ref_code, payer, amount_cents, paid_at FROM public.payments ORDER BY id;" > /tmp/drill/post_restore_rows.txt diff /tmp/drill/pre_incident_rows.txt /tmp/drill/post_restore_rows.txt && echo "EXACT MATCH: no differences" echo "=== incident_log still intact ===" psql "$SUPABASE_DB_URL" -c "SELECT * FROM public.incident_log;"
=== payments rowcount === 80 === post-restore checksum === 79714b284d34896199c939bdacc0b5d6 (pre-incident was: 79714b284d34896199c939bdacc0b5d6) === full content diff vs pre-incident snapshot === EXACT MATCH: no differences === incident_log still intact === id | ran_at | details ----+-------------------------------+-------------------------------------- 1 | 2026-07-26 02:02:50.429407+00 | payments corrupted by incident drill (1 row)
psql "$SUPABASE_DB_URL" -tAc "SELECT max(id) FROM public.payments;"
80
10 earlier narration turn(s) are in the raw transcript.
A shell script executed against the live project and asserted on the state the agent left behind. No model judged another model.
Raw transcript · Task definition and verifier · Every attempt