|
| 1 | +import test from 'node:test'; |
| 2 | +import assert from 'node:assert/strict'; |
| 3 | +import { advisoryLlmAuditSummary } from '../lib/audit-policy.mjs'; |
| 4 | + |
| 5 | +test('high-risk LLM findings are advisory by default after deterministic audit passes', () => { |
| 6 | + const result = advisoryLlmAuditSummary({ |
| 7 | + auditInputHash: 'audit-hash', |
| 8 | + deterministicFailures: 0, |
| 9 | + highRiskFindings: 3, |
| 10 | + pass: false |
| 11 | + }, { audit: {} }); |
| 12 | + assert.equal(result.pass, true); |
| 13 | + assert.equal(result.llmFindingsBlocking, false); |
| 14 | + assert.equal(result.advisoryHighRiskFindings, 3); |
| 15 | +}); |
| 16 | + |
| 17 | +test('explicit blockOnLlmFindings preserves the hard gate', () => { |
| 18 | + const result = advisoryLlmAuditSummary({ |
| 19 | + deterministicFailures: 0, |
| 20 | + highRiskFindings: 3, |
| 21 | + pass: false |
| 22 | + }, { audit: { blockOnLlmFindings: true } }); |
| 23 | + assert.equal(result, null); |
| 24 | +}); |
| 25 | + |
| 26 | +test('LLM advisory policy never hides deterministic failures', () => { |
| 27 | + const result = advisoryLlmAuditSummary({ |
| 28 | + deterministicFailures: 114, |
| 29 | + highRiskFindings: 3, |
| 30 | + pass: false |
| 31 | + }, { audit: { blockOnLlmFindings: false } }); |
| 32 | + assert.equal(result, null); |
| 33 | +}); |
0 commit comments