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:
1 parent
2762ad2aba
commit
3c141c942b
4 files changed
+18
-4
No files matched your search
@@ -398,7 +398,9 @@ declare
|
||||
v_definitive boolean;
|
||||
begin
|
||||
perform private.require_service_role();
|
||||
if code is null or not (code = any (private.sheet_worker_codes())) then
|
||||
-- `lease_expired` is the claim's own record of a dead lease, never a worker report.
|
||||
if code is null or not (code = any (private.sheet_worker_codes()))
|
||||
or code = 'verification.worker.lease_expired' then
|
||||
raise exception 'invalid_input' using errcode = 'P0001';
|
||||
end if;
|
||||
select r.* into v_review from public.anatomical_sheet_reviews r where r.id = review_id for update;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
-- nothing), technical failures up to the attempt limit with their progressive
|
||||
-- delay (`not_before`), dead leases.
|
||||
begin;
|
||||
select plan(89);
|
||||
select plan(90);
|
||||
|
||||
insert into auth.users (id, email, email_confirmed_at) values
|
||||
('f0000000-0000-0000-0000-000000000001', 'own@vj.local', now()),
|
||||
@@ -209,6 +209,8 @@ set local role service_role; select pg_temp.worker();
|
||||
select is((select count(*)::int from public.claim_sheet_verifications(1)), 1, 'third round claimed');
|
||||
select throws_ok(format('select public.fail_sheet_verification(%L, %L, %L)', pg_temp.id('r3'), pg_temp.token('r3'), 'verification.worker.oops'),
|
||||
'P0001', 'invalid_input', 'an unknown worker code is refused');
|
||||
select throws_ok(format('select public.fail_sheet_verification(%L, %L, %L)', pg_temp.id('r3'), pg_temp.token('r3'), 'verification.worker.lease_expired'),
|
||||
'P0001', 'invalid_input', 'lease_expired is the claim''s record, never a worker report');
|
||||
select is(public.fail_sheet_verification(pg_temp.id('r3'), gen_random_uuid(), 'verification.worker.timeout'), 'stale', 'a failure with another token is stale');
|
||||
select is(public.fail_sheet_verification(pg_temp.id('r3'), pg_temp.token('r3'), 'verification.worker.timeout'), 'retry', 'a timeout below the limit is retried');
|
||||
select is(pg_temp.status('r3') || '/' || (pg_temp.token('r3') is null)::text, 'verifying/-/verification.worker.timeout/true', 'round stays verifying, code recorded, lease released');
|
||||
|
||||
Reference in new issue
Block a user