feat(ms-ai-architect): G3 gull-intern-konsistens-lint + G4 build-instruks-policy — §8 gap-lukk [skip-docs]
This commit is contained in:
parent
b9db0b2be2
commit
9b147b470f
6 changed files with 256 additions and 5 deletions
47
scripts/kb-eval/lint-gold-consistency.mjs
Normal file
47
scripts/kb-eval/lint-gold-consistency.mjs
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
#!/usr/bin/env node
|
||||
// lint-gold-consistency.mjs — G3 (programdok §8) CLI: kjør gull-intern-
|
||||
// konsistens-vakten over gold-correctness-set.json. Tynn wiring; all logikk i
|
||||
// testet lib/gold-consistency.mjs (samme form som run-judge-bakeoff.mjs).
|
||||
//
|
||||
// Flagger verdict=correct-claims hvis egen `notes` innrømmer at verdien ikke er
|
||||
// bekreftet mot kilden («uverifisert / illustrativ / ikke i kilden») og mangler
|
||||
// et `consistency_waiver`. Exit 1 hvis noen uwaived → hard gate for gull-bygg.
|
||||
//
|
||||
// Usage:
|
||||
// node scripts/kb-eval/lint-gold-consistency.mjs [--gold <path>] [--json]
|
||||
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { lintGoldConsistency } from './lib/gold-consistency.mjs';
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
const DATA = path.join(__dirname, 'data');
|
||||
|
||||
function flag(name) {
|
||||
const i = process.argv.indexOf(name);
|
||||
return i >= 0 ? process.argv[i + 1] : undefined;
|
||||
}
|
||||
|
||||
const goldPath = flag('--gold') || path.join(DATA, 'gold-correctness-set.json');
|
||||
if (!fs.existsSync(goldPath)) {
|
||||
console.error(`error: ${goldPath} not found`);
|
||||
process.exit(2);
|
||||
}
|
||||
const gold = JSON.parse(fs.readFileSync(goldPath, 'utf8'));
|
||||
const r = lintGoldConsistency(gold);
|
||||
|
||||
if (process.argv.includes('--json')) {
|
||||
console.log(JSON.stringify(r, null, 2));
|
||||
} else if (r.ok) {
|
||||
console.log(`gull-konsistens OK — 0 uwaived selvmotsigende correct-claims (${(gold.claims || []).length} claims)`);
|
||||
} else {
|
||||
console.error(`gull-konsistens FEIL — ${r.flagged.length} uwaived selvmotsigende correct-claim(s):`);
|
||||
for (const f of r.flagged) {
|
||||
console.error(` - ${f.id} [${f.markers.join(', ')}]`);
|
||||
console.error(` notes: ${f.notes}`);
|
||||
}
|
||||
console.error('\nResolver hver: relabel verdikten ELLER legg til et consistency_waiver med begrunnelse (menneske-i-loop §4c).');
|
||||
}
|
||||
|
||||
process.exit(r.ok ? 0 : 1);
|
||||
Loading…
Add table
Add a link
Reference in a new issue