test(ms-ai-architect): Spor 1 — akseptansetester (residual scoped, worklist-aktivering, CT5/N4, poison-doc) [skip-docs]
This commit is contained in:
parent
cec98b5cb5
commit
ed92d65385
3 changed files with 134 additions and 1 deletions
|
|
@ -10,7 +10,12 @@
|
|||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { validatePaths } from '../../scripts/kb-update/validate-kb-file.mjs';
|
||||
import { buildKbHeader } from '../../scripts/kb-update/lib/transform.mjs';
|
||||
import {
|
||||
buildKbHeader,
|
||||
insertHeaderFields,
|
||||
validateKbFile,
|
||||
} from '../../scripts/kb-update/lib/transform.mjs';
|
||||
import { parseTypeHeader, parseSourceHeader } from '../../scripts/kb-update/lib/kb-headers.mjs';
|
||||
|
||||
const GOOD = buildKbHeader({
|
||||
title: 'Azure AI Search - Hybrid Retrieval',
|
||||
|
|
@ -78,3 +83,44 @@ test('validatePaths — no paths → ok:true (nothing to gate)', () => {
|
|||
assert.equal(r.ok, true);
|
||||
assert.deepEqual(r.results, []);
|
||||
});
|
||||
|
||||
// --- Spor 1 acceptance: the residual criterion after the substrate migration ---
|
||||
// These generate the migrated file through the REAL Session-2 primitive
|
||||
// (insertHeaderFields), then assert the create-guard's residual — proving the
|
||||
// substrate closes the worklist-relevant fields (type+source) even where base
|
||||
// fields lag. `verified`/`verified_by` stay open by design (the judge fills them,
|
||||
// next brief), so the residual for a conformant file is EXACTLY those two.
|
||||
|
||||
// A base-field-CONFORMANT legacy file: title + English **Last updated:** + **Status:**,
|
||||
// small (no TOC required). Migrated → Type + Source stamped, still no Verified.
|
||||
const LEGACY_CONFORMANT =
|
||||
'# Azure AI Foundry\n\n**Last updated:** 2026-06\n**Status:** GA\n\n---\n\n## Oversikt\n\ntekst\n';
|
||||
// A base-field-INCOMPLETE legacy file: Norwegian **Sist oppdatert:** (RE_LAST_UPDATED is
|
||||
// English-only) + **Kategori:** but NO **Status:**. Migrated → Type + Source stamped.
|
||||
const LEGACY_INCOMPLETE =
|
||||
'# Copilot Studio\n\n**Kategori:** Styring\n**Sist oppdatert:** 2026-06\n\n---\n\n## Oversikt\n\ntekst\n';
|
||||
|
||||
test('acceptance — a migrated base-field-conformant reference has residual EXACTLY [verified, verified_by]', () => {
|
||||
const migrated = insertHeaderFields(LEGACY_CONFORMANT, {
|
||||
type: 'reference',
|
||||
source: 'https://learn.microsoft.com/azure/ai-foundry',
|
||||
});
|
||||
assert.equal(parseTypeHeader(migrated), 'reference');
|
||||
assert.equal(parseSourceHeader(migrated), 'https://learn.microsoft.com/azure/ai-foundry');
|
||||
assert.deepEqual(validateKbFile(migrated).missing, ['verified', 'verified_by']);
|
||||
});
|
||||
|
||||
test('acceptance — a migrated base-field-incomplete reference has residual ⊆ the 4-set, with type+source present', () => {
|
||||
const migrated = insertHeaderFields(LEGACY_INCOMPLETE, {
|
||||
type: 'reference',
|
||||
source: 'https://learn.microsoft.com/power-platform/copilot',
|
||||
});
|
||||
const { missing } = validateKbFile(migrated);
|
||||
const FOUR_SET = ['last_updated', 'status', 'verified', 'verified_by'];
|
||||
assert.ok(missing.every((m) => FOUR_SET.includes(m)), `residual ${JSON.stringify(missing)} ⊆ 4-set`);
|
||||
// The substrate DID complete the worklist-relevant fields — type + source are present,
|
||||
// never in the residual, even though base fields (Norwegian date / no Status) lag.
|
||||
assert.ok(!missing.includes('source'));
|
||||
assert.equal(parseTypeHeader(migrated), 'reference');
|
||||
assert.equal(parseSourceHeader(migrated), 'https://learn.microsoft.com/power-platform/copilot');
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue