env | grep -i supabase | sed -E 's/(PASSWORD=).*/\1<redacted>/; s/(SERVICE_ROLE_KEY=).*/\1<redacted>/; s/(ANON_KEY=).*/\1<redacted>/' ; echo "---"; which psql curl jq || true; psql --version 2>/dev/null || echo "no psql"
SUPABASE_DB_PASSWORD=<redacted> SUPABASE_DB_URL=<redacted:SUPABASE_DB_URL> SUPABASE_URL=https://<ref>.supabase.co SUPABASE_SERVICE_ROLE_KEY=<redacted> SUPABASE_PROJECT_REF=<ref> SUPABASE_ANON_KEY=<redacted> --- /usr/bin/psql /usr/bin/curl /usr/bin/jq psql (PostgreSQL) 18.4 (Debian 18.4-1.pgdg12+1)
psql "$SUPABASE_DB_URL" -v ON_ERROR_STOP=1 -c "SELECT version();" -c "SELECT tablename FROM pg_tables WHERE schemaname='public' ORDER BY 1;"
version ------------------------------------------------------------------------------ PostgreSQL 17.6 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 15.2.0, 64-bit (1 row) tablename ----------- (0 rows)
psql "$SUPABASE_DB_URL" -v ON_ERROR_STOP=1 <<'SQL' BEGIN; CREATE TABLE public.authors ( id uuid PRIMARY KEY DEFAULT gen_random_uuid(), name text NOT NULL, email text NOT NULL UNIQUE ); CREATE TABLE public.courses ( id uuid PRIMARY KEY DEFAULT gen_random_uuid(), author_id uuid NOT NULL REFERENCES public.authors(id), title text NOT NULL, price_cents integer NOT NULL CHECK (price_cents >= 0), published boolean NOT NULL DEFAULT false, created_at timestamptz NOT NULL DEFAULT now() ); CREATE TABLE public.enrollments ( id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY, course_id uuid NOT NULL REFERENCES public.courses(id) ON DELETE CASCADE, student_email text NOT NULL, enrolled_at timestamptz NOT NULL DEFAULT now(), UNIQUE (course_id, student_email) ); CREATE INDEX courses_author_id_idx ON public.courses (author_id); CREATE INDEX enrollments_student_email_idx ON public.enrollments (student_email); -- Grants so the API roles can use the tables GRANT SELECT ON public.authors, public.courses, public.enrollments TO anon; GRANT SELECT, INSERT, UPDATE, DELETE ON public.authors, public.courses, public.enrollments TO authenticated, service_role; GRANT USAGE, SELECT ON SEQUENCE public.enrollments_id_seq TO authenticated, service_role; COMMIT; -- Ask PostgREST to reload its schema cache NOTIFY pgrst, 'reload schema'; SQL
BEGIN CREATE TABLE CREATE TABLE CREATE TABLE CREATE INDEX CREATE INDEX GRANT GRANT GRANT COMMIT NOTIFY
psql "$SUPABASE_DB_URL" -v ON_ERROR_STOP=1 -c "\d public.authors" -c "\d public.courses" -c "\d public.enrollments" -c "SELECT tablename, indexname, indexdef FROM pg_indexes WHERE schemaname='public' ORDER BY 1,2;"
Table "public.authors"
Column | Type | Collation | Nullable | Default
--------+------+-----------+----------+-------------------
id | uuid | | not null | gen_random_uuid()
name | text | | not null |
email | text | | not null |
Indexes:
"authors_pkey" PRIMARY KEY, btree (id)
"authors_email_key" UNIQUE CONSTRAINT, btree (email)
Referenced by:
TABLE "courses" CONSTRAINT "courses_author_id_fkey" FOREIGN KEY (author_id) REFERENCES authors(id)
Table "public.courses"
Column | Type | Collation | Nullable | Default
-------------+--------------------------+-----------+----------+-------------------
id | uuid | | not null | gen_random_uuid()
author_id | uuid | | not null |
title | text | | not null |
price_cents | integer | | not null |
published | boolean | | not null | false
created_at | timestamp with time zone | | not null | now()
Indexes:
"courses_pkey" PRIMARY KEY, btree (id)
"courses_author_id_idx" btree (author_id)
Check constraints:
"courses_price_cents_check" CHECK (price_cents >= 0)
Foreign-key constraints:
"courses_author_id_fkey" FOREIGN KEY (author_id) REFERENCES authors(id)
Referenced by:
TABLE "enrollments" CONSTRAINT "enrollments_course_id_fkey" FOREIGN KEY (course_id) REFERENCES courses(id) ON DELETE CASCADE
Table "public.enrollments"
Column | Type | Collation | Nullable | Default
---------------+--------------------------+-----------+----------+------------------------------
id | bigint | | not null | generated always as identity
course_id | uuid | | not null |
student_email | text | | not null |
enrolled_at | timestamp with time zone | | not null | now()
Indexes:
"enrollments_pkey" PRIMARY KEY, btree (id)
"enrollments_course_id_student_email_key" UNIQUE CONSTRAINT, btree (course_id, student_email)
"enrollments_student_email_idx" btree (student_email)
Foreign-key constraints:
"enrollments_course_id_fkey" FOREIGN KEY (course_id) REFERENCES courses(id) ON DELETE CASCADE
tablename | indexname | indexdef
-------------+-----------------------------------------+--------------------------------------------------------------------------------------------------------------------------
authors | authors_email_key | CREATE UNIQUE INDEX authors_email_key ON public.authors USING btree (email)
authors | authors_pkey | CREATE UNIQUE INDEX authors_pkey ON public.authors USING btree (id)
courses | courses_author_id_idx | CREATE INDEX courses_author_id_idx ON public.courses USING btree (author_id)
courses | courses_pkey | CREATE UNIQUE INDEX courses_pkey ON public.courses USING btree (id)
enrollments | enrollments_course_id_student_email_key | CREATE UNIQUE INDEX enrollments_course_id_student_email_key ON public.enrollments USING btree (course_id, student_email)
enrollments | enrollments_pkey | CREATE UNIQUE INDEX enrollments_pkey ON public.enrollments USING btree (id)
enrollments | enrollments_student_email_idx | CREATE INDEX enrollments_student_email_idx ON public.enrollments USING btree (student_email)
(7 rows)
sleep 2
for t in authors courses enrollments; do
echo "=== /rest/v1/$t ==="
curl -sS -o /tmp/resp_$t.json -w "HTTP %{http_code}\n" \
"$SUPABASE_URL/rest/v1/$t?select=*" \
-H "apikey: $SUPABASE_ANON_KEY" \
-H "Authorization: Bearer $SUPABASE_ANON_KEY"
cat /tmp/resp_$t.json; echo
done=== /rest/v1/authors === HTTP 200 [] === /rest/v1/courses === HTTP 200 [] === /rest/v1/enrollments === HTTP 200 []
psql "$SUPABASE_DB_URL" -v ON_ERROR_STOP=1 <<'SQL'
-- Functional smoke test of constraints
BEGIN;
INSERT INTO public.authors (name, email) VALUES ('Test Author', 'test@example.com') RETURNING id \g /tmp/a.txt
\set author_id `awk 'NR==3{print $1}' /tmp/a.txt`
INSERT INTO public.courses (author_id, title, price_cents) VALUES (:'author_id', 'Test Course', 1000);
INSERT INTO public.enrollments (course_id, student_email)
SELECT id, 's@example.com' FROM public.courses WHERE title='Test Course';
-- negative price must fail
SAVEPOINT sp1;
INSERT INTO public.courses (author_id, title, price_cents) VALUES (:'author_id', 'Bad', -5);
ROLLBACK TO SAVEPOINT sp1;
-- duplicate enrollment must fail
INSERT INTO public.enrollments (course_id, student_email)
SELECT id, 's@example.com' FROM public.courses WHERE title='Test Course';
ROLLBACK;
SQL
echo "exit=$? (nonzero expected because of intentional constraint violations above)"BEGIN INSERT 0 1 INSERT 0 1 INSERT 0 1 SAVEPOINT exit=3 (nonzero expected because of intentional constraint violations above)
ERROR: new row for relation "courses" violates check constraint "courses_price_cents_check" DETAIL: Failing row contains (4539acde-0a54-4339-bfcf-fd49d7edb2b2, 5a289a6e-09e4-4025-bf71-561c93120c99, Bad, -5, f, 2026-07-24 05:03:34.145656+00).
psql "$SUPABASE_DB_URL" -v ON_ERROR_STOP=1 -c "SELECT (SELECT count(*) FROM public.authors) AS authors, (SELECT count(*) FROM public.courses) AS courses, (SELECT count(*) FROM public.enrollments) AS enrollments;"
echo "--- API check ---"
curl -sS -o /dev/null -w "GET /rest/v1/courses -> HTTP %{http_code}\n" \
"$SUPABASE_URL/rest/v1/courses?select=*" \
-H "apikey: $SUPABASE_ANON_KEY" \
-H "Authorization: Bearer $SUPABASE_ANON_KEY" authors | courses | enrollments
---------+---------+-------------
0 | 0 | 0
(1 row)
--- API check ---
GET /rest/v1/courses -> HTTP 200
7 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