سامانه صدور فاکتور و حسابداری
Mirrored from https://github.com/davoodmehraban89/Factor-easy.git
Synced Dec 3, 20:45 UTC
ci(stage3): compare real form output to local PostgreSQL with 12 negative monetary cases
davoodmehraban89 committed
Oct 23, 2026 at 02:46 UTC
a08a98ff5b4b1c5b1100c9e9ac6c8bc494f0bec1
1 file changed
+60
.github/workflows/stage3-commercial-local-regression.yml
+60
@@ -258,3 +258,63 @@ jobs:
258
echo 'No Production connection, no real records, no remote Supabase branch, no artifacts.'
259
echo 'Successful reversible synthetic UP/DOWN/UP does NOT prove a Production rollback.'
260
} >> "$GITHUB_STEP_SUMMARY"
261
+
262
+ stage3-ui-sql-v1:
263
+ name: Real UI sale-purchase payload vs independent SQL-v1
264
+ runs-on: ubuntu-latest
265
+ timeout-minutes: 40
266
+ steps:
267
+ - uses: actions/checkout@v4
268
+ with:
269
+ persist-credentials: false
270
+ - name: Fail closed on all remote Supabase targets
271
+ run: node scripts/stage21-target-preflight.mjs green
272
+ - uses: supabase/setup-cli@v1
273
+ with:
274
+ version: 2.121.0
275
+ - name: Build isolated unlinked PostgreSQL with Stage1 source contract
276
+ shell: bash
277
+ run: |
278
+ set -euo pipefail
279
+ test -z "\${SUPABASE_ACCESS_TOKEN:-}" || exit 1
280
+ test -z "\${SUPABASE_DB_PASSWORD:-}" || exit 1
281
+ test -z "\${SUPABASE_SERVICE_ROLE_KEY:-}" || exit 1
282
+ supabase init --force
283
+ python3 - <<'PY'
284
+ from pathlib import Path
285
+ for p in Path('supabase/migrations').glob('*.sql'):
286
+ data=p.read_bytes()
287
+ if data.endswith(b'\\n'): p.write_bytes(data[:-2]+b'\n')
288
+ PY
289
+ mkdir -p /tmp/finora-stage3-ui-contract-migrations
290
+ mv supabase/migrations/2026101610{0000,0500,1000,1500,2000,2500,3000,3100,3500,4000}_*.sql /tmp/finora-stage3-ui-contract-migrations/
291
+ supabase start -x inbucket
292
+ for migration in /tmp/finora-stage3-ui-contract-migrations/*.sql; do
293
+ PGPASSWORD=postgres psql -h 127.0.0.1 -p 54322 -U postgres -d postgres -X -v ON_ERROR_STOP=1 -f "$migration" >/dev/null
294
+ done
295
+ - name: Install pinned Chromium Playwright
296
+ run: |
297
+ npm install --no-save @playwright/test@1.55.0
298
+ npx playwright install --with-deps chromium
299
+ - name: Produce source JSON from actual synthetic sale and purchase forms
300
+ shell: bash
301
+ run: |
302
+ set -euo pipefail
303
+ python3 -m http.server 4173 >/tmp/finora-stage3-ui.log 2>&1 &
304
+ npx playwright test scripts/accounting-document-workflow.spec.js --grep 'Stage3 new sale and purchase UI' --workers=1 --reporter=line
305
+ test -s stage3-ui-fixtures.json
306
+ - name: Independently validate actual UI JSON against PostgreSQL SQL-v1
307
+ shell: bash
308
+ run: |
309
+ set -euo pipefail
310
+ node scripts/stage3-ui-sql-v1-check.mjs stage3-ui-fixtures.json 2>&1 | tee stage3-ui-sql.log
311
+ grep -q 'FINORA_STAGE3_UI_SQL_V1_PASS' stage3-ui-sql.log
312
+ - name: Record stage3 scope: local synthetic SQL only
313
+ if: always()
314
+ run: |
315
+ {
316
+ echo '### Stage3 actual UI to real PostgreSQL contract'
317
+ echo 'New form payloads only; local SQL-v1 evaluated on isolated unlinked Supabase/Postgres.'
318
+ echo 'No private user data, no Production Auth, no hosted Staging and NO deployment.'
319
+ echo 'Failing source contract is a genuine Stage3 BLOCKER, never waive it.'
320
+ } >> "$GITHUB_STEP_SUMMARY"