سامانه صدور فاکتور و حسابداری
ci(staging): rehearse zero-cost isolated Stage1 rollback with data/version preservation
davoodmehraban89 committed
Oct 22, 2026 at 23:24 UTC
b9110148ad3692e8e29cf549c48271ae7fa57877
1 file changed
+49
.github/workflows/stage22-free-ephemeral-staging.yml
+49
@@ -209,3 +209,52 @@ jobs:
209
echo 'Distinct from harness and real-stack browser tests, which run in other jobs.'
210
echo 'FAILURE is not acceptance; read step and raw log.'
211
} >> "$GITHUB_STEP_SUMMARY"
212
+
213
+ stage1-rollback-rehearsal:
214
+ name: Stage 1 local UP-DOWN-UP preserves versions/data (NOT Production rollback)
215
+ runs-on: ubuntu-latest
216
+ timeout-minutes: 40
217
+ steps:
218
+ - uses: actions/checkout@v4
219
+ with:
220
+ persist-credentials: false
221
+ - name: Reject all remote targets before any test connection
222
+ run: node scripts/stage21-target-preflight.mjs green
223
+ - uses: supabase/setup-cli@v1
224
+ with:
225
+ version: 2.121.0
226
+ - name: Prepare separate local-only baseline and Stage 1 migrations
227
+ shell: bash
228
+ run: |
229
+ set -euo pipefail
230
+ test -z "${SUPABASE_ACCESS_TOKEN:-}" || exit 1
231
+ test -z "${SUPABASE_DB_PASSWORD:-}" || exit 1
232
+ test -z "${SUPABASE_SERVICE_ROLE_KEY:-}" || exit 1
233
+ supabase init --force
234
+ python3 - <<'PY'
235
+ from pathlib import Path
236
+ for p in Path('supabase/migrations').glob('*.sql'):
237
+ b=p.read_bytes()
238
+ if b.endswith(b'\\n'): p.write_bytes(b[:-2]+b'\n')
239
+ PY
240
+ mkdir -p /tmp/finora-phase1a-migrations
241
+ mv supabase/migrations/2026101610{0000,0500,1000,1500,2000,2500,3000,3100,3500}_*.sql /tmp/finora-phase1a-migrations/
242
+ mv supabase/migrations/20261016104000_stage22_manual_guard_owner_mode.sql /tmp/stage22-guard-not-applied.sql
243
+ supabase start -x inbucket
244
+ for migration in /tmp/finora-phase1a-migrations/*.sql; do
245
+ PGPASSWORD=postgres psql -h 127.0.0.1 -p 54322 -U postgres -d postgres -X -v ON_ERROR_STOP=1 -f "$migration" >/dev/null
246
+ done
247
+ - name: Rehearse 1A rollback and forward without data or CAS loss
248
+ shell: bash
249
+ run: |
250
+ set -euo pipefail
251
+ PGPASSWORD=postgres psql -h 127.0.0.1 -p 54322 -U postgres -d postgres -X -v ON_ERROR_STOP=1 -f supabase/tests/phase1a_rollback_up_down_up.sql 2>&1 | tee stage1-local-rollback.log
252
+ grep -q 'FINORA_1A_ROLLBACK_UP_DOWN_UP_PASS' stage1-local-rollback.log
253
+ - name: Label reversible synthetic rehearsal, never Production recovery approval
254
+ if: always()
255
+ run: |
256
+ {
257
+ echo '### Stage 1 rollback test — ephemeral local PostgreSQL ONLY'
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"