set -e
command -v psql || true
command -v curl || true
printf 'URL=%s\nREF=%s\nDBURL_SET=%s\n' "${SUPABASE_URL:+set}" "${SUPABASE_PROJECT_REF:+set}" "${SUPABASE_DB_URL:+set}"/usr/bin/psql /usr/bin/curl URL=set REF=set DBURL_SET=set
env | grep '^SUPABASE_' | sed 's/=.*$/=<redacted>/' | sort
SUPABASE_ANON_KEY=<redacted> SUPABASE_DB_PASSWORD=<redacted> SUPABASE_DB_URL=<redacted> SUPABASE_PROJECT_REF=<redacted> SUPABASE_SERVICE_ROLE_KEY=<redacted> SUPABASE_URL=<redacted>
set -euo pipefail
psql "$SUPABASE_DB_URL" -v ON_ERROR_STOP=1 <<'SQL'
begin;
create table if not exists public.products (
sku text primary key,
name text not null,
price_cents integer not null,
stock integer not null default 0
);
truncate table public.products;
insert into public.products (sku, name, price_cents, stock) values
('CARI-001', 'Anvil S', 1999, 12),
('CARI-002', 'Anvil M', 2999, 7),
('CARI-003', 'Anvil L', 4999, 3),
('CARI-004', 'Rope 30m', 1250, 40),
('CARI-005', 'Pulley', 780, 0);
grant usage on schema public to anon;
grant select on table public.products to anon;
alter table public.products enable row level security;
drop policy if exists "Public catalog read access" on public.products;
create policy "Public catalog read access"
on public.products
for select
to anon
using (true);
commit;
SQL
response_file=$(mktemp)
status=$(curl -sS -o "$response_file" -w '%{http_code}' \
-H "apikey: $SUPABASE_ANON_KEY" \
"$SUPABASE_URL/rest/v1/products?select=sku,name,price_cents,stock&order=sku.asc")
printf 'HTTP %s\n' "$status"
cat "$response_file"
printf '\n'
[ "$status" = 200 ]
python3 - "$response_file" <<'PY'
import json, sys
with open(sys.argv[1]) as f:
got = json.load(f)
expected = [
{"sku":"CARI-001","name":"Anvil S","price_cents":1999,"stock":12},
{"sku":"CARI-002","name":"Anvil M","price_cents":2999,"stock":7},
{"sku":"CARI-003","name":"Anvil L","price_cents":4999,"stock":3},
{"sku":"CARI-004","name":"Rope 30m","price_cents":1250,"stock":40},
{"sku":"CARI-005","name":"Pulley","price_cents":780,"stock":0},
]
assert got == expected, (got, expected)
print('Verified exact five-row anon REST response.')
PY
rm -f "$response_file"BEGIN
CREATE TABLE
TRUNCATE TABLE
INSERT 0 5
GRANT
GRANT
ALTER TABLE
DROP POLICY
CREATE POLICY
COMMIT
HTTP 404
{"code":"PGRST205","details":null,"hint":null,"message":"Could not find the table 'public.products' in the schema cache"}
NOTICE: policy "Public catalog read access" for relation "public.products" does not exist, skipping
set -euo pipefail
psql "$SUPABASE_DB_URL" -v ON_ERROR_STOP=1 -c "NOTIFY pgrst, 'reload schema';"
response_file=$(mktemp)
trap 'rm -f "$response_file"' EXIT
for attempt in $(seq 1 20); do
status=$(curl -sS -o "$response_file" -w '%{http_code}' \
-H "apikey: $SUPABASE_ANON_KEY" \
"$SUPABASE_URL/rest/v1/products?select=sku,name,price_cents,stock&order=sku.asc")
if [ "$status" = 200 ]; then break; fi
printf 'Attempt %s: HTTP %s; waiting for schema cache...\n' "$attempt" "$status"
sleep 2
done
printf 'HTTP %s\n' "$status"
cat "$response_file"; printf '\n'
[ "$status" = 200 ]
python3 - "$response_file" <<'PY'
import json, sys
with open(sys.argv[1]) as f: got = json.load(f)
expected = [
{"sku":"CARI-001","name":"Anvil S","price_cents":1999,"stock":12},
{"sku":"CARI-002","name":"Anvil M","price_cents":2999,"stock":7},
{"sku":"CARI-003","name":"Anvil L","price_cents":4999,"stock":3},
{"sku":"CARI-004","name":"Rope 30m","price_cents":1250,"stock":40},
{"sku":"CARI-005","name":"Pulley","price_cents":780,"stock":0},
]
assert got == expected, f"Unexpected response: {got!r}"
print("Verified exact five-row anon REST response.")
PYNOTIFY
HTTP 200
[{"sku":"CARI-001","name":"Anvil S","price_cents":1999,"stock":12},
{"sku":"CARI-002","name":"Anvil M","price_cents":2999,"stock":7},
{"sku":"CARI-003","name":"Anvil L","price_cents":4999,"stock":3},
{"sku":"CARI-004","name":"Rope 30m","price_cents":1250,"stock":40},
{"sku":"CARI-005","name":"Pulley","price_cents":780,"stock":0}]
Verified exact five-row anon REST response.
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