Fix reversal business dates in Accounting - #31
Conversation
✅ Deploy Preview for bbtpalaceelite ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a102aacd6b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| select set_config( | ||
| 'request.jwt.claim.sub', | ||
| (select user_id::text from public.unit_users where role = 'admin' and revoked_at is null limit 1), | ||
| true |
There was a problem hiding this comment.
Create an admin fixture before invoking authenticated RPCs
On a fresh database built from these migrations, no Auth user or unit_users row is seeded, and the earlier pgTAP suites create their users inside transactions that are rolled back. This subquery therefore returns NULL, leaving auth.uid() unset, so approve_benefit_transaction later aborts with Authentication is required; the Aug. 7/Aug. 8 assertions also depend on hosted ledger rows that no migration creates. As a result, supabase db test cannot complete on a clean checkout; create the admin and historical transaction/reversal fixtures within this test transaction.
Useful? React with 👍 / 👎.
Summary
America/Chicagofor the current membership)current_dateRoot cause
Supabase/Postgres runs in UTC. The production reversal was created/approved shortly after 00:00 UTC on Aug 9, while it was still Aug 8 in Missouri. The reversal row therefore received
effective_date = 2026-08-09, and the historical Accounting function also castapproved_atto a UTC date. The current grant/unit balances were correct, but the Aug 8 historical Accounting snapshot excluded the reversal.Deployment status
20260809001548_fix_reversal_business_dateseffective_date = 2026-08-09Validation
-1and reversal is approved+1ledger_delta = 0and full allocated position-1/ ~1 remaining0/ ~2 remainingSecurity
SECURITY DEFINERexposure warnings and leaked-password protection being disabled; no new anonymous execute grant was introduced by this fixSafety