@davoodmehraban89 / Factor-easy / commits / f50cfe6
Fork 0

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

test: add D1 transition evidence contract

davoodmehraban89 committed Oct 1, 2026 at 22:14 UTC f50cfe63fee95df896f2c544a3d5b17528206eaf
1 file changed +9
scripts/request-workflow-d1-transition-check.mjs new
+9
@@ -0,0 +1,9 @@
1 +import fs from 'node:fs';
2 +import assert from 'node:assert/strict';
3 +const p='supabase/migrations/20261001205500_request_workflow_d1_transition_evidence.sql';
4 +assert.ok(fs.existsSync(p),'D1 transition evidence hardening migration must exist');
5 +const sql=fs.readFileSync(p,'utf8');
6 +for(const token of ['v_from','for update','p_expected_revision','stale revision','request_instance_events','from_status','idempotency_key']) assert.ok(sql.toLowerCase().includes(token.toLowerCase()),`missing transition evidence token: ${token}`);
7 +assert.match(sql,/v_from\s*:=\s*v_row\.status/i,'transition must snapshot the pre-transition status');
8 +assert.match(sql,/values\s*\([^;]*v_from\s*,\s*v_next/i,'event must persist the pre-transition status');
9 +console.log('Slice D1 transition evidence invariants: OK');