@davoodmehraban89 / Factor-easy / commits / 387cd9e
Fork 0

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

ci(phase1a): compare pre-change Supabase baseline separately then apply and test 1A guards

davoodmehraban89 committed Oct 16, 2026 at 13:39 UTC 387cd9ef1d6e4587442328b64680072aa6c3a6ed
1 file changed +27 -7
.github/workflows/phase1a-supabase-parity.yml
+27 -7
@@ -41,17 +41,37 @@ jobs:
41 print('No normalization needed')
42 PY
43 echo 'WARNING: normalization changes disposable CI checkout only, not Git blobs or Production.'
44 - - name: Start isolated Supabase stack and replay checked-in migrations
44 + - name: Isolate 1A migrations until AFTER baseline schema comparison
45 + run: |
46 + mkdir -p /tmp/finora-phase1a-migrations
47 + mv supabase/migrations/20261016100000_phase1a_server_journal_invariants.sql /tmp/finora-phase1a-migrations/
48 + mv supabase/migrations/20261016100500_phase1a_optimistic_version_sync.sql /tmp/finora-phase1a-migrations/
49 + - name: Start isolated Supabase stack and replay baseline migrations
50 id: local_stack
51 run: supabase start
47 - - name: Red-first financial bypass regression (isolated auth/RLS)
48 - if: ${{ steps.local_stack.outcome == 'success' }}
49 - continue-on-error: true # Until server guard migration lands, failures are REQUIRED red evidence.
50 - run: node scripts/phase1a-adversarial-red.mjs
51 - - name: Compare local catalog to read-only Production fingerprint fixture
52 + - name: Compare BASELINE catalog to read-only Production schema fingerprints
53 + id: baseline_parity
54 run: |
55 PGPASSWORD=postgres psql -h 127.0.0.1 -p 54322 -U postgres -d postgres -X -qAt -v ON_ERROR_STOP=1 -f supabase/tests/phase1a_schema_fingerprint.sql > phase1a-local-schema.json
54 - node scripts/phase1a-schema-diff.mjs supabase/tests/fixtures/phase1a_production_schema_fingerprints_20261016.json phase1a-local-schema.json
56 + if node scripts/phase1a-schema-diff.mjs supabase/tests/fixtures/phase1a_production_schema_fingerprints_20261016.json phase1a-local-schema.json; then
57 + echo 'matched=true' >> "$GITHUB_OUTPUT"
58 + else
59 + echo 'matched=false' >> "$GITHUB_OUTPUT"
60 + echo '::warning::Unreconciled baseline schema function-definition differences. Finance assertions will still run.'
61 + fi
62 + - name: Apply 1A-only migrations on disposable Supabase CLI database
63 + run: |
64 + PGPASSWORD=postgres psql -h 127.0.0.1 -p 54322 -U postgres -d postgres -X -v ON_ERROR_STOP=1 -f /tmp/finora-phase1a-migrations/20261016100000_phase1a_server_journal_invariants.sql
65 + PGPASSWORD=postgres psql -h 127.0.0.1 -p 54322 -U postgres -d postgres -X -v ON_ERROR_STOP=1 -f /tmp/finora-phase1a-migrations/20261016100500_phase1a_optimistic_version_sync.sql
66 + - name: Run 1A green-after-red authenticated adversarial tests
67 + run: node scripts/phase1a-adversarial-red.mjs
68 + - name: Validate client JavaScript syntax
69 + run: node --check js/sync.js
70 + - name: Require exact baseline schema parity for 1A acceptance
71 + if: ${{ steps.baseline_parity.outputs.matched != 'true' }}
72 + run: |
73 + echo '::error::Baseline schema fingerprints still differ; Phase 1A acceptance blocked. See artifact.'
74 + exit 1
75 - name: Upload schema fingerprint diff (no private row data)
76 if: always()
77 uses: actions/upload-artifact@v4