test: rebase parity baseline to v1.64.0.0; fix capture-vs-check drift

The parity ratchet had quietly failed for 7 skills — v1.58-v1.64 growth
landed past the v1.57.7.0 anchors and nothing caught it because this
test had no CI lane (verified pre-existing: SKILL.md content is
byte-identical to origin/main). Same rebase protocol as
v1.53->v1.57.7.0; old baseline retained for the audit trail.

Root-caused a second latent bug while rebasing: captureBaseline recorded
SKELETON-ONLY bytes while the checker compares UNION bytes (skeleton +
carved sections/*.md), so a fresh capture read carved skills at ~2x
ratio (ship: 82KB captured vs 183KB checked). captureBaseline now takes
sectionedSkills and records unions for carved skills — capture and check
measure the same thing, so the NEXT rebase can't hit this. Four
CARVE_GUARDS skeleton caps re-ratcheted to current +headroom
(plan-ceo 92K, plan-eng 70K, office-hours 100K, design-consultation
70K), annotated inline.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-08-15 08:43:22 -07:00
co-authored by Claude Fable 5
parent 39715addff
commit 0d1544c2db
5 changed files with 696 additions and 12 deletions
+21 -2
View File
@@ -46,6 +46,14 @@ export interface ParityBaseline {
export interface CaptureOptions {
repoRoot: string;
tag?: string;
/**
* Skills whose baseline bytes must be the UNION of skeleton + sections/*.md
* (mirroring parity-harness readSkillForParity, which is what the checker
* compares against). Omitting a carved skill here records skeleton-only
* bytes and the ratio check then reads ~2x on the next parity run — the
* exact capture-vs-check drift that broke the v1.64 rebase.
*/
sectionedSkills?: string[];
}
/** Extract the frontmatter description from a SKILL.md file. Empty string if none. */
@@ -134,7 +142,7 @@ function getGitInfo(repoRoot: string): { commit: string; branch: string } {
}
export function captureBaseline(opts: CaptureOptions): ParityBaseline {
const { repoRoot, tag } = opts;
const { repoRoot, tag, sectionedSkills } = opts;
const skillDirs = discoverSkillDirs(repoRoot);
const evalCoverage = discoverEvalCoverage(repoRoot, skillDirs);
const skills: Record<string, SkillBaselineEntry> = {};
@@ -144,7 +152,18 @@ export function captureBaseline(opts: CaptureOptions): ParityBaseline {
const skillMdPath = path.join(repoRoot, dir, 'SKILL.md');
const tmplPath = path.join(repoRoot, dir, 'SKILL.md.tmpl');
const content = fs.readFileSync(skillMdPath, 'utf-8');
const bytes = Buffer.byteLength(content, 'utf-8');
let bytes = Buffer.byteLength(content, 'utf-8');
// Union in the carved sections for sectioned skills — semantic twin of
// parity-harness readSkillForParity (which the checker uses). Kept inline
// because parity-harness imports this module as a value (cycle).
if (sectionedSkills?.includes(dir)) {
const sectionsDir = path.join(repoRoot, dir, 'sections');
if (fs.existsSync(sectionsDir)) {
for (const f of fs.readdirSync(sectionsDir).filter(f => f.endsWith('.md')).sort()) {
bytes += Buffer.byteLength(fs.readFileSync(path.join(sectionsDir, f), 'utf-8'), 'utf-8');
}
}
}
const lines = content.split('\n').length;
const description = extractDescription(content);
const descriptionLen = Buffer.byteLength(description, 'utf-8');