fix: accept final recorded refund audits

This commit is contained in:
jwinterm
2026-07-22 12:59:36 -04:00
parent 91f139eeaa
commit 05aa436ac5
2 changed files with 4 additions and 2 deletions
+2 -2
View File
@@ -11,7 +11,7 @@ FROM schema_migrations;
WITH audit(category, row_count, atomic_amount) AS (
SELECT 'payout_nonterminal', COUNT(*), COALESCE(SUM(amount), 0)::numeric
FROM payouts
WHERE status IS DISTINCT FROM 'completed'
WHERE status IS NULL OR status NOT IN ('recorded', 'completed')
UNION ALL
SELECT 'payout_completed_missing_tx', COUNT(*), COALESCE(SUM(amount), 0)::numeric
FROM payouts
@@ -19,7 +19,7 @@ WITH audit(category, row_count, atomic_amount) AS (
UNION ALL
SELECT 'refund_unsettled', COUNT(*), COALESCE(SUM(amount), 0)::numeric
FROM payment_refunds
WHERE status IS DISTINCT FROM 'completed'
WHERE status IS NULL OR status NOT IN ('recorded', 'completed')
UNION ALL
SELECT 'solo_orphan', COUNT(*), 0::numeric
FROM games
+2
View File
@@ -17,6 +17,8 @@ describe('deployment financial-audit contract', () => {
expect(audit).toContain("payouts WHERE status IS DISTINCT FROM 'completed'");
expect(audit).toContain("games WHERE status IS NULL OR status NOT IN ('won', 'lost', 'expired')");
expect(audit).toContain("MAX(filename) = '042_immutable_financial_event_snapshots.sql'");
expect(audit.match(/status IS NULL OR status NOT IN \('recorded', 'completed'\)/g))
.toHaveLength(2);
expect(audit).toContain('COUNT(*) = 42');
});
});