fix(test): review findings — Windows path normalization, full totals rebuild, ratchet coverage

Pre-landing review (5 specialists) found one critical: the ratchet test runs
in the curated Windows lane, where path.relative yields backslash skill names
that miss the test/ filter and mismatch every POSIX fixture key. Names are now
normalized once in buildRatchetBill (toPosixName) and the fixture filter is
tightened to test/fixtures/. All eight Bill.totals fields are rebuilt from the
filtered list (no fixture-polluted perInvocation/totalMd numbers for future
consumers). New coverage: Windows-separator normalization pins, a
captureContextBudget round-trip against tree-a (headroom math exact), a
stripFields regression pin (interactive/benefits-from absent from renders,
hooks/gbrain preserved), and the ceilings test no longer double-reports
stale-fixture entries.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-08-25 02:38:47 +00:00
co-authored by Claude Fable 5
parent 6d52318384
commit d80d3c3ed7
3 changed files with 85 additions and 5 deletions
+23
View File
@@ -3295,6 +3295,29 @@ describe('voice-triggers processing', () => {
const frontmatter = content.slice(0, fmEnd);
expect(frontmatter).not.toContain('voice-triggers:');
});
// Gen-time-only keys: interactive + benefits-from are read from the .tmpl by
// buildContext; the generated copy has no reader (the host reads name/
// description/allowed-tools/hooks; gbrain: is runtime-read and NOT stripped).
// Pin the strip so a stripFields refactor can't silently re-add the always-on
// frontmatter weight — mirrors the voice-triggers pins above.
test('generated SKILL.md strips gen-time-only keys the .tmpl still declares', () => {
const tmpl = fs.readFileSync(path.join(ROOT, 'plan-ceo-review', 'SKILL.md.tmpl'), 'utf-8');
const tmplFm = tmpl.slice(0, tmpl.indexOf('\n---', 4));
expect(tmplFm).toContain('interactive:');
expect(tmplFm).toContain('benefits-from:');
const generated = fs.readFileSync(path.join(ROOT, 'plan-ceo-review', 'SKILL.md'), 'utf-8');
const genFm = generated.slice(0, generated.indexOf('\n---', 4));
expect(genFm).not.toContain('interactive:');
expect(genFm).not.toContain('benefits-from:');
// The runtime-read and host-read keys survive the strip.
const investigate = fs.readFileSync(path.join(ROOT, 'investigate', 'SKILL.md'), 'utf-8');
const invFm = investigate.slice(0, investigate.indexOf('\n---', 4));
expect(invFm).toContain('hooks:');
expect(invFm).toContain('gbrain:');
});
});
describe('plan-mode-info resolver (handshake-replacement)', () => {