Skip to content

Commit a53892b

Browse files
committed
test(preamble): assert update_check gates echo + upgrade prose
Iterates every generated SKILL.md carrying the runtime config-echo cluster and asserts it echoes UPDATE_CHECK, reads the update_check config, and gates the UPGRADE_AVAILABLE / JUST_UPGRADED prose on the flag. Guards against the scope filter matching nothing. Pins the #2001 fix so the instruction layer can't silently drift back to ignoring the opt-out. Refs #2001.
1 parent 257e9e3 commit a53892b

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

test/gen-skill-docs.test.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,31 @@ describe('gen-skill-docs', () => {
323323
expect(content).toContain('git branch --show-current');
324324
});
325325

326+
// #2001: update_check: false silences the binary but the upgrade-handling
327+
// instruction prose used to ship unconditionally. Every skill that carries
328+
// the runtime config-echo cluster must (a) echo UPDATE_CHECK so the
329+
// instruction layer can read it, and (b) gate the UPGRADE_AVAILABLE /
330+
// JUST_UPGRADED prose on it — the same echo-then-gate convention every other
331+
// flag (PROACTIVE, SKILL_PREFIX, EXPLAIN_LEVEL, QUESTION_TUNING) follows.
332+
test('update_check opt-out gates preamble echo and upgrade-handling prose (issue #2001)', () => {
333+
let checked = 0;
334+
for (const skill of CLAUDE_GENERATED_SKILLS) {
335+
const content = fs.readFileSync(path.join(ROOT, skill.dir, 'SKILL.md'), 'utf-8');
336+
// Scope: only skills that render the runtime config-echo cluster.
337+
if (!content.includes('echo "QUESTION_TUNING: $_QUESTION_TUNING"')) continue;
338+
checked++;
339+
expect(content, `${skill.dir} must echo UPDATE_CHECK`).toContain('echo "UPDATE_CHECK: $_UPDATE_CHECK"');
340+
expect(content, `${skill.dir} must read update_check config`).toContain('_UPDATE_CHECK=$(');
341+
// Whenever the upgrade-handling prose ships, it must gate on the flag.
342+
if (content.includes('UPGRADE_AVAILABLE <old> <new>')) {
343+
expect(content, `${skill.dir} upgrade prose must gate on UPDATE_CHECK`)
344+
.toContain('If `UPDATE_CHECK` is `"false"`');
345+
}
346+
}
347+
// Guard against the scope filter silently matching nothing.
348+
expect(checked).toBeGreaterThan(0);
349+
});
350+
326351
test('tier 2+ skills contain ELI10 simplification rules (AskUserQuestion format)', () => {
327352
// Root SKILL.md is tier 1 (no AskUserQuestion format). Check a tier 2+ skill instead.
328353
// v1.7.0.0 Pros/Cons format uses "ELI10 (ALWAYS)" rather than "Simplify (ELI10".

0 commit comments

Comments
 (0)