فینورا پرو - سامانه جامع حسابداری و صدور فاکتور
fix(holoo): reject padded dependency table identifiers
Davood Mehraban committed
Nov 23, 2026 at 07:35 UTC
e715f80eab936447ca5e850cbad9a8740f5abdc6
2 files changed
+4
-2
src/holoo-procedure-dependency-assessment.cjs
+2
-2
@@ -7,8 +7,8 @@ function assessProcedureDependencies(e){
7
if(!Array.isArray(e.dependencyRows)||!Number.isSafeInteger(e.dependencyRowCount)||!Number.isSafeInteger(e.procedureCount)||e.dependencyRowCount<1||e.procedureCount<1||e.dependencyRowCount!==e.dependencyRows.length)return fail('Invalid dependency counts');
8
const procedures=new Set(),tables=new Set(),unresolved=[];
9
for(const row of e.dependencyRows){
10
- if(!row||typeof row.procedure_schema!=='string'||!row.procedure_schema.trim()||typeof row.procedure_name!=='string'||!row.procedure_name.trim()||(typeof row.referenced_entity_name!=='string'||!TABLES.has(row.referenced_entity_name.toUpperCase()))||!Number.isSafeInteger(row.referenced_minor_id)||row.referenced_minor_id<0||![false,true,0,1].includes(row.is_ambiguous)||![false,true,0,1].includes(row.is_caller_dependent))return fail('Malformed catalog dependency row');
11
- procedures.add(JSON.stringify([row.procedure_schema,row.procedure_name]));tables.add(row.referenced_entity_name.toUpperCase());
10
+ if(!row||typeof row.procedure_schema!=='string'||!row.procedure_schema.trim()||typeof row.procedure_name!=='string'||!row.procedure_name.trim()||(typeof row.referenced_entity_name!=='string'||!TABLES.has(row.referenced_entity_name.trim().toUpperCase())||row.referenced_entity_name!==row.referenced_entity_name.trim())||!Number.isSafeInteger(row.referenced_minor_id)||row.referenced_minor_id<0||![false,true,0,1].includes(row.is_ambiguous)||![false,true,0,1].includes(row.is_caller_dependent))return fail('Malformed catalog dependency row');
11
+ procedures.add(JSON.stringify([row.procedure_schema,row.procedure_name]));tables.add(row.referenced_entity_name.trim().toUpperCase());
12
if(row.is_ambiguous===true||row.is_ambiguous===1||row.is_caller_dependent===true||row.is_caller_dependent===1)unresolved.push({procedure_schema:row.procedure_schema,procedure_name:row.procedure_name,table:row.referenced_entity_name});
13
}
14
if(procedures.size!==e.procedureCount)return fail('Distinct procedure count mismatch');
tests/holoo-procedure-dependency-assessment.test.mjs
+2
@@ -12,3 +12,5 @@ test('rejects fabricated completeness and wrong database',()=>{for(const patch o
12
test('rejects inconsistent counts and malformed rows',()=>{for(const patch of [{dependencyRowCount:2},{procedureCount:2},{dependencyRowCount:-1},{procedureCount:-1},{dependencyRows:[],dependencyRowCount:0,procedureCount:0},{dependencyRows:[{...row,referenced_entity_name:'UNKNOWN'}]},{dependencyRows:[{...row,referenced_minor_id:-1}]}])assert.equal(assessProcedureDependencies({...fixture(),...patch}).status,'INVALID_EVIDENCE');});
13
test('reports ambiguous dependencies without declaring semantic proof',()=>{const r=assessProcedureDependencies({...fixture(),dependencyRows:[{...row,is_ambiguous:1}]});assert.equal(r.ambiguousOrCallerDependent.length,1);assert.equal(r.financialSemanticsVerified,false);});
14
test('real LAB dependency catalog is structurally consistent', {skip:process.platform!=='win32'||process.env.HOLOO_SQL_INTEGRATION!=='1'},()=>{const script=fileURLToPath(new URL('../scripts/holoo-financial-procedure-dependencies.ps1',import.meta.url));const result=spawnSync('powershell.exe',['-NoProfile','-NonInteractive','-ExecutionPolicy','Bypass','-File',script,'-Json'],{encoding:'utf8',timeout:30000,maxBuffer:4*1024*1024});assert.equal(result.status,0,result.stderr);const assessment=assessProcedureDependencies(JSON.parse(result.stdout));assert.equal(assessment.status,'CATALOG_ONLY',JSON.stringify(assessment));assert.equal(assessment.productionWriteGate,'NO-GO');});
15
+
16
+test('rejects padded catalog table identifiers rather than silently normalizing them',()=>{for(const name of [' FACTURE','FACTURE ',' FACTART '])assert.equal(assessProcedureDependencies({...fixture(),dependencyRows:[{...row,referenced_entity_name:name}]}).status,'INVALID_EVIDENCE');});