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

Keep cost path candidates unresolved without direct token evidence

Davood Mehraban committed Nov 23, 2026 at 12:11 UTC f36f72f8f5f36b64074b3abd09b6320532e91d0e
2 files changed +2
src/holoo-cost-path-triage.cjs
+1
@@ -9,6 +9,7 @@ function triageCostPaths(report) {
9 if (matches.length !== 1) return {name, status:'UNRESOLVED', reason:matches.length ? 'ambiguous procedure name' : 'procedure absent'};
10 const p = matches[0];
11 if (!p.definitionAvailable) return {name, schema:p.schema, status:'UNRESOLVED', reason:'definition unavailable'};
12 + if (['Tedad','Buy_Price','Price_BS'].every(t => p.signals[t] === 0)) return {name:p.name, schema:p.schema, status:'UNRESOLVED', reason:'no direct cost or quantity token evidence'};
13 return {
14 name:p.name, schema:p.schema, status:'LEXICAL_CANDIDATE',
15 signals:Object.fromEntries(['FACTURE','FACTART','SANAD','Tedad','Buy_Price','Price_BS','INSERT','UPDATE','DELETE','EXEC','sp_executesql'].map(t=>[t,p.signals[t]]))
tests/holoo-cost-path-triage.test.mjs
+1
@@ -12,6 +12,7 @@ test('triage is lexical and never approves writes',()=>{const r=triageCostPaths(
12 test('rejects invalid source evidence',()=>{const r=valid();r.procedureCount=3;assert.equal(triageCostPaths(r).status,'INVALID_EVIDENCE');});
13 test('missing target is unresolved, not evidence of absence of behavior',()=>{const r=valid();r.procedures.pop();r.procedureCount=1;assert.equal(triageCostPaths(r).candidates[1].status,'UNRESOLVED');});
14 test('duplicate target names across schemas are ambiguous',()=>{const r=valid();r.procedures.push({...proc('checkgeymattamamshodeh2'),schema:'other'});r.procedureCount=3;assert.equal(triageCostPaths(r).candidates[0].status,'UNRESOLVED');});
15 +test('zero cost and quantity tokens are unresolved, not promoted',()=>{const r=valid();assert.equal(triageCostPaths(r).candidates[0].status,'UNRESOLVED');});
16 test('unavailable definition is unresolved',()=>{const r=valid();r.procedures[0].definitionAvailable=false;for(const t of terms)r.procedures[0].signals[t]=null;assert.equal(triageCostPaths(r).candidates[0].status,'UNRESOLVED');});
17 test('real LAB triage remains read-only', {skip:process.platform!=='win32'||process.env.HOLOO_SQL_INTEGRATION!=='1'},()=>{
18 const script=resolve(import.meta.dirname ?? resolve('.','tests'),'../scripts/holoo-financial-procedure-signals.ps1');