Intelligence, Advanced Charting & Trading Platform
test(outbox): fail pre-consumption egress then allow only after one-send permit
davoodmehraban89 committed
Oct 23, 2026 at 10:53 UTC
eeaa641426d624ea8561b14900badbdab523e13f
1 file changed
+6
-2
db/tests/alert_runtime_invariants.sql
+6
-2
@@ -144,9 +144,9 @@ BEGIN
144
IF result.event_key <> 'consented-alert' OR result.claim_token IS NULL THEN
145
RAISE EXCEPTION 'consented claimant did not receive authorized pending event';
146
END IF;
147
- IF NOT public.alert_notification_egress_allowed(
147
+ IF public.alert_notification_egress_allowed(
148
result.outbox_id, result.claim_token, v_recipient,'BALE', t+interval '5 minutes 1 second') THEN
149
- RAISE EXCEPTION 'valid leased and consenting recipient denied at egress';
149
+ RAISE EXCEPTION 'unconsumed send permit bypassed egress gate';
150
END IF;
151
IF public.alert_notification_begin_egress(
152
result.outbox_id, result.claim_token, gen_random_uuid(),'BALE',
@@ -166,6 +166,10 @@ BEGIN
166
result.outbox_id, result.claim_token, v_recipient,'BALE', t+interval '5 minutes 2 seconds') THEN
167
RAISE EXCEPTION 'repeated send permit enabled duplicate outbound message';
168
END IF;
169
+ IF NOT public.alert_notification_egress_allowed(
170
+ result.outbox_id, result.claim_token, v_recipient,'BALE', t+interval '5 minutes 2 seconds') THEN
171
+ RAISE EXCEPTION 'single-use permit did not authorize legitimate egress';
172
+ END IF;
173
IF public.alert_notification_egress_allowed(
174
result.outbox_id, gen_random_uuid(), v_recipient,'BALE', t+interval '5 minutes 1 second') THEN
175
RAISE EXCEPTION 'wrong lease token authorized message egress';