enhance(#2778): make the size-ratchet failure name its own remedy (#2780)

* fix(#2778): exempt intentionally-absent paths from the glossary gate

check-glossary-refs asserts that every backticked tests/ token in
CONTEXT.md resolves on disk. tests/emitted-drift-ack.json (ADR-2719
section 3) is absent on a healthy next BY DESIGN — it appears only
inside a PR that needs it, which is what makes touching it the alarm.

It passed before only by accident of backtick pairing: CONTEXT.md's
RULESET entries are themselves backtick-wrapped and contain backticks,
so the token happened to fall outside a code span. Any edit that
shifted the parity exposed it. A gate that passes by luck is not
passing.

The exemption is exact, not a prefix hole: a sibling missing tests/
path still fails, and a test locks that.

* feat(#2778): make the size-ratchet failure name its own remedy

The growth branch stated a requirement and withheld the means of
satisfying it: no ack file named, no schema, no key format, and no
do-not-regenerate line — so the likeliest guess was to hunt for a
baseline that #2724 deleted. Observed live on #2543.

All remediation now comes from one frozen REMEDIATION export whose
example document is rendered from ACK_VERSION, so the taught schema
cannot drift from the schema parseAck accepts. A round-trip test feeds
the printed document back through parseAck.

The report is now built as a typed IR (buildReport) that formatReport
renders, so tests assert on structure rather than prose, per
CONTRIBUTING.md's raw-text-matching rule.

Two defects found and fixed inline while building:
- diffEmitted's validation early-return omitted newFileCapExceeded
  while formatReport reads its length, so the branch that reports a
  failed git diff threw a TypeError instead of naming the problem.
- Printing one complete ack document per failing branch made each read
  as the whole file, so pasting the second over the first silently lost
  an acknowledgment. One document now covers the whole report.

Closes #2778

* chore(#2778): backfill changeset pr number to 2780
This commit is contained in:
Tom Boucher
2026-07-28 18:26:55 -04:00
committed by GitHub
parent 0997d4f443
commit e276cc7f00
8 changed files with 546 additions and 8 deletions

View File

@@ -143,6 +143,48 @@ test('a reference to a nonexistent gsd-core/bin/lib/*.cjs path is skipped (gener
assert.equal(res.status, 0, `generated bin/lib path must be skipped, not asserted missing: ${res.stderr}`);
});
test('an intentionally-absent documented path is skipped, not asserted missing', (t) => {
// #2778. `tests/emitted-drift-ack.json` (ADR-2719 §3) is absent on a healthy
// `next` BY DESIGN — it appears only inside a PR that needs it, which is what
// makes touching it the alarm. Asserting its existence turns the correct state
// into a drift finding. Under `tests/` it would otherwise be tracked, so this
// is a real exemption rather than a prefix accident.
const context = [
'# Context',
'',
'The escape hatch is a committed acknowledgment (`tests/emitted-drift-ack.json`).',
'',
`${allRuntimesSentence(17, REAL_RUNTIMES)}.`,
'',
].join('\n');
const root = makeRepo(t, { contextBody: context });
const res = run(root, ['--check']);
assert.equal(
res.status, 0,
`an intentionally-absent path must be skipped, not asserted missing: ${res.stderr}`,
);
});
test('a sibling tests/ path that is merely missing is still caught', (t) => {
// The exemption must be exact, not a blanket hole under `tests/`. A different
// missing tests/ file must still fail, or #2778's fix would disarm the gate for
// the whole directory.
const context = [
'# Context',
'',
'See `tests/emitted-drift-ack-typo.json` for details.',
'',
`${allRuntimesSentence(17, REAL_RUNTIMES)}.`,
'',
].join('\n');
const root = makeRepo(t, { contextBody: context });
const res = run(root, ['--check']);
assert.equal(res.status, 1, 'a genuinely missing tests/ path must still be a finding');
assert.match(`${res.stdout}${res.stderr}`, /emitted-drift-ack-typo\.json/);
});
test('a ~/-rooted path and a bare filename are both skipped', (t) => {
const context = [
'# Context',