Files
gstack/test/cso-spec-taxonomy-alignment.test.ts
T
Garry TanandClaude Fable 5 7933a38aa8 fix(gen): resolver registry describes the template language again
Seven registered {{PLACEHOLDER}}s had zero uses in any .tmpl (checked in both
bare and :arg forms): REDACT_TAXONOMY_TABLE, TEST_COVERAGE_AUDIT_REVIEW,
MODEL_OVERLAY, QUESTION_PREFERENCE_CHECK, QUESTION_LOG, INLINE_TUNE_FEEDBACK,
MAKE_PDF_SETUP. The last two of those families are invoked programmatically by
preamble.ts (functions kept, registry entries dropped); the question-tuning
trio and the review coverage-audit wrapper were documented by their own module
as existing 'for unit testing' that no test performed — deleted, along with
generateRedactTaxonomyTable + its EXAMPLE/TIER_BLURB constants (its '/cso
renders the full table' comment was itself stale) and its test describe.

Also deletes the gated-resolver mechanism (ResolverEntry/appliesTo/
unwrapResolver + test/resolver-entry.test.ts): fully built, fully tested,
used by zero of the 65 registry entries — the generator loop simplifies to a
direct function call. CLAUDE.md's redact-doc line stops advertising the dead
token.

Proof: zero-diff regen (0 SKILL.md changed); gen-skill-docs + skill-validation
737 tests green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-14 21:12:20 -07:00

45 lines
1.8 KiB
TypeScript

/**
* Cross-skill taxonomy alignment. The canonical taxonomy lives in
* lib/redact-patterns.ts (single source of truth). /spec and /cso both reference
* it by pointer rather than inlining the full catalog (size discipline). This
* test guards that the recognizable HIGH-tier prefixes stay present in /cso's
* archaeology prose. (A fourth test covered the resolver-generated taxonomy
* table; that generator was deleted as dead code — no template ever used it.)
*/
import { describe, test, expect } from "bun:test";
import * as fs from "fs";
import * as path from "path";
const ROOT = path.resolve(import.meta.dir, "..");
// cso is carved (skeleton + sections/audit-phases.md). The Secrets Archaeology
// prose + secret prefixes moved into the section; check the union so relocated
// content still counts.
function unionSkill(skill: string): string {
let t = fs.readFileSync(path.join(ROOT, skill, "SKILL.md"), "utf-8");
const dir = path.join(ROOT, skill, "sections");
if (fs.existsSync(dir)) {
for (const f of fs.readdirSync(dir).sort()) {
if (f.endsWith(".md") && !f.endsWith(".md.tmpl")) t += "\n" + fs.readFileSync(path.join(dir, f), "utf-8");
}
}
return t;
}
const CSO = unionSkill("cso");
describe("cso/spec taxonomy alignment", () => {
test("cso archaeology names the recognizable HIGH-tier prefixes", () => {
for (const s of ["AKIA", "ghp_", "sk-ant-", "BEGIN"]) {
expect(CSO).toContain(s);
}
});
test("cso points to lib/redact-patterns.ts as the single source of truth", () => {
expect(CSO).toContain("lib/redact-patterns.ts");
});
test("cso keeps its git-history archaeology (different use case, not replaced)", () => {
expect(CSO).toContain("git log -p --all");
expect(CSO).toContain("Secrets Archaeology");
});
});