سامانه صدور فاکتور و حسابداری
Tests: disambiguate Wave 4b replay assertion
davoodmehraban89 committed
Oct 2, 2026 at 10:22 UTC
7972bf2664672853fd1dc6cf50fafa6fc977275c
1 file changed
+3
-3
supabase/tests/request_wave4b_scheduler_outbox_delivery.sql
+3
-3
@@ -85,9 +85,9 @@ select set_config('request.jwt.claim.capabilities','read,configure,create,edit,a
85
select public.request_replay_dead_letter('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa',(select v from w4b_ids where k='dead_outbox'),'wave4b-replay-dead-0001','operator reviewed destination');
86
select public.request_replay_dead_letter('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa',(select v from w4b_ids where k='dead_outbox'),'wave4b-replay-dead-0001','operator reviewed destination');
87
reset role;
88
-do $$ declare k text;begin
89
- select destination_command_key into k from private.request_outbox where id=(select v from w4b_ids where k='dead_outbox');
88
+do $ declare v_destination_key text;begin
89
+ select o.destination_command_key into v_destination_key from private.request_outbox o where o.id=(select x.v from w4b_ids x where x.k='dead_outbox');
90
if not exists(select 1 from private.request_outbox where id=(select v from w4b_ids where k='dead_outbox') and status='pending' and attempts=0 and replay_count=1 and last_replay_key='wave4b-replay-dead-0001') then raise exception 'dead-letter replay state mismatch';end if;
91
- if k<>'request-outbox:'||(select v from w4b_ids where k='dead_outbox')::text then raise exception 'destination command key changed across dead-letter replay';end if;
91
+ if v_destination_key<>'request-outbox:'||(select x.v from w4b_ids x where x.k='dead_outbox')::text then raise exception 'destination command key changed across dead-letter replay';end if;
92
if (select count(*) from public.organization_audit where action='request_outbox_replayed' and entity_id=(select v from w4b_ids where k='dead_outbox')::text)<>1 then raise exception 'replay idempotency duplicated audit evidence';end if;
93
end $$;