mirror of
https://github.com/garrytan/gstack.git
synced 2026-06-20 00:30:10 +02:00
test: copy carved sections into all e2e fixtures (prevent more carve-blind CI fails)
Proactive sweep beyond the two CI logs: every e2e test that copies a carved skill's SKILL.md into a temp fixture must also copy its sections/, or the model hits a STOP pointing at a missing section file and improvises/degrades. - skill-e2e.test.ts: plan-ceo/plan-eng/plan-design/office-hours copies across planDir/reviewDir/ohDir/benefitsDir dests now copy sections/. - skill-e2e-plan.test.ts: the office-hours copy + the 4-skill codex-offering loop now copy sections/. - skill-e2e-design.test.ts: plan-design-review copy now copies sections/. - skill-e2e-office-hours.test.ts: both office-hours copies now copy sections/. - skill-e2e-office-hours-brain-writeback.test.ts: GBRAIN_SAVE_RESULTS moved into the section, so check the regenerated skeleton+section UNION for the gbrain put block, ship both into the workdir, and restore both (the section regen was also leaking into the working tree — finally now restores it). ship copies (single-file Step-0 slices) and review/retro (not carved) untouched. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -104,6 +104,13 @@ describeIfSelected(
|
||||
);
|
||||
const skillPath = join(ROOT, 'office-hours', 'SKILL.md');
|
||||
const originalSkill = readFileSync(skillPath, 'utf-8');
|
||||
// office-hours is carved (v2 plan T9): GBRAIN_SAVE_RESULTS moved into
|
||||
// sections/design-and-handoff.md. Regen rewrites BOTH the skeleton and the
|
||||
// section, so we snapshot + restore + ship both, and check the UNION for
|
||||
// the gbrain put block.
|
||||
const sectionPath = join(ROOT, 'office-hours', 'sections', 'design-and-handoff.md');
|
||||
const hasSection = existsSync(sectionPath);
|
||||
const originalSection = hasSection ? readFileSync(sectionPath, 'utf-8') : null;
|
||||
try {
|
||||
execFileSync(
|
||||
'bun',
|
||||
@@ -122,17 +129,23 @@ describeIfSelected(
|
||||
},
|
||||
);
|
||||
const brainAwareSkill = readFileSync(skillPath, 'utf-8');
|
||||
if (!brainAwareSkill.includes('gbrain put "office-hours/')) {
|
||||
const brainAwareSection = hasSection ? readFileSync(sectionPath, 'utf-8') : '';
|
||||
if (!(brainAwareSkill + brainAwareSection).includes('gbrain put "office-hours/')) {
|
||||
throw new Error(
|
||||
'Regenerated office-hours/SKILL.md does not contain gbrain put block. ' +
|
||||
'Regenerated office-hours skeleton+section does not contain gbrain put block. ' +
|
||||
'Detection override may be broken — see test/gbrain-detection-override.test.ts.',
|
||||
);
|
||||
}
|
||||
mkdirSync(join(workDir, 'office-hours'), { recursive: true });
|
||||
writeFileSync(join(workDir, 'office-hours', 'SKILL.md'), brainAwareSkill);
|
||||
if (hasSection) {
|
||||
mkdirSync(join(workDir, 'office-hours', 'sections'), { recursive: true });
|
||||
writeFileSync(join(workDir, 'office-hours', 'sections', 'design-and-handoff.md'), brainAwareSection);
|
||||
}
|
||||
} finally {
|
||||
// Always restore the canonical SKILL.md so the working tree stays clean.
|
||||
// Always restore the canonical skeleton + section so the working tree stays clean.
|
||||
writeFileSync(skillPath, originalSkill);
|
||||
if (hasSection && originalSection !== null) writeFileSync(sectionPath, originalSection);
|
||||
rmSync(tmpHome, { recursive: true, force: true });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user