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>
This commit is contained in:
garrytanandcapy-ai[bot] committed 2026-10-17 02:26:23 +00:00
1 parent 46547e8091
commit e95e0831b2
2 files changed
+11 -3

No files matched your search

+2 -1
View File
@@ -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`);
+9 -2
View File
@@ -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 <base> 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`, () => {