config-audit/tests/knowledge/knowledge-staleness.test.mjs
Kjell Tore Guttormsen 624f5edabc docs(knowledge): refresh corpus to Opus 4.8 era (CC 2.1.114->181 Batch 3)
The knowledge base was frozen at ~v2.1.111, describing an Opus-4.7 world
after CC shipped Opus 4.8 and Fable 5. Refreshed three agent-facing
knowledge files; every fact re-verified against the official changelog
(~/.claude/cache/changelog.md, CC 2.1.181) on 2026-06-18.

- feature-evolution.md: new Opus-4.8-era rows above the v2.1.111 freeze --
  Opus 4.8 default + /effort xhigh (2.1.154), Fable 5 Mythos-class
  (2.1.170), post-session hook (2.1.169), MessageDisplay (2.1.152),
  /simplify -> /code-review (2.1.147), /config key=value (2.1.181).
- hook-events-reference.md: 26 -> 28 events (+MessageDisplay, +post-session);
  documented Stop/SubagentStop additionalContext output field.
- claude-code-capabilities.md: 2026-06 model/effort lineup table;
  bundled skills /simplify -> /code-review; documented /config key=value.
- cc-2.1.x-changelog-delta.md: marked SUPERSEDED by the gap-matrix.

Verification caught two version errors in STATE/matrix, corrected to the
changelog:
- Stop/SubagentStop additionalContext is 2.1.163, not 2.1.165 (2.1.165 was
  "Bug fixes" only; matrix row 109 already said 2.1.163).
- settings `agent` field introduced 2.0.59; 2.1.157 = honored for
  dispatched `claude agents` sessions, not the introduction.

New tests/knowledge/knowledge-staleness.test.mjs (8 tests) encodes the
verified facts as a re-freeze guard (RED before edits, GREEN after).

Full suite: 850/850 green (+8). self-audit PASS, A(100)/A(97).
2026-06-18 13:35:00 +02:00

75 lines
3.7 KiB
JavaScript

// Knowledge-base staleness guard.
//
// The gap-review (CC 2.1.114->181) found config-audit's knowledge corpus frozen
// at ~v2.1.111, so it described an Opus-4.7 world after CC had shipped Opus 4.8
// and Fable 5. These assertions encode facts re-verified against the official
// Claude Code changelog (~/.claude/cache/changelog.md) on 2026-06-18 so the
// corpus cannot silently re-freeze. Each fact carries its verified version.
//
// Verified facts (official changelog, CC 2.1.181):
// Opus 4.8 default + high effort + /effort xhigh ... 2.1.154
// lean system prompt now default (except Haiku/Sonnet/4.7-) 2.1.154
// Claude Fable 5 (Mythos-class) .................... 2.1.170
// /simplify renamed to /code-review ............... 2.1.147
// /config key=value in-session settings ........... 2.1.181
// MessageDisplay hook event ....................... 2.1.152
// post-session lifecycle hook ..................... 2.1.169
// Stop/SubagentStop return additionalContext ...... 2.1.163 (NOT 2.1.165)
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import { fileURLToPath } from 'node:url';
const read = (rel) =>
readFileSync(fileURLToPath(new URL(`../../knowledge/${rel}`, import.meta.url)), 'utf8');
test('feature-evolution.md records the Opus 4.8 era (not frozen at v2.1.111)', () => {
const md = read('feature-evolution.md');
assert.match(md, /Opus 4\.8/, 'must record Opus 4.8 as the new default');
assert.match(md, /Fable 5/, 'must record Claude Fable 5');
assert.match(md, /2\.1\.170/, 'Fable 5 verified at v2.1.170');
assert.match(md, /2\.1\.154/, 'Opus 4.8 / xhigh / lean prompt verified at v2.1.154');
assert.match(md, /xhigh/, 'must record the /effort xhigh tier');
});
test('feature-evolution.md records the /simplify -> /code-review rename', () => {
const md = read('feature-evolution.md');
assert.match(md, /\/code-review/, 'bundled skill renamed to /code-review (2.1.147)');
});
test('feature-evolution.md records /config key=value', () => {
const md = read('feature-evolution.md');
assert.match(md, /\/config/, '/config key=value in-session settings (2.1.181)');
});
test('hook-events-reference.md header reflects 28 events, not 26', () => {
const md = read('hook-events-reference.md');
assert.match(md, /28 hook events/, 'count must be 28 after MessageDisplay + post-session');
assert.doesNotMatch(md, /26 hook events/, 'stale "26 hook events" must be gone');
});
test('hook-events-reference.md lists MessageDisplay and post-session events', () => {
const md = read('hook-events-reference.md');
assert.match(md, /MessageDisplay/, 'MessageDisplay hook event (2.1.152)');
assert.match(md, /post-session/, 'post-session lifecycle hook (2.1.169)');
});
test('hook-events-reference.md documents Stop/SubagentStop additionalContext at 2.1.163', () => {
const md = read('hook-events-reference.md');
// The feature shipped in 2.1.163 (NOT 2.1.165 — that release was bug fixes only).
assert.match(md, /SubagentStop[\s\S]*additionalContext|additionalContext[\s\S]*SubagentStop/,
'Stop/SubagentStop additionalContext output field must be documented');
assert.match(md, /2\.1\.163/, 'additionalContext for Stop/SubagentStop verified at v2.1.163');
});
test('claude-code-capabilities.md bundled skills use /code-review, not stale /simplify', () => {
const md = read('claude-code-capabilities.md');
assert.match(md, /\/code-review/, 'bundled-skill list must list /code-review');
assert.doesNotMatch(md, /\/simplify/, '/simplify was renamed to /code-review (2.1.147)');
});
test('claude-code-capabilities.md documents /config key=value', () => {
const md = read('claude-code-capabilities.md');
assert.match(md, /\/config/, '/config key=value in-session settings (2.1.181)');
});