fix(supabase): targeted review LOWs on retry and sandbox isolation

fail_sheet_verification refuses lease_expired (the claim's record, never a
worker report); the sandbox state dir guard resolves the repository path; the
avatar suite also refuses keys not issued by the sandbox. pgTAP 021: 90.
This commit is contained in:
bchanot committed 2026-11-01 23:13:42 +01:00
1 parent 2762ad2aba
commit 3c141c942b
4 files changed
+18 -4

No files matched your search

@@ -33,7 +33,15 @@ const DB_CONTAINER = process.env.AVATAR_E2E_DB_CONTAINER
/** The only target accepted: the gateway and database of `pnpm db:sandbox avatar-e2e`. */
const SANDBOX_URL = 'http://127.0.0.1:57800'
const SANDBOX_DB = 'faunosteo_dbsandbox_db'
if (URL_ !== SANDBOX_URL || DB_CONTAINER !== SANDBOX_DB || !ANON || !SERVICE)
/** The sandbox signs its keys with issuer `db-sandbox` (scripts/db-sandbox.sh); no other stack's key does. */
const sandboxKey = (key: string | undefined): boolean => {
try {
return JSON.parse(Buffer.from(key?.split('.')[1] ?? '', 'base64url').toString()).iss === 'db-sandbox'
} catch {
return false
}
}
if (URL_ !== SANDBOX_URL || DB_CONTAINER !== SANDBOX_DB || !sandboxKey(ANON) || !sandboxKey(SERVICE))
throw new Error('avatar e2e: run it through pnpm e2e:avatar, on the sandbox stack only')
/** Per run, kept in memory only: both accounts are deleted after the suite. */
const PASSWORD = randomBytes(18).toString('base64url')