feat(ms-ai-architect): G2 — generaliser stamp-guard til version-label-streng (TDD, kaster på malformert) [skip-docs]
This commit is contained in:
parent
36fd4cfe7b
commit
6f82572dba
2 changed files with 82 additions and 8 deletions
|
|
@ -208,6 +208,58 @@ test('stampVerifiedMeta honours an explicit judgeVersion', () => {
|
|||
assert.equal(stampVerifiedMeta(base, { pass: true, judgeVersion: 3 }, '2026-06-29').verified_by, 'judge-v3');
|
||||
});
|
||||
|
||||
// --- G2: version-label generalisation (formatJudgeVersion via stampVerifiedMeta) -----
|
||||
// The stamp guard now honours a minor-bearing label ('3.2' → judge-v3.2), preserves the
|
||||
// integer path (regression above), defaults on absence, and THROWS on a malformed label
|
||||
// rather than silently falling back — a mislabel would be a provenance lie in a public file.
|
||||
|
||||
test('stampVerifiedMeta honours a minor-bearing string judgeVersion override', () => {
|
||||
const base = { title: 'T', status: 'GA', category: 'c',
|
||||
source: 'https://learn.microsoft.com/x', lastUpdated: '2026-06' };
|
||||
assert.equal(
|
||||
stampVerifiedMeta(base, { pass: true, judgeVersion: '3.2' }, '2026-06-29').verified_by,
|
||||
'judge-v3.2',
|
||||
);
|
||||
});
|
||||
|
||||
test('stampVerifiedMeta honours a float judgeVersion override', () => {
|
||||
const base = { title: 'T', status: 'GA', category: 'c',
|
||||
source: 'https://learn.microsoft.com/x', lastUpdated: '2026-06' };
|
||||
assert.equal(
|
||||
stampVerifiedMeta(base, { pass: true, judgeVersion: 3.2 }, '2026-06-29').verified_by,
|
||||
'judge-v3.2',
|
||||
);
|
||||
});
|
||||
|
||||
test('stampVerifiedMeta defaults verified_by to judge-v3.1 when judgeVersion is absent', () => {
|
||||
const base = { title: 'T', status: 'GA', category: 'c',
|
||||
source: 'https://learn.microsoft.com/x', lastUpdated: '2026-06' };
|
||||
assert.equal(
|
||||
stampVerifiedMeta(base, { pass: true }, '2026-06-29').verified_by,
|
||||
'judge-v3.1',
|
||||
);
|
||||
});
|
||||
|
||||
test('stampVerifiedMeta throws on a malformed judgeVersion label (no silent fallback)', () => {
|
||||
const base = { title: 'T', status: 'GA', category: 'c',
|
||||
source: 'https://learn.microsoft.com/x', lastUpdated: '2026-06' };
|
||||
for (const bad of ['3.2.1', '', 'v3', '3.2 x']) {
|
||||
assert.throws(
|
||||
() => stampVerifiedMeta(base, { pass: true, judgeVersion: bad }, '2026-06-29'),
|
||||
/judge version|malformed/i,
|
||||
`expected throw for judgeVersion=${JSON.stringify(bad)}`,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
test('stampVerifiedMeta → composeKbFile round-trips a minor-bearing judge version (end-to-end)', () => {
|
||||
const base = { title: 'Azure AI Search', status: 'GA', category: 'rag-architecture',
|
||||
source: 'https://learn.microsoft.com/azure/search/x', lastUpdated: '2026-06' };
|
||||
const stamped = stampVerifiedMeta(base, { pass: true, judgeVersion: '3.2' }, '2026-06-29');
|
||||
const file = composeKbFile(stamped, '## Introduksjon\n\nKort.\n');
|
||||
assert.equal(parseVerifiedByHeader(file), 'judge-v3.2');
|
||||
});
|
||||
|
||||
test('stampVerifiedMeta supports a human verification path', () => {
|
||||
const base = { title: 'T', status: 'GA', category: 'c',
|
||||
source: 'https://learn.microsoft.com/x', lastUpdated: '2026-06' };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue