refactor(#2267): golden-parity file-set snapshot + anti-staleness CI selection (#2274)

Phase 2 of golden-parity redesign (epic #2264). Adds an install file-set snapshot (golden-install-tree) and a ci-test-scope rule selecting golden-parity whenever any installed-source path changes, closing the silent-staleness hole behind the #2266 red. ADR-2264 amended (the copy/transform split premise was unsound). Closes #2267.
This commit is contained in:
Tom Boucher
2026-07-14 19:22:13 -04:00
committed by GitHub
parent 6a474db3aa
commit 89b1bef881
25 changed files with 8155 additions and 2 deletions

View File

@@ -581,6 +581,77 @@ describe('golden-install-parity selection (#1691 drift guard)', () => {
});
});
describe('shipped install content (golden-parity drift guard, #2267)', () => {
// #2266 regression: hooks/gsd-statusline.js changed installed output but no
// RULES entry selected golden-install-parity, so stale golden fixtures merged
// to `next` undetected. The installer emits hooks/*, commands/*, agents/*,
// skills/*, gsd-core/workflows/*, gsd-core/templates/*, gsd-core/references/*,
// gsd-core/bin/shared/*.json, and a handful of shipped scripts/* files — every
// one of those paths must additionally select golden-install-parity AND the
// install-tree snapshot (union semantics: this rule ADDS to whatever
// content-specific rule already matched the path).
// One path per prefix the rule handles — every installed-source dir the
// installer emits. gsd-core/contexts/ is the regression for the review miss
// (a real shipped dir that the initial enumeration omitted).
const SHIPPED_PATHS = [
'hooks/gsd-statusline.js', // exact #2266 regression
'gsd-core/workflows/plan-phase.md',
'gsd-core/templates/config.json',
'gsd-core/references/ui-brand.md',
'gsd-core/contexts/dev.md', // regression: initially omitted from the rule
'agents/gsd-planner.md',
'commands/gsd/mempalace-capture.md',
'skills/gsd-explore/SKILL.md',
'gsd-core/bin/shared/model-catalog.json',
'scripts/changeset/lint.cjs',
'scripts/lib/cli-exit.cjs',
'scripts/fix-slash-commands.cjs', // exact-match allowlist entry
'scripts/gen-capability-registry.cjs', // exact-match allowlist entry
'scripts/gen-loop-host-contract.cjs', // exact-match allowlist entry
];
for (const file of SHIPPED_PATHS) {
test(`${file} selects golden-install-parity + golden-install-tree`, () => {
const result = scopeFor([file]);
assert.strictEqual(result.code_changed, true,
`expected code_changed=true for ${file}, got: ${JSON.stringify(result)}`);
assert.ok(
result.targeted_tests.includes('tests/golden-install-parity.test.cjs'),
`expected golden-install-parity in targeted_tests for ${file}, got: ${JSON.stringify(result.targeted_tests)}`,
);
assert.ok(
result.targeted_tests.includes('tests/golden-install-tree.test.cjs'),
`expected golden-install-tree in targeted_tests for ${file}, got: ${JSON.stringify(result.targeted_tests)}`,
);
});
}
test('docs/ change does NOT select golden-install-parity (negative case)', () => {
const result = scopeFor(['docs/usage.md']);
assert.strictEqual(result.code_changed, false,
`expected code_changed=false for docs-only change, got: ${JSON.stringify(result)}`);
assert.ok(
!result.targeted_tests.includes('tests/golden-install-parity.test.cjs'),
`docs-only change must NOT select golden-install-parity, got: ${JSON.stringify(result.targeted_tests)}`,
);
});
test('non-shipped scripts/ file does NOT select golden-install-tree (allowlist is exact)', () => {
// The rule allowlists only 3 named scripts + scripts/changeset|lib/. A
// sibling script that is code but NOT installed verbatim must NOT pull in
// the install-tree snapshot — proving this is not a blanket 'scripts/'
// prefix that would re-run the golden on every script edit. Assert on
// golden-install-TREE (the rule's dedicated test), not parity: many scripts/
// paths legitimately select parity via the installer rule's
// path.includes('install') substring.
const result = scopeFor(['scripts/build-hooks.js']);
assert.ok(
!result.targeted_tests.includes('tests/golden-install-tree.test.cjs'),
`non-shipped script must NOT select golden-install-tree, got: ${JSON.stringify(result.targeted_tests)}`,
);
});
});
describe('code_changed=false implies clean output invariant', () => {
// Fix 1: when code_changed is false, full_matrix, targeted_tests, windows_tests
// must ALL be empty/false — even if a docs path coincidentally