fix: add regression-test-presence gate + missing tests for #2429/#2279 (#2563)

lint-fix-has-regression-test.cjs: new gate that fails if a fix(#NNNN)
or feat(#NNNN) commit has zero behavioral test files (*.test.cjs,
excluding auto-generated fixtures/baselines) in its diff. Wired into
lint:ci so it runs before PR creation.

Missing regression tests added:
- #2429: codex local scope does not set $HOME/.agents skills home;
  global scope does (tests/runtime-artifact-layout.test.cjs)
- #2279: map-codebase instructions say to overwrite existing dates,
  not just replace [YYYY-MM-DD] placeholders (tests/commands.test.cjs)
This commit is contained in:
Tom Boucher
2026-07-23 12:13:12 -04:00
committed by GitHub
parent 7d298d6d4d
commit a5180d96a3
4 changed files with 180 additions and 1 deletions

View File

@@ -3585,3 +3585,33 @@ describe('query commit --files scoping (#2269)', () => {
assert.match(content.slice(idx, idx + 200), /ROADMAP\.md/);
});
});
describe('#2279: map-codebase date stamp instructions overwrite existing dates', () => {
const REPO_ROOT = path.join(__dirname, '..');
test('codebase-mapper agent says to SET date stamps, overwriting existing values', () => {
const content = fs.readFileSync(
path.join(REPO_ROOT, 'agents', 'gsd-codebase-mapper.md'), 'utf-8'
);
assert.match(content, /overwriting whatever date is already there/i,
'must instruct the agent to SET date stamps unconditionally, not just replace [YYYY-MM-DD] placeholders');
});
test('map-codebase workflow spawn prompts say to SET date stamps, not replace placeholders', () => {
const content = fs.readFileSync(
path.join(REPO_ROOT, 'gsd-core', 'workflows', 'map-codebase.md'), 'utf-8'
);
const stampLines = content.match(/Set all date stamps[^\r\n]*/g) || [];
assert.ok(stampLines.length >= 4,
`must have ≥4 "Set all date stamps" instructions (4 spawn prompts + 1 sequential); got ${stampLines.length}`);
});
test('map-codebase sequential path says to SET date stamps overwriting existing dates', () => {
const content = fs.readFileSync(
path.join(REPO_ROOT, 'gsd-core', 'workflows', 'map-codebase.md'), 'utf-8'
);
const idx = content.indexOf('overwriting any existing date');
assert.notEqual(idx, -1,
'workflow must instruct agents to overwrite existing dates, not just replace [YYYY-MM-DD] placeholders');
});
});

View File

@@ -101,6 +101,24 @@ describe('resolveRuntimeArtifactLayout — codex', () => {
assert.strictEqual(layout.kinds[0].prefix, 'gsd-');
assert.strictEqual(typeof layout.kinds[0].stage, 'function');
});
test('#2429: codex local scope does not set $HOME/.agents skills home override', () => {
const layout = resolveRuntimeArtifactLayout('codex', FAKE_DIR, 'local');
const skills = layout.kinds.find(k => k.kind === 'skills');
assert.ok(skills, 'codex local must have a skills kind');
assert.strictEqual(skills.home, undefined,
'codex local skills must NOT have a home override (would redirect to $HOME/.agents instead of project-local)');
});
test('#2429: codex global scope DOES set $HOME/.agents skills home override', () => {
const layout = resolveRuntimeArtifactLayout('codex', FAKE_DIR, 'global');
const skills = layout.kinds.find(k => k.kind === 'skills');
assert.ok(skills, 'codex global must have a skills kind');
assert.ok(typeof skills.home === 'string' && skills.home.length > 0,
'codex global skills MUST have a home override ($HOME/.agents)');
assert.ok(skills.home.includes('.agents'),
'codex global skills home should point to .agents directory');
});
});
describe('resolveRuntimeArtifactLayout — copilot', () => {