سامانه صدور فاکتور و حسابداری
Add failing Office C7 invariant coverage
davoodmehraban89 committed
Oct 1, 2026 at 00:22 UTC
66bf7f56550b0fafe1bca67c1db9178d86ddc36f
1 file changed
+19
scripts/office-slice-c7-check.mjs
new
+19
@@ -0,0 +1,19 @@
1
+import fs from 'node:fs';import path from 'node:path';
2
+const need=(t,r,l)=>{if(!r.test(t))throw new Error('Office C7 invariant missing: '+l)};
3
+const dir=path.join(process.cwd(),'supabase','migrations');
4
+const files=fs.readdirSync(dir).filter(x=>/office_slice_c7_.*\.sql$/.test(x));
5
+if(!files.length)throw new Error('Office C7 invariant missing: searchable archive migration');
6
+const m=files.map(x=>fs.readFileSync(path.join(dir,x),'utf8')).join('\n');
7
+need(m,/office_record_ocr_evidence/i,'OCR evidence RPC');
8
+need(m,/office_correct_ocr_evidence/i,'OCR correction RPC');
9
+need(m,/ocr_text_captured/i,'raw OCR evidence');
10
+need(m,/ocr_text_corrected/i,'OCR correction evidence');
11
+need(m,/websearch_to_tsquery|plainto_tsquery/i,'Postgres full-text query');
12
+need(m,/to_tsvector/i,'Postgres full-text document');
13
+need(m,/private\.can_access_record/i,'record authorization');
14
+need(m,/real Persian OCR|does not perform OCR|no OCR/i,'OCR accuracy/provider boundary');
15
+const ui=fs.readFileSync('js/office-mature.js','utf8');
16
+need(ui,/officeRecordOcrEvidence/i,'OCR evidence UI');
17
+need(ui,/officeCorrectOcrEvidence/i,'OCR correction UI');
18
+need(ui,/match_source/i,'search provenance UI');
19
+console.log('Office Slice C7 searchable archive contract: PASS');