فینورا پرو - سامانه جامع حسابداری و صدور فاکتور

test(holoo): surface invoice numbering concurrency signals

Davood Mehraban committed Nov 22, 2026 at 21:04 UTC 96244d264067cf4848a56224676f44fd04a4c1ed
2 files changed +14 -1
scripts/holoo-schema-audit.ps1
+11 -1
@@ -39,7 +39,16 @@ try {
39 $integrity | Add-Member -NotePropertyName duplicateInvoiceTypeNumberGroups -NotePropertyValue $r.GetInt64(0)
40 $integrity | Add-Member -NotePropertyName invoiceHeadersWithoutAccountingCode -NotePropertyValue $r.GetInt64(1)
41 } finally {$r.Close()}
42 - $result=[pscustomobject]@{schemaVersion=1;database='HolooBackup_050808_LAB_20261110';readOnlyAudit=$true;tables=$tables;integrity=$integrity;complete=($tables.Count -eq 3);note='Candidate sentinel classification is unverified; raw orphan count retained. No application-level invariants or concurrency claims'}
42 + $q.CommandText="SELECT p.name,m.definition FROM sys.procedures p JOIN sys.sql_modules m ON p.object_id=m.object_id WHERE p.name IN ('InsertInFacture','InsertInFactureCode','Sp_AppendNewSanad') ORDER BY p.name"
43 + $r=$q.ExecuteReader()
44 + try {
45 + $procedures=@()
46 + while($r.Read()){
47 + $definition=$r.GetString(1)
48 + $procedures += [pscustomobject]@{name=$r.GetString(0);usesCursor=($definition -match '(?i)\bCURSOR\b');hasUpdateLock=($definition -match '(?i)\bUPDLOCK\b');hasSerializable=($definition -match '(?i)\bSERIALIZABLE\b');hasBeginTransaction=($definition -match '(?i)\bBEGIN\s+TRAN(?:SACTION)?\b')}
49 + }
50 + } finally {$r.Close()}
51 + $result=[pscustomobject]@{schemaVersion=1;database='HolooBackup_050808_LAB_20261110';readOnlyAudit=$true;tables=$tables;integrity=$integrity;procedureConcurrencySignals=$procedures;complete=($tables.Count -eq 3 -and $procedures.Count -eq 3);note='Candidate sentinel classification is unverified; raw orphan count retained. No application-level invariants or concurrency claims'}
52 if($Json){$result|ConvertTo-Json -Depth 6}else{$tables|Format-Table -AutoSize;Write-Output ('COMPLETE='+$result.complete)}
53 if(-not $result.complete){exit 2}
54 } finally {$c.Dispose()}
@@ -47,3 +56,4 @@ try {
56
57
58
59 +
tests/holoo-schema-audit.test.mjs
+3
@@ -24,6 +24,8 @@ test('real lab structural audit returns three complete primary-keyed tables', {s
24 for(const key of ['orphanInvoiceLinesExcludingCandidateSentinel','candidateSentinelRows','missingReferencedAccountingDocuments','duplicateInvoiceTypeNumberGroups','invoiceHeadersWithoutAccountingCode']) assert.ok(Number.isSafeInteger(audit.integrity[key]) && audit.integrity[key] >= 0, key);
25 assert.ok(audit.integrity.orphanInvoiceLinesExcludingCandidateSentinel <= audit.integrity.orphanInvoiceLines);
26 assert.deepEqual(audit.tables.map(t => t.table), ['FACTART','FACTURE','SANAD']);
27 + assert.deepEqual(audit.procedureConcurrencySignals.map(p => p.name), ['InsertInFacture','InsertInFactureCode','Sp_AppendNewSanad']);
28 + for (const proc of audit.procedureConcurrencySignals) for(const key of ['usesCursor','hasUpdateLock','hasSerializable','hasBeginTransaction']) assert.equal(typeof proc[key], 'boolean');
29 for (const table of audit.tables) {
30 assert.equal(table.primaryKeys, 1);
31 for(const key of ['outboundForeignKeys','triggers','checkConstraints']) assert.ok(Number.isInteger(table[key]) && table[key]>=0);
@@ -32,3 +34,4 @@ test('real lab structural audit returns three complete primary-keyed tables', {s
34
35
36
37 +