test(supabase): V1-2.1 re-runnable sandbox suite, two-session cases, caps timing

F18 and workspaces no longer leave the seed owner changed. Ten two-session
scenarios with a blocking session, seed-owner AR-1 acceptance, shim columns
against the image, save/submit/approve/publish timed at the caps.
This commit is contained in:
bchanot committed 2026-10-28 18:14:10 +01:00
1 parent d05f75da84
commit ef1f4b593f
10 files changed
+930 -65

No files matched your search

@@ -19,7 +19,7 @@ import {
sqlOutcome,
stack,
} from './stack'
import { enrolTotp, verifyTotp } from './mfa'
import { stepUp } from './mfa'
import {
uniqueEmail,
type Account,
@@ -197,18 +197,14 @@ describe('reads and refusals per role', () => {
})
it('stores an oversized correlation header as null and keeps a short token', async () => {
// AR-1 B: the role RPCs need a live aal2 session and a factored target, so
// the seed owner steps up and b enrols a factor before the grant.
const owner = await signIn(
'owner@faunosteo.local',
'LocalDev-only-password-1',
)
const ownerToken = owner.body.access_token as string
const ownerEnrol = await enrolTotp(ownerToken, 'owner device')
const token = (await verifyTotp(ownerToken, ownerEnrol.factor!)).body
.access_token as string
const bEnrol = await enrolTotp(b.token, 'b device')
await verifyTotp(b.token, bEnrol.factor!)
// AR-1 B: the role RPCs need a live aal2 session and a factored target. An
// owner of this test's own (factor first, role last, as §5.7.1 orders it)
// grants the role, so the seed owner is never touched and the suite runs
// again on the same stack.
const owner = await confirmedAccount('ws-owner')
const token = await stepUp(owner.token, 'owner device')
await sql(`select private.assign_platform_role(null, '${owner.id}', 'owner')`)
await stepUp(b.token, 'b device')
const grant = await rpc(
'grant_platform_role',
{ target_user_id: b.id, role: 'support' },
@@ -230,6 +226,7 @@ describe('reads and refusals per role', () => {
await sql(`select string_agg(coalesce(correlation_id, 'NULL'), '|' order by occurred_at, action)
from audit.audit_logs where target_user_id = '${b.id}'`),
).toBe('NULL|req-sandbox-01')
await sql(`delete from auth.users where id = '${owner.id}'`)
})
it('deletes an empty account through GoTrue admin with its workspace', async () => {