فینورا پرو - سامانه جامع حسابداری و صدور فاکتور
test(holoo): flag read-last-then-insert numbering race
Davood Mehraban committed
Nov 22, 2026 at 21:07 UTC
eab2060679128745451ea60bbc328971dda6d8fd
2 files changed
+4
-2
scripts/holoo-schema-audit.ps1
+2
-1
@@ -45,7 +45,7 @@ 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')}
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');readsLastInvoiceNumber=($definition -match '(?is)FETCH\s+LAST\s+FROM\s+FacCursor');insertsInvoiceHeader=($definition -match '(?is)INSERT\s+INTO\s+Facture\s*\(');allocatesNumberWithoutVisibleLock=([bool](($definition -match '(?is)FETCH\s+LAST\s+FROM\s+FacCursor') -and ($definition -match '(?is)INSERT\s+INTO\s+Facture\s*\(') -and ($definition -notmatch '(?i)\bUPDLOCK\b|\bSERIALIZABLE\b|\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'}
@@ -57,3 +57,4 @@ try {
57
58
59
60
+
tests/holoo-schema-audit.test.mjs
+2
-1
@@ -26,7 +26,7 @@ test('real lab structural audit returns three complete primary-keyed tables', {s
26
assert.ok(audit.integrity.orphanInvoiceLinesExcludingCandidateSentinel <= audit.integrity.orphanInvoiceLines);
27
assert.deepEqual(audit.tables.map(t => t.table), ['FACTART','FACTURE','SANAD']);
28
assert.deepEqual(audit.procedureConcurrencySignals.map(p => p.name), ['InsertInFacture','InsertInFactureCode','Sp_AppendNewSanad']);
29
- for (const proc of audit.procedureConcurrencySignals) for(const key of ['usesCursor','hasUpdateLock','hasSerializable','hasBeginTransaction']) assert.equal(typeof proc[key], 'boolean');
29
+ for (const proc of audit.procedureConcurrencySignals) for(const key of ['usesCursor','hasUpdateLock','hasSerializable','hasBeginTransaction','readsLastInvoiceNumber','insertsInvoiceHeader','allocatesNumberWithoutVisibleLock']) assert.equal(typeof proc[key], 'boolean');
30
for (const table of audit.tables) {
31
assert.equal(table.primaryKeys, 1);
32
for(const key of ['outboundForeignKeys','triggers','checkConstraints']) assert.ok(Number.isInteger(table[key]) && table[key]>=0);
@@ -37,3 +37,4 @@ test('real lab structural audit returns three complete primary-keyed tables', {s
37
38
39
40
+