fix(okr): gate-herding B2 scoped strict + B3 alle lenkeformer + M2 realpath-confinement + M3 deriveType basename/ord-grense

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-07-16 20:12:35 +02:00
commit 7f9c790f43
6 changed files with 222 additions and 18 deletions

View file

@ -122,3 +122,32 @@ test('projectFrontmatter: tags er multi-linje liste (writeFrontmatter array-gren
assert.match(e.frontmatter, /^tags:$/m, 'multi-linje tags-noekkel');
assert.match(e.frontmatter, /^ {2}- Tildelingsbrev$/m, 'tag-element i vokab');
});
// --- M3 (A1): deriveType matcher kun basename + ord-grenser, aldri full sti ---
test('projectFrontmatter: /okr/-segment i full sti gir IKKE type OKR (M3)', () => {
const concept = { sourceSlug: 'notat', title: 'Handlingsplan', slug: 'handlingsplan', level: 1, body: 'x' };
const e = projectFrontmatter(concept, {
sourcePath: '/x/.claude/okr/y/notat.md',
sourceMtime: MTIME,
});
const type = parseFrontmatter(e.frontmatter).get('type');
assert.notEqual(type, 'OKR', 'sti-segmentet /okr/ skal ikke forgifte type-utledningen');
assert.equal(type, 'Notat', 'basename notat.md gir Notat (ord-grense mot punktum)');
});
test('projectFrontmatter: kompound-ord i title matcher ikke vokab-term (Statusnotat != Status)', () => {
const concept = { sourceSlug: 'opps', title: 'Statusnotat mai', slug: 'statusnotat-mai', level: 1, body: 'x' };
const e = projectFrontmatter(concept, { sourcePath: 'innboks/oppsummering.txt', sourceMtime: MTIME });
assert.equal(
parseFrontmatter(e.frontmatter).get('type'),
'Dokument',
'kompound-treff skal ikke snappe til Status -- safe default Dokument',
);
});
test('projectFrontmatter: helt ord i title matcher fortsatt (Status for KR -> Status)', () => {
const concept = { sourceSlug: 's', title: 'Status for KR', slug: 'status-for-kr', level: 1, body: 'x' };
const e = projectFrontmatter(concept, { sourcePath: 'innboks/s.txt', sourceMtime: MTIME });
assert.equal(parseFrontmatter(e.frontmatter).get('type'), 'Status');
});