@davoodmehraban89 / Factor-easy-2 Mirror · read-only / commits / 8ff8357
Fork 0

سامانه صدور فاکتور و حسابداری

Mirrored from https://github.com/davoodmehraban89/Factor-easy.git

Synced Dec 3, 22:00 UTC

test(phase1a): audit protected journal counters as local DBA only

davoodmehraban89 committed Oct 17, 2026 at 07:05 UTC 8ff8357e12f772188e2f7c818778ae2447bbcdc6
2 files changed +6 -1
PROJECT_STATE.md
+3
@@ -90,3 +90,6 @@
90 ### 2026-10-17 — Stage 1 seeded 1000 generation completed, verification timed out (PENDING CI)
91 - Exact SHA c198a1b5c71e10fb1a3558d142f49516d8a5e23f, run 38978629359: 20 steps PASS and seeded progress reached event 1000 (23:09:27Z); job cancelled at 23:31:41Z at 35-minute timeout without validation PASS. Counters/races/rollback/security tests skipped; no Stage1 completion claim.
92 - Changed only disposable seeded SQL test: all 1000 authenticated write operations and deterministic random event definitions retained. Deferred constraints and global read-only invariant checks now execute after RESET ROLE to local Postgres to avoid pathological RLS overhead and ensure all tenant rows are visible during global integrity audit. Added explicit checkpoints for counts, per-voucher and per-org balances, cross-org leaks. No Production DDL/DML, no main merge, no Stage2/3.
93 +
94 +### 2026-10-17 — Stage 1 seeded full PASS, counter test private-grant fix (PENDING NEW CI)
95 +- Exact SHA 2e708fdec5bc29d3b5530b59035d0da82702b4a6, run 38998387737: 1000 seeded events and 238 full/114 partial reversals, voucher balance, both organization balances and cross-org leak assertion PASS. Two-year counter test line 65 failed only when authenticated test role tried SELECT of deliberately private counters. Kept ACL unchanged; moves private table read-only assertions after RESET ROLE to disposable PostgreSQL DBA while all posting operations remain authenticated RPC. CI rerun pending, no Production writes or Stage2/3 work.
supabase/tests/phase1a_stage1_counter_two_fiscal.sql
+3 -1
@@ -45,6 +45,9 @@ SELECT public.finora_journal_post(current_setting('phase1a_counter.org')::uuid,'
45 ROLLBACK TO SAVEPOINT rollback_number;
46 SELECT public.finora_journal_post(current_setting('phase1a_counter.org')::uuid,'NEW_FIRST_41',1);
47 SELECT public.finora_journal_post(current_setting('phase1a_counter.org')::uuid,'NEW_SECOND_12',1);
48 +-- Authenticated RPC posts above; local DBA only reads private counters
49 +-- for test assertions. Do not grant authenticated access to private tables.
50 +RESET ROLE;
51 DO $test$
52 DECLARE v_first text;v_second text;counter_first bigint;counter_second bigint;
53 BEGIN
@@ -63,5 +66,4 @@ BEGIN
66 v_first,v_second,counter_first,counter_second;END IF;
67 RAISE NOTICE 'FINORA_STAGE1_COUNTER_PASS years=2 first_legacy=40 next=41 second_legacy=11 next=12 rollback_consumed=0';
68 END $test$;
66 -RESET ROLE;
69 ROLLBACK;