feat(ms-ai-architect): G2 LUKKET — adoptert v3.1-judge wired inn i pipeline (JUDGE_VERSION 2→'3.1', TDD, suite 641) [skip-docs]

This commit is contained in:
Kjell Tore Guttormsen 2026-06-30 21:55:39 +02:00
commit da8606f9f6
6 changed files with 24 additions and 14 deletions

View file

@ -39,9 +39,11 @@ const DEFAULT_TYPE = 'reference';
// drift-introducing failure mode the create-guard exists to stop.
const REQUIRED_REFERENCE_META = ['source', 'verified', 'verified_by'];
// The current GATE-PASS claim judge (judge-claim-prompt-v2). stampVerifiedMeta records
// The current GATE-PASS claim judge (judge-claim-prompt-v3.1, adopted G1 2026-06-30).
// A version *label string* — integer major + optional minor — so provenance names the
// adopted judge exactly (v3 was a distinct, rejected version). stampVerifiedMeta records
// `verified_by: judge-v<JUDGE_VERSION>` unless the caller overrides or marks `human`.
const JUDGE_VERSION = 2;
const JUDGE_VERSION = '3.1';
// A Microsoft Learn / docs authority URL — a non-reference file may NOT carry one.
const MS_LEARN_RE = /\b(?:learn|docs)\.microsoft\.com/i;
@ -143,7 +145,7 @@ export function buildKbHeader(meta) {
* meta IFF the judge verdict passed otherwise REFUSE (throw). This encodes
* "nytt/regenerert innhold kjøres gjennom judgen FØR commit født verifisert; ellers
* ingen fil". transform.mjs never calls the judge itself (pure lib); the command runs
* the v2 claim judge, aggregates per-claim results into `{pass}`, and calls this. A
* the v3.1 claim judge, aggregates per-claim results into `{pass}`, and calls this. A
* failing verdict means no file is born.
*
* @param {object} baseMeta the reference meta (title/status/category/source/lastUpdated)
@ -159,6 +161,10 @@ export function stampVerifiedMeta(baseMeta, verdict, today) {
if (!DATE_RE.test(String(today ?? ''))) {
throw new Error(`stampVerifiedMeta: invalid today date '${today}' (expected YYYY-MM[-DD])`);
}
// Default stamp = the current JUDGE_VERSION label ('3.1'). An explicit integer override
// is still honoured (judgeVersion:3 → judge-v3); a minor-bearing string override is not
// yet (falls back to default) — tracked as a §8 follow-up, harmless since the pipeline
// always uses the default.
const verifiedBy =
verdict.by === 'human'
? 'human'

View file

@ -43,7 +43,7 @@ Headeren ser slik ut og MÅ stå først:
**Type:** reference
**Source:** {{SOURCE_URL}}
**Verified:** {{VERIFIED_DATE}}
**Verified by:** judge-v2
**Verified by:** judge-v3.1
---
```
@ -98,11 +98,11 @@ Ingen innledning eller avslutningskommentar — kun markdown-brødteksten.
## Etter destillasjon (caller, gated)
1. **Født-verifisert judge (FØR commit):** kjør claim-judgen (`scripts/kb-eval/judge-claim-prompt-v2.md`)
1. **Født-verifisert judge (FØR commit):** kjør claim-judgen (`scripts/kb-eval/judge-claim-prompt-v3.1.md`)
over brødtekstens maskin-verifiserbare påstander mot `{{SOURCE_URL}}`. Aggreger til `verdict = {pass}`
(alle maskin-verifiserbare påstander `grounded``pass: true`).
2. `meta = stampVerifiedMeta({title, status, category, source, lastUpdated}, verdict, today)`
stempler `type='reference'` + `verified=today` + `verified_by='judge-v2'` **kun** ved `pass: true`;
stempler `type='reference'` + `verified=today` + `verified_by='judge-v3.1'` **kun** ved `pass: true`;
ellers KASTER den (ingen fil fødes). Deretter `content = composeKbFile(meta, body)`
header + (store filer) `## Innhold`-TOC + brødtekst.
3. `validateKbFile(content)` → må være `valid: true` (title + Last updated + Status + Source +