From e95e0831b25b5cf1d67e89398c93f73fe5e97ead Mon Sep 17 00:00:00 2001 From: garrytan Date: Sat, 17 Oct 2026 02:26:23 +0000 Subject: [PATCH] test: the scope-signal clarity check follows helper-printed signals; the hermetic update-check fixture writes the identity cache Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --- test/hermetic-skill-runtime.test.ts | 3 ++- test/review-workflow-clarity.test.ts | 11 +++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/test/hermetic-skill-runtime.test.ts b/test/hermetic-skill-runtime.test.ts index b735c030f..163fa26f3 100644 --- a/test/hermetic-skill-runtime.test.ts +++ b/test/hermetic-skill-runtime.test.ts @@ -379,7 +379,8 @@ describe('hermetic skill runtime', () => { const version = read(path.join(ROOT, 'VERSION')).trim(); write(path.join(state, 'config.yaml'), 'update_check: true\n'); write(path.join(state, '.codex-desc-healed'), ''); - write(path.join(state, 'last-update-check'), `UP_TO_DATE ${version}\n`); + const runtimeHead = execFileSync('git', ['rev-parse', 'HEAD'], { cwd: runtime, encoding: 'utf8', timeout: 5000 }).trim(); + write(path.join(state, 'last-update-check'), `UP_TO_DATE ${version}\nIDENTITY head=${runtimeHead} remote=none upstream=https://github.com/garrytan/gstack.git\n`); write(path.join(state, 'just-upgraded-from'), 'TEST_OLD\n'); expect(execFileSync(path.join(runtime, 'bin', 'gstack-update-check'), [], { cwd: home, env: { ...env, GSTACK_STATE_DIR: state }, encoding: 'utf8', timeout: 10_000 })) .toBe(`JUST_UPGRADED TEST_OLD ${version}\n`); diff --git a/test/review-workflow-clarity.test.ts b/test/review-workflow-clarity.test.ts index e2e2565c5..07dec5865 100644 --- a/test/review-workflow-clarity.test.ts +++ b/test/review-workflow-clarity.test.ts @@ -365,10 +365,17 @@ for (const skillName of ['review', 'ship']) { test(`${skillName} clarity: the scope block prints every signal specialist selection reads`, () => { const block = between(army, '### Detect stack and scope', '### Read specialist hit rates'); expect(block).toContain("/gstack-diff-scope 2>/dev/null) || true\nset | grep '^SCOPE_'\n"); - const used = [...new Set(between(army, '### Select specialists', '### Adaptive gating').match(/SCOPE_[A-Z]+/g))]; + const selection = between(army, '### Select specialists', '### Adaptive gating'); + const used = [...new Set(selection.match(/SCOPE_[A-Z_]+/g))]; expect(used.length).toBeGreaterThan(0); const flags = between(readFileSync(join(root, 'bin/gstack-diff-scope'), 'utf8'), '_print_flags() {', '}'); - for (const signal of used) expect(flags, signal).toContain(`echo "${signal}=`); + for (const signal of used) { + if (flags.includes(`echo "${signal}=`)) continue; + // A signal the scope block does not print must come from the helper its own selection line runs. + const helper = /bin\/(gstack-[a-z-]+) detect\b/.exec(selection.split('\n').find(line => line.includes(signal))!)?.[1]; + expect(helper, signal).toBeDefined(); + expect(readFileSync(join(root, 'bin', helper!), 'utf8'), signal).toContain(`${signal}=`); + } }); test(`${skillName} clarity: terminal failure permits independent work but never certifies coverage`, () => {