* chore(#4729): guard the retired-runtime name, and finish the locale residue Phase 5 of 5 on epic #4709, and the phase that closes it. Two parts, one concern: make the tree clean, and keep it clean. The guard is inert until the tree is clean, and shipping the cleanup without the guard is the one-bug-at-a-time pattern this epic exists to end. WHY A GUARD, AND WHY LAST Nothing in CI answered "does any shipped surface still present a retired runtime as live?", and the two gates that look like they should cannot. checkReviewerDocsParity is one-directional: it asserts the PRESENCE of every declared reviewer flag and never the ABSENCE of a retired one, so in #4716 it reported 0 violations while all four locale mirrors still documented --gemini as a live reviewer flag, with usage examples. And tests/gemini-runtime-removed.test.cjs is scoped by construction - its own docblock limits it to the installer CLI contract and the runtime-name-policy exports; it never reads docs/**, gsd-core/workflows/**, commands/** or agents/**. Every extension to it during this epic was a hand-added assertion for a surface somebody had already noticed. A guard written earlier would have red-flagged the very references phases 1b-4b were removing, which is why it lands last. PART A - THE RESIDUE, INCLUDING WORK I SHIPPED INCOMPLETE Each site was judged against its ENGLISH counterpart, not on its own: README.{ja-JP,ko-KR,pt-BR,zh-CN}.md :9 :24 :46 English README.md has ZERO occurrences -> substituted "Antigravity CLI, Kimi CLI" how-to/execute-a-phase.md:88 x4 locales fixed in #4728 -> substitute how-to/verify-and-ship.md:89 x4 locales fixed in #4728 -> substitute FEATURES.md cross-AI CLI list :1419 no Gemini -> DELETE FEATURES.md REQ-MULTI-RT-01 :1709 -> substitute FEATURES.md REQ-SKILLS-03 :1952 -> rewrite FEATURES.md REQ-QUOTA-02 :3256 deleted upstream -> delete VERSIONING.md:133 stale manifest -> see below The twelve README occurrences were an adversarial reviewer's BLOCKER, and the reason they survived my own sweep is structural: root-level *.md was outside the guard's scan set, so the repo's most-read runtime-advertising surface was invisible to the guard meant to police it. :46 is a live installer-runtime claim - it tells the reader the installer will offer a runtime that no longer exists. Checked for the duplicate-name trap before substituting: neither Antigravity nor Kimi appears anywhere in those four files. Two of these are mine to own: I fixed the ENGLISH execute-a-phase.md and verify-and-ship.md in #4728 and left all four mirrors behind. Unfinished work, not a deferral. Two more show why "substitute Gemini -> Antigravity" is the wrong default: in the cross-AI list and REQ-QUOTA-02 English DELETES the name, because Antigravity was already in the list or the classifier had dropped it. Substituting would have duplicated a name - the identical trap ARCHITECTURE.md:24 set in #4728, where English holds Kimi CLI in that slot. VERSIONING.md:133 is a different and worse defect than translation lag. Under "Manifest Version Sync" it listed gemini-extension.json as a version-synced manifest. That file is ABSENT from the repo, and scripts/sync-manifest-versions.cjs says so in its own comment - "#1928: gemini-extension.json was removed with the gemini runtime ... it is no longer a registered manifest" - while VERSIONED_MANIFESTS holds plugin.json, marketplace.json and vscode/package.json. So the doc named a manifest that does not exist AND omitted the one that replaced it. Both fixed, verified against the owning code rather than inferred from the name. The replacement bullet cites #1942, the issue that actually registered vscode/package.json, matching the convention of its neighbours. pt-BR/FEATURES.md is a 77-line stub genuinely lacking two sites, and ko-KR has no REQ-QUOTA-02 line. Skipped and recorded, never invented. PART B - THE GUARD scripts/lint-retired-runtime-name.cjs, modelled on scripts/lint-legacy-dir-name.cjs - the repo's own precedent for this problem shape (forbid a retired token, allowlist frozen content, self-exempt via a split literal, a REPO_ROOT test seam, lib/cli-exit.cjs, exit 0/1). Case sensitivity IS the mechanism, not an accident. The naive guard - "the string gemini must not appear" - is WRONG, not merely noisy: that string is load-bearing across Antigravity's real on-disk contract. A case-sensitive, standalone, capitalised name works because every legitimate reference is spelled differently and therefore cannot match: lowercase config homes (~/.gemini/antigravity, ~/.gemini/config, #3738), lowercase hyphenated model ids (gemini-2.5-flash-lite), uppercase env vars (GEMINI_API_KEY), and GEMINI.md. Table-driven, so the next retired runtime costs one row. THE ALLOWLIST IS THE ENTIRE RISK SURFACE, so it is three tiers, not one. Two rounds of isolated adversarial review reshaped it; both are recorded in .gsd/bug/chore-4729-gemini-drift-guard/60-review.json. ROUND 2 FOUND ONE ROOT CAUSE BEHIND TWO SEPARATE HOLES, and it was mine: both Tier-1 rules treated the ABSENCE of a runtime word as a GRANT. A veto list can never be complete, so "no runtime word found" silently exempted every phrasing nobody had enumerated. Demonstrated: `The installer now offers Gemini 3.`, `Supported agents include Gemini 3, Kimi, and Cursor.` and three more exited 0, as did `Suportamos Gemini, no estilo padrao, como runtime de instalacao.` and `Gemini 兼容,并且是受支持的运行时之一。`, both of which literally contain `runtime` or `运行时`. The fix was to stop enumerating exceptions and invert the evidence direction: Tier 1(a) - the hook DIALECT Antigravity inherits. Position is language-dependent and MEASURED: en Gemini-style/-compatible, ja Gemini スタイル, ko Gemini 스타일/호환, zh Gemini 风格 / 与 Gemini 兼容的, pt "no estilo Gemini" / "compatível com Gemini" where the qualifier PRECEDES the name. The marker must now form an ADJACENT COMPOUND with the name, not merely sit in a +/-24-character window - that window let `| Antigravity | Gemini-style hooks | Gemini support is live |` exit 0, one legitimate reference licensing a fresh live claim 21 characters later. The runtime-word veto is now LINE-GLOBAL. Ten real lines legitimately pair a dialect compound with a runtime word (`~/.gemini/antigravity-cli` in a table cell, "runtime files" in the same sentence); each is an explicit pin rather than a reason to loosen the veto for everyone. Measured: widening it surfaced exactly those ten and no others. Tier 1(b) - the provider/model axis. A version optionally followed by a qualifier, including full-width digits and CJK punctuation, AND positive model-axis evidence on the line, AND no runtime word. The positive requirement is the part that matters: all eight real model-axis lines in the repo name a model explicitly, so requiring it costs nothing on the real tree while flagging every laundering attempt. It is also the honest resolution of the agent/target tension below - rather than guess at an exhaustive veto list, stop treating an empty veto as evidence. Tier 2 - PINNED OCCURRENCES, now SPAN-SCOPED. A pin excuses only a match falling INSIDE an occurrence of its own snippet. Line-level containment let `Known provider menu update: Gemini CLI is once again a selectable GSD runtime.` and `Install target: Google (Gemini) - choose Gemini CLI as your GSD runtime.` both exit 0, because a short snippet elsewhere on the line pre-approved a brand-new claim. Span scoping makes short snippets safe: `Google (Gemini)` can only ever excuse the match inside those 15 characters. A LOAD-TIME validator now requires every pin to contain a retired name, and it immediately caught five of MY OWN pins whose snippets sat BESIDE the name rather than covering it - each would have shipped permanently inert and permanently reported stale. All pins were then reconciled in one pass. A pin is also marked used by PRESENCE on the line now, rather than only on the Tier-2 branch. Previously a pinned line that a general rule also matched never marked its pin used, producing a provably FALSE "no line matches pinned snippet" whose printed remedy told the maintainer to delete a pin that was still needed. Tier 3 - blanket trust, and a new occurrence inside it IS invisible. CHANGELOG.md and `.changeset/` - the rendered changelog and its source, one surface - plus six append-only directories. All 21 `.changeset/` hits were measured to be fragments DESCRIBING the retirement or a fix to it, 464 of them under archived/; a fragment can only describe what already shipped and is deleted at release, so pinning them would be friction with no signal. The cost is stated in the guard's own header rather than hidden. THE SCAN SET IS NOW EVERY TRACKED *.md FILE (1165 read). The original prefix list left `.github/`, `.changeset/`, `capabilities/`, `playbooks/` and `references/` invisible - and `.changeset/*.md` renders into CHANGELOG.md, so a live claim introduced there was invisible at BOTH ends. The escape hatch must now carry a justification (`gsd-allow-retired-runtime-name: <reason>`). A bare marker is rejected: it is checked first, excuses the whole line, and the failure message advertises it, so an unexplained one is indistinguishable from a silenced defect. Plus an anti-vacuity floor counting files actually READ, not files listed - a candidate count stays healthy-looking even if every read failed. A FALSE NEGATIVE I INTRODUCED, AND CLOSED The model-display escape began as a blanket /^ \d/ - "space then a digit" - which also matched "Install for Gemini 2.5 CLI as a supported runtime.", laundering a genuine stale-runtime claim through an attached version number. That was the THIRD appearance of one failure shape in this epic: an exclusion added to suppress false positives creating a false negative. #4716's sweep excluded lines matching gemini-[0-9] to spare Google's model ids, and thereby hid a stale review.models.gemini row whose example value was "gemini-2.5-pro" ON THE SAME LINE. Round 2 then produced the FOURTH and FIFTH instances, which is why the fix this time was to invert the rule's evidence direction rather than to enumerate more exceptions. The veto is word-anchored for Latin terms - unanchored, case-insensitive "CLI" matched inside "client" and would have vetoed legitimate model lists - and raw for CJK terms, where \b is ASCII-word-based and would never fire beside an ideograph, so anchoring them would silently disable the veto in ja/ko/zh. "agent" and "target" were deliberately left OUT: both occur throughout ordinary prose ("AI coding agents (Claude Code, Codex, Gemini 2.5 Pro)"), so vetoing on them would red correct content instead of catching runtime claims. The reasoning is in the guard's comment, not just the omission - and Tier 1(b)'s positive-evidence requirement is what makes that omission safe, since the rule no longer depends on the veto list being complete. COVERAGE tests/lint-retired-runtime-name.test.cjs drives the guard through its GSD_LINT_RETIRED_RUNTIME_REPO_ROOT seam against fixture repos, mirroring tests/lint-legacy-dir-name.test.cjs. A guard never observed failing is not a guard, and this epic already shipped one that was vacuous for 2 of its 5 files, so properties are paired against BOTH failure modes - too broad silently absorbs a future defect, too narrow reds on legitimate content. Floor boundaries are covered at 149/150/151. The round-2 reviewer's sharpest point was about that claim, and it was right: the first matrix's pairing was "true of the properties chosen, not of the predicate's actual surface" - not one of its twenty properties could see the dialect adjacency hole, a non-adjacent runtime word, pin shadowing, or an over-broad pin colliding with a new line. Every one of those is now a committed regression using the reviewer's own attack line verbatim, and the local fixture harness went from 14 cases to 35 (PASS=35 FAIL=0). That harness earned a finding of its own. Its first run reported PASS=2 FAIL=12 with BOTH passes VACUOUS: `git add` has no -q flag on this build, so nothing staged, every fixture hit the empty-walk error path, and the two checks that assert an ABSENCE passed off that error path rather than off real guard logic. A staging failure is now fatal and every absence-asserting check first proves the walk ran and the expected violation was flagged. Later, one case failed because its fixture supplied only one of a pinned file's two approved lines, so the stale-pin check fired correctly - the expectation was wrong, not the guard. Telling those two apart is the whole value of running a matrix rather than reasoning about one. On the two orthogonal reviews: the isolated adversarial pass executed a great deal of code, across two rounds, against its own fixture repos. The security pass did NOT - it self-discloses that it verified by reading only, because node --test is hard-blocked here. Saying so plainly, because "two orthogonal reviews" without that caveat overstates what the second one established. It also raised, and I cleared by measurement, a concern that importing escapeRegex from a gitignored build artifact would break lint:ci on an unbuilt clone: six other tracked scripts already require that exact path, three of them already in lint:ci, and .github/workflows/test.yml:192-193 runs `npm run build:lib` immediately before it for exactly this reason. Part A has no new test deliberately - those edits are covered by the guard itself inside lint:ci, and a separate per-locale assertion would duplicate it and then drift from it. The one exception is the root README case, which IS pinned: that residue was invisible to the guard rather than merely unasserted, so the fix is a scan-set change and needs its own regression test. No mode-bit read-failure fixture was added on purpose: the benches run as root, where chmod-based IO injection is vacuous, so such a test would assert nothing. The test's fixture helpers write throwaway docs/ paths, which trips lint-docs-guard-registration's reader-name heuristic. Resolved the way that lint documents - a header `// docs-guard-exempt:` marker plus a baseline entry - because the fixtures only WRITE scratch data and never read shipped docs; the baseline was re-confirmed, not merely extended, each time locale and adversarial fixtures were added. scripts/lib/macos-conformance-tier.generated.cjs regenerated through its own --write path, since a new test file changes the count lint:generated-sync reads. Fixes #4729 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * chore(#4729): backfill changeset PR number (#4753) --------- Co-authored-by: sim <sim@local> Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
853 lines
31 KiB
JavaScript
853 lines
31 KiB
JavaScript
'use strict';
|
||
|
||
/**
|
||
* TDD tests for scripts/lint-retired-runtime-name.cjs.
|
||
*
|
||
* Mirrors tests/lint-legacy-dir-name.test.cjs's structure and conventions
|
||
* closely: a temp git-fixture repo, driven via the process seam, with the
|
||
* guard's REPO_ROOT overridden through GSD_LINT_RETIRED_RUNTIME_REPO_ROOT
|
||
* (the sibling seam to that precedent's GSD_LINT_LEGACY_REPO_ROOT).
|
||
*/
|
||
// docs-guard-exempt: this file's `writeFile('docs/...', ...)` calls WRITE
|
||
// fabricated fixture content into a throwaway mkdtemp repo; none of it reads
|
||
// real shipped docs/ content. The `writeFile` callee name only incidentally
|
||
// matches lint-docs-guard-registration.cjs's reader-name heuristic (contains
|
||
// "file").
|
||
|
||
const { describe, test } = require('node:test');
|
||
const assert = require('node:assert/strict');
|
||
const fs = require('node:fs');
|
||
const os = require('node:os');
|
||
const path = require('node:path');
|
||
const { runNode } = require('./helpers/process-seam.cjs');
|
||
const { gitOrThrow } = require('./helpers/git-fixture.cjs');
|
||
const { GENERATOR_SCRIPT_TIMEOUT_MS } = require('./helpers/timeouts.cjs');
|
||
|
||
const GUARD_SCRIPT = path.resolve(__dirname, '..', 'scripts', 'lint-retired-runtime-name.cjs');
|
||
|
||
// scripts/lint-retired-runtime-name.cjs is exactly the shape
|
||
// GENERATOR_SCRIPT_TIMEOUT_MS describes: a single scripts/*.cjs lint script,
|
||
// spawned directly and once against a small temp fixture repo, no fan-out.
|
||
// Reuse the shared class norm (tests/helpers/timeouts.cjs) rather than
|
||
// restating its literal locally.
|
||
const GUARD_TIMEOUT_MS = GENERATOR_SCRIPT_TIMEOUT_MS;
|
||
|
||
// The guard's own anti-vacuity floor (MIN_EXPECTED_FILES in scripts/lint-retired-runtime-name.cjs).
|
||
const MIN_EXPECTED_FILES = 150;
|
||
|
||
// The retired runtime name, built via split-string concatenation so this
|
||
// test file cannot itself trip the guard (or any other regression-name
|
||
// lint) when scanned.
|
||
const RETIRED_NAME = 'Gem' + 'ini';
|
||
|
||
function createTempRepo() {
|
||
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-lint-retired-runtime-test-'));
|
||
gitOrThrow(['init', '--initial-branch=main'], { cwd: dir });
|
||
gitOrThrow(['config', 'user.email', 'test@example.com'], { cwd: dir });
|
||
gitOrThrow(['config', 'user.name', 'Test'], { cwd: dir });
|
||
return dir;
|
||
}
|
||
|
||
function writeFile(dir, relPath, content) {
|
||
const fullPath = path.join(dir, relPath);
|
||
fs.mkdirSync(path.dirname(fullPath), { recursive: true });
|
||
fs.writeFileSync(fullPath, content, 'utf8');
|
||
}
|
||
|
||
function gitAdd(dir, relPath) {
|
||
gitOrThrow(['add', relPath], { cwd: dir });
|
||
}
|
||
|
||
function gitAddAll(dir) {
|
||
gitOrThrow(['add', '-A'], { cwd: dir });
|
||
}
|
||
|
||
function cleanup(dir) {
|
||
// eslint-disable-next-line local/no-raw-rmsync-in-tests -- local cleanup in lint test; no helpers import available
|
||
fs.rmSync(dir, { recursive: true, force: true });
|
||
}
|
||
|
||
// Generates enough tracked, in-scan-set (docs/**/*.md) filler files to clear
|
||
// the guard's MIN_EXPECTED_FILES anti-vacuity floor, none of which mention
|
||
// the retired runtime name at all.
|
||
function seedFillerFiles(dir, count) {
|
||
for (let i = 0; i < count; i++) {
|
||
writeFile(dir, `docs/filler/note-${i}.md`, `# Filler note ${i}\n\nNothing retired here.\n`);
|
||
}
|
||
}
|
||
|
||
function runGuard(cwd) {
|
||
const r = runNode([GUARD_SCRIPT], {
|
||
cwd,
|
||
env: { ...process.env, GSD_LINT_RETIRED_RUNTIME_REPO_ROOT: cwd },
|
||
timeoutMs: GUARD_TIMEOUT_MS,
|
||
});
|
||
return { status: r.exitCode, stdout: r.stdout, stderr: r.stderr };
|
||
}
|
||
|
||
describe('lint-retired-runtime-name — clean tree', () => {
|
||
test('exits 0 when no tracked .md file names the retired runtime', () => {
|
||
const dir = createTempRepo();
|
||
try {
|
||
seedFillerFiles(dir, MIN_EXPECTED_FILES);
|
||
gitAddAll(dir);
|
||
|
||
const result = runGuard(dir);
|
||
assert.equal(result.status, 0, `expected exit 0, got ${result.status}; stderr: ${result.stderr}`);
|
||
assert.ok(result.stdout.includes('0 violations'), `stdout: ${result.stdout}`);
|
||
} finally {
|
||
cleanup(dir);
|
||
}
|
||
});
|
||
});
|
||
|
||
describe('lint-retired-runtime-name — proves it can fail', () => {
|
||
test('exits 1 with a path:line diagnostic when a bare capitalised retired name is scanned', () => {
|
||
// Load-bearing case: a guard never observed failing is not a guard.
|
||
const dir = createTempRepo();
|
||
try {
|
||
seedFillerFiles(dir, MIN_EXPECTED_FILES);
|
||
writeFile(
|
||
dir,
|
||
'docs/guides/setup.md',
|
||
`# Setup\n\nInstall ${RETIRED_NAME} as your runtime.\n`,
|
||
);
|
||
gitAddAll(dir);
|
||
|
||
const result = runGuard(dir);
|
||
assert.equal(result.status, 1, `expected exit 1, got ${result.status}; stdout: ${result.stdout}`);
|
||
assert.ok(
|
||
result.stderr.includes('docs/guides/setup.md:3:'),
|
||
`stderr should carry a path:line diagnostic: ${result.stderr}`,
|
||
);
|
||
} finally {
|
||
cleanup(dir);
|
||
}
|
||
});
|
||
});
|
||
|
||
describe('lint-retired-runtime-name — case sensitivity is the mechanism', () => {
|
||
test('exits 0 for every legitimate lowercase/uppercase spelling, none of which are the bare capitalised name', () => {
|
||
// The regex is deliberately case-sensitive (no `i` flag): every
|
||
// legitimate reference to the "gemini" string in this repo is spelled
|
||
// differently from the bare capitalised `Gemini` token, so none of
|
||
// these lines can match. See the guard's own module header.
|
||
const dir = createTempRepo();
|
||
try {
|
||
seedFillerFiles(dir, MIN_EXPECTED_FILES);
|
||
writeFile(
|
||
dir,
|
||
'docs/guides/config-homes.md',
|
||
[
|
||
'# Config homes',
|
||
'',
|
||
'Antigravity config lives at ~/.gemini/antigravity.',
|
||
'It also reads ~/.gemini/config.',
|
||
'Model id: gemini-2.5-flash-lite.',
|
||
'Set GEMINI_CONFIG_DIR to override.',
|
||
'See GEMINI.md for the instruction file.',
|
||
'',
|
||
].join('\n'),
|
||
);
|
||
gitAddAll(dir);
|
||
|
||
const result = runGuard(dir);
|
||
assert.equal(result.status, 0, `expected exit 0, got ${result.status}; stderr: ${result.stderr}`);
|
||
} finally {
|
||
cleanup(dir);
|
||
}
|
||
});
|
||
});
|
||
|
||
describe('lint-retired-runtime-name — gsd-allow-retired-runtime-name marker', () => {
|
||
test('exits 0 when the violating line also carries the inline allow marker', () => {
|
||
const dir = createTempRepo();
|
||
try {
|
||
seedFillerFiles(dir, MIN_EXPECTED_FILES);
|
||
writeFile(
|
||
dir,
|
||
'docs/history/migration-note.md',
|
||
`# Migration note\n\nInstall ${RETIRED_NAME} CLI for legacy testing. <!-- gsd-allow-retired-runtime-name: legacy-install note, see #1928 -->\n`,
|
||
);
|
||
gitAddAll(dir);
|
||
|
||
const result = runGuard(dir);
|
||
assert.equal(result.status, 0, `expected exit 0 with allow marker, got ${result.status}; stderr: ${result.stderr}`);
|
||
} finally {
|
||
cleanup(dir);
|
||
}
|
||
});
|
||
});
|
||
|
||
describe('lint-retired-runtime-name — model-display versions are allowed', () => {
|
||
test('exits 0 for a prose model list naming a version, not a runtime', () => {
|
||
const dir = createTempRepo();
|
||
try {
|
||
seedFillerFiles(dir, MIN_EXPECTED_FILES);
|
||
writeFile(
|
||
dir,
|
||
'docs/reference/models.md',
|
||
`# Supported models\n\nSupported model families: (o3, o4-mini, ${RETIRED_NAME} 2.5 Pro).\n`,
|
||
);
|
||
gitAddAll(dir);
|
||
|
||
const result = runGuard(dir);
|
||
assert.equal(result.status, 0, `expected exit 0, got ${result.status}; stderr: ${result.stderr}`);
|
||
} finally {
|
||
cleanup(dir);
|
||
}
|
||
});
|
||
});
|
||
|
||
describe('lint-retired-runtime-name — a version must NOT launder a runtime claim', () => {
|
||
test('exits 1 when a model-display version is attached to runtime-claiming wording', () => {
|
||
// This pins the fix for the earlier blanket `/^ \d/` ("space then a
|
||
// digit") exclusion, which was too broad: it also matched a genuine
|
||
// stale-runtime claim like "Gemini 2.5 CLI as a supported runtime.",
|
||
// laundering the false positive fix into a false negative on the same
|
||
// line. A version number must never launder a runtime claim.
|
||
const dir = createTempRepo();
|
||
try {
|
||
seedFillerFiles(dir, MIN_EXPECTED_FILES);
|
||
writeFile(
|
||
dir,
|
||
'docs/guides/runtime-claim.md',
|
||
`# Runtimes\n\nInstall for ${RETIRED_NAME} 2.5 CLI as a supported runtime.\n`,
|
||
);
|
||
gitAddAll(dir);
|
||
|
||
const result = runGuard(dir);
|
||
assert.equal(result.status, 1, `expected exit 1, got ${result.status}; stdout: ${result.stdout}`);
|
||
assert.ok(
|
||
result.stderr.includes('docs/guides/runtime-claim.md:3:'),
|
||
`stderr should carry a path:line diagnostic: ${result.stderr}`,
|
||
);
|
||
} finally {
|
||
cleanup(dir);
|
||
}
|
||
});
|
||
});
|
||
|
||
describe('lint-retired-runtime-name — -style dialect wording is allowed', () => {
|
||
test('exits 0 for a genuine hook-dialect reference ("Gemini-style")', () => {
|
||
const dir = createTempRepo();
|
||
try {
|
||
seedFillerFiles(dir, MIN_EXPECTED_FILES);
|
||
writeFile(
|
||
dir,
|
||
'docs/guides/hooks.md',
|
||
`# Hooks\n\nAntigravity uses ${RETIRED_NAME}-style settings.json hooks.\n`,
|
||
);
|
||
gitAddAll(dir);
|
||
|
||
const result = runGuard(dir);
|
||
assert.equal(result.status, 0, `expected exit 0, got ${result.status}; stderr: ${result.stderr}`);
|
||
} finally {
|
||
cleanup(dir);
|
||
}
|
||
});
|
||
});
|
||
|
||
describe('lint-retired-runtime-name — path allowlist works', () => {
|
||
test('exits 0 when the same violating content sits under an allowlisted path (docs/adr/)', () => {
|
||
const dir = createTempRepo();
|
||
try {
|
||
seedFillerFiles(dir, MIN_EXPECTED_FILES);
|
||
writeFile(
|
||
dir,
|
||
'docs/adr/999-retired-runtime-record.md',
|
||
`# ADR 999\n\nInstall ${RETIRED_NAME} CLI as a supported runtime.\n`,
|
||
);
|
||
gitAddAll(dir);
|
||
|
||
const result = runGuard(dir);
|
||
assert.equal(result.status, 0, `expected exit 0 under docs/adr/, got ${result.status}; stderr: ${result.stderr}`);
|
||
} finally {
|
||
cleanup(dir);
|
||
}
|
||
});
|
||
});
|
||
|
||
describe('lint-retired-runtime-name — anti-vacuity floor', () => {
|
||
test('refuses to report clean when far too few files are scanned', () => {
|
||
// The guard errors out (non-zero exit) rather than silently reporting
|
||
// "0 violations" on an empty/broken walk — see its MIN_EXPECTED_FILES check.
|
||
const dir = createTempRepo();
|
||
try {
|
||
writeFile(dir, 'docs/guides/one.md', '# Just one file\n\nNothing retired here.\n');
|
||
gitAdd(dir, 'docs/guides/one.md');
|
||
|
||
const result = runGuard(dir);
|
||
assert.notEqual(result.status, 0, `expected non-zero exit, got ${result.status}; stdout: ${result.stdout}`);
|
||
assert.ok(
|
||
result.stderr.includes('only 1 file'),
|
||
`stderr should explain the anti-vacuity refusal: ${result.stderr}`,
|
||
);
|
||
} finally {
|
||
cleanup(dir);
|
||
}
|
||
});
|
||
});
|
||
|
||
describe('lint-retired-runtime-name — root-level *.md is in the scan set', () => {
|
||
test('exits 1 for a violating root README.md', () => {
|
||
// Regression test for the defect that made this guard necessary AND
|
||
// initially unable to see it: four locale READMEs advertised the retired
|
||
// runtime as supported at README.<locale>.md:9/:24/:46 while the scan set
|
||
// covered only docs/ gsd-core/ commands/ agents/ skills/. The repo's
|
||
// most-read runtime-advertising surface was structurally invisible.
|
||
const dir = createTempRepo();
|
||
try {
|
||
seedFillerFiles(dir, MIN_EXPECTED_FILES);
|
||
writeFile(dir, 'README.md', `# Project\n\nInstall ${RETIRED_NAME} CLI as your runtime.\n`);
|
||
gitAddAll(dir);
|
||
|
||
const result = runGuard(dir);
|
||
assert.equal(result.status, 1, `expected exit 1, got ${result.status}; stdout: ${result.stdout}`);
|
||
assert.ok(
|
||
result.stderr.includes('README.md:3:'),
|
||
`stderr should carry a path:line diagnostic for the root README: ${result.stderr}`,
|
||
);
|
||
} finally {
|
||
cleanup(dir);
|
||
}
|
||
});
|
||
});
|
||
|
||
describe('lint-retired-runtime-name — pinned occurrences are occurrence-scoped', () => {
|
||
test('an approved line in a pinned file does NOT licence a second stale occurrence in the same file', () => {
|
||
// This is the whole point of pinning occurrences instead of allowlisting
|
||
// whole files. Under a file-level allowlist both lines below would pass
|
||
// and a genuinely new stale claim would be absorbed silently.
|
||
const dir = createTempRepo();
|
||
try {
|
||
seedFillerFiles(dir, MIN_EXPECTED_FILES);
|
||
writeFile(
|
||
dir,
|
||
'CONTEXT.md',
|
||
[
|
||
'# Context',
|
||
'',
|
||
`Session log: ${RETIRED_NAME} [runtime removed #1928] noted inline.`,
|
||
`Install ${RETIRED_NAME} CLI as a supported runtime.`,
|
||
'',
|
||
].join('\n'),
|
||
);
|
||
gitAddAll(dir);
|
||
|
||
const result = runGuard(dir);
|
||
assert.equal(result.status, 1, `expected exit 1, got ${result.status}; stdout: ${result.stdout}`);
|
||
assert.ok(
|
||
result.stderr.includes('CONTEXT.md:4:'),
|
||
`the UNAPPROVED line 4 must be reported: ${result.stderr}`,
|
||
);
|
||
assert.ok(
|
||
!result.stderr.includes('CONTEXT.md:3:'),
|
||
`the pinned line 3 must NOT be reported: ${result.stderr}`,
|
||
);
|
||
} finally {
|
||
cleanup(dir);
|
||
}
|
||
});
|
||
|
||
test('exits 0 when a pinned file carries only its approved occurrence', () => {
|
||
const dir = createTempRepo();
|
||
try {
|
||
seedFillerFiles(dir, MIN_EXPECTED_FILES);
|
||
writeFile(
|
||
dir,
|
||
'CONTEXT.md',
|
||
`# Context\n\nSession log: ${RETIRED_NAME} [runtime removed #1928] noted inline.\n`,
|
||
);
|
||
gitAddAll(dir);
|
||
|
||
const result = runGuard(dir);
|
||
assert.equal(result.status, 0, `expected exit 0, got ${result.status}; stderr: ${result.stderr}`);
|
||
} finally {
|
||
cleanup(dir);
|
||
}
|
||
});
|
||
});
|
||
|
||
describe('lint-retired-runtime-name — the allowlist cannot silently rot', () => {
|
||
test('exits 1 reporting a stale pin when an approved line no longer matches', () => {
|
||
// An unmatched pin pre-approves a future occurrence nobody reviewed, so
|
||
// it is reported rather than ignored.
|
||
const dir = createTempRepo();
|
||
try {
|
||
seedFillerFiles(dir, MIN_EXPECTED_FILES);
|
||
writeFile(dir, 'CONTEXT.md', '# Context\n\nThe annotated session log line was rewritten.\n');
|
||
gitAddAll(dir);
|
||
|
||
const result = runGuard(dir);
|
||
assert.equal(result.status, 1, `expected exit 1, got ${result.status}; stdout: ${result.stdout}`);
|
||
assert.ok(
|
||
result.stderr.includes('stale allowlist entr'),
|
||
`stderr should name the stale allowlist entry: ${result.stderr}`,
|
||
);
|
||
} finally {
|
||
cleanup(dir);
|
||
}
|
||
});
|
||
});
|
||
|
||
describe('lint-retired-runtime-name — file-level allowlist', () => {
|
||
test('exits 0 for violating content inside generated-and-locked CHANGELOG.md', () => {
|
||
const dir = createTempRepo();
|
||
try {
|
||
seedFillerFiles(dir, MIN_EXPECTED_FILES);
|
||
writeFile(
|
||
dir,
|
||
'CHANGELOG.md',
|
||
`# Changelog\n\n- Removed the sunset ${RETIRED_NAME} CLI runtime — use Antigravity instead. (#1928)\n`,
|
||
);
|
||
gitAddAll(dir);
|
||
|
||
const result = runGuard(dir);
|
||
assert.equal(result.status, 0, `expected exit 0, got ${result.status}; stderr: ${result.stderr}`);
|
||
} finally {
|
||
cleanup(dir);
|
||
}
|
||
});
|
||
});
|
||
|
||
describe('lint-retired-runtime-name — anti-vacuity floor boundaries', () => {
|
||
// CLAUDE.md requires limit-1 / limit / limit+1 coverage. The "limit" here
|
||
// is how many in-scan-set files the walk actually READ.
|
||
test(`refuses to report clean at MIN_EXPECTED_FILES-1 (${MIN_EXPECTED_FILES - 1})`, () => {
|
||
const dir = createTempRepo();
|
||
try {
|
||
seedFillerFiles(dir, MIN_EXPECTED_FILES - 1);
|
||
gitAddAll(dir);
|
||
|
||
const result = runGuard(dir);
|
||
assert.notEqual(result.status, 0, `expected non-zero exit, got ${result.status}; stdout: ${result.stdout}`);
|
||
assert.ok(
|
||
result.stderr.includes(`only ${MIN_EXPECTED_FILES - 1} file`),
|
||
`stderr should state the count it refused on: ${result.stderr}`,
|
||
);
|
||
} finally {
|
||
cleanup(dir);
|
||
}
|
||
});
|
||
|
||
test(`reports clean exactly at MIN_EXPECTED_FILES (${MIN_EXPECTED_FILES})`, () => {
|
||
const dir = createTempRepo();
|
||
try {
|
||
seedFillerFiles(dir, MIN_EXPECTED_FILES);
|
||
gitAddAll(dir);
|
||
|
||
const result = runGuard(dir);
|
||
assert.equal(result.status, 0, `expected exit 0, got ${result.status}; stderr: ${result.stderr}`);
|
||
assert.ok(
|
||
result.stdout.includes(`${MIN_EXPECTED_FILES} files scanned`),
|
||
`stdout should report the read count: ${result.stdout}`,
|
||
);
|
||
} finally {
|
||
cleanup(dir);
|
||
}
|
||
});
|
||
|
||
test(`reports clean at MIN_EXPECTED_FILES+1 (${MIN_EXPECTED_FILES + 1})`, () => {
|
||
const dir = createTempRepo();
|
||
try {
|
||
seedFillerFiles(dir, MIN_EXPECTED_FILES + 1);
|
||
gitAddAll(dir);
|
||
|
||
const result = runGuard(dir);
|
||
assert.equal(result.status, 0, `expected exit 0, got ${result.status}; stderr: ${result.stderr}`);
|
||
} finally {
|
||
cleanup(dir);
|
||
}
|
||
});
|
||
});
|
||
|
||
describe('lint-retired-runtime-name — the runtime-word veto is multilingual', () => {
|
||
test('exits 1 when a Japanese runtime word accompanies a model-display version', () => {
|
||
// The model-display SHAPE matches here (" 2.5 Pro"), so this is a real
|
||
// test of the veto rather than of the shape rule failing to match.
|
||
const dir = createTempRepo();
|
||
try {
|
||
seedFillerFiles(dir, MIN_EXPECTED_FILES);
|
||
writeFile(
|
||
dir,
|
||
'docs/ja-JP/guides/runtimes.md',
|
||
`# ランタイム\n\n${RETIRED_NAME} 2.5 Pro をランタイムとして使用します。\n`,
|
||
);
|
||
gitAddAll(dir);
|
||
|
||
const result = runGuard(dir);
|
||
assert.equal(result.status, 1, `expected exit 1, got ${result.status}; stdout: ${result.stdout}`);
|
||
} finally {
|
||
cleanup(dir);
|
||
}
|
||
});
|
||
|
||
test('exits 0 when "client" appears — the veto is word-anchored, so CLI must not match inside it', () => {
|
||
// Without \b anchors, the case-insensitive "CLI" term matched inside
|
||
// "client"/"clip", vetoing legitimate model lists.
|
||
const dir = createTempRepo();
|
||
try {
|
||
seedFillerFiles(dir, MIN_EXPECTED_FILES);
|
||
writeFile(
|
||
dir,
|
||
'docs/reference/client-models.md',
|
||
`# Models\n\nThe client library supports these models: (o3, ${RETIRED_NAME} 2.5 Pro).\n`,
|
||
);
|
||
gitAddAll(dir);
|
||
|
||
const result = runGuard(dir);
|
||
assert.equal(result.status, 0, `expected exit 0, got ${result.status}; stderr: ${result.stderr}`);
|
||
} finally {
|
||
cleanup(dir);
|
||
}
|
||
});
|
||
});
|
||
|
||
describe('lint-retired-runtime-name — model display across locale punctuation', () => {
|
||
test('exits 0 for full-width digits and CJK punctuation', () => {
|
||
const dir = createTempRepo();
|
||
try {
|
||
seedFillerFiles(dir, MIN_EXPECTED_FILES);
|
||
writeFile(
|
||
dir,
|
||
'docs/zh-CN/reference/models.md',
|
||
`# 模型\n\n思考类模型(o3、o4-mini、${RETIRED_NAME} 2.5 Pro)。\n`
|
||
+ `另见 ${RETIRED_NAME} 3、以及其他模型。\n`,
|
||
);
|
||
gitAddAll(dir);
|
||
|
||
const result = runGuard(dir);
|
||
assert.equal(result.status, 0, `expected exit 0, got ${result.status}; stderr: ${result.stderr}`);
|
||
} finally {
|
||
cleanup(dir);
|
||
}
|
||
});
|
||
});
|
||
|
||
describe('lint-retired-runtime-name — dialect marker may PRECEDE the name', () => {
|
||
test('exits 0 for the Portuguese word order ("no estilo Gemini")', () => {
|
||
// Measured, not assumed: pt-BR puts the qualifier before the name, so a
|
||
// suffix-only dialect rule cannot express this locale at all.
|
||
const dir = createTempRepo();
|
||
try {
|
||
seedFillerFiles(dir, MIN_EXPECTED_FILES);
|
||
writeFile(
|
||
dir,
|
||
'docs/pt-BR/guides/hooks.md',
|
||
`# Hooks\n\nEntradas de hook no estilo ${RETIRED_NAME} quando instalado pelo GSD.\n`,
|
||
);
|
||
gitAddAll(dir);
|
||
|
||
const result = runGuard(dir);
|
||
assert.equal(result.status, 0, `expected exit 0, got ${result.status}; stderr: ${result.stderr}`);
|
||
} finally {
|
||
cleanup(dir);
|
||
}
|
||
});
|
||
|
||
test('exits 1 when a dialect word is present but the name is still followed by a runtime word', () => {
|
||
// "compatível com <name> CLI" is a runtime claim wearing a dialect word,
|
||
// so the dialect exemption is refused when a runtime word sits
|
||
// immediately after the name.
|
||
const dir = createTempRepo();
|
||
try {
|
||
seedFillerFiles(dir, MIN_EXPECTED_FILES);
|
||
writeFile(
|
||
dir,
|
||
'docs/pt-BR/guides/policy.md',
|
||
`# Politica\n\nUsa a politica compatível com ${RETIRED_NAME} CLI e mais.\n`,
|
||
);
|
||
gitAddAll(dir);
|
||
|
||
const result = runGuard(dir);
|
||
assert.equal(result.status, 1, `expected exit 1, got ${result.status}; stdout: ${result.stdout}`);
|
||
assert.ok(
|
||
result.stderr.includes('docs/pt-BR/guides/policy.md:3:'),
|
||
`stderr should carry a path:line diagnostic: ${result.stderr}`,
|
||
);
|
||
} finally {
|
||
cleanup(dir);
|
||
}
|
||
});
|
||
});
|
||
|
||
describe('lint-retired-runtime-name — a dialect marker does not survive a runtime word', () => {
|
||
// Reviewer finding (BLOCKER): the dialect exemption originally applied only
|
||
// an "immediately after the name" veto, while the model rule applied its
|
||
// veto line-globally. A dialect marker anywhere in a +/-24-char window then
|
||
// excused an occurrence on a line that literally asserted a live runtime.
|
||
const CASES = [
|
||
['pt dialect word plus the literal "runtime"', 'docs/pt-BR/guides/a3.md',
|
||
`Suportamos ${RETIRED_NAME}, no estilo padrao, como runtime de instalacao.`],
|
||
['zh dialect word plus 運行時', 'docs/zh-CN/guides/a4.md',
|
||
`${RETIRED_NAME} 兼容,并且是受支持的运行时之一。`],
|
||
['a non-adjacent "style" that is not a dialect reference at all', 'docs/guides/a2.md',
|
||
`${RETIRED_NAME} is style-agnostic and fully supported by the installer.`],
|
||
];
|
||
|
||
for (const [label, relPath, body] of CASES) {
|
||
test(`exits 1 — ${label}`, () => {
|
||
const dir = createTempRepo();
|
||
try {
|
||
seedFillerFiles(dir, MIN_EXPECTED_FILES);
|
||
writeFile(dir, relPath, `# t\n\n${body}\n`);
|
||
gitAddAll(dir);
|
||
|
||
const result = runGuard(dir);
|
||
assert.equal(result.status, 1, `expected exit 1, got ${result.status}; stdout: ${result.stdout}`);
|
||
assert.ok(
|
||
result.stderr.includes(`${relPath}:3:`),
|
||
`stderr should carry a path:line diagnostic: ${result.stderr}`,
|
||
);
|
||
} finally {
|
||
cleanup(dir);
|
||
}
|
||
});
|
||
}
|
||
});
|
||
|
||
describe('lint-retired-runtime-name — one legitimate occurrence does not license the next', () => {
|
||
test('exits 1 when a dialect reference and a fresh live claim share a line', () => {
|
||
// Reviewer finding (BLOCKER): with a +/-24-char window,
|
||
// `| Antigravity | Gemini-style hooks | Gemini support is live |` exited 0
|
||
// — the second occurrence sat 21 chars from `style`. This is the exact
|
||
// locale-table row shape the window was tuned for, so it was the most
|
||
// likely real-world regression vector.
|
||
const dir = createTempRepo();
|
||
try {
|
||
seedFillerFiles(dir, MIN_EXPECTED_FILES);
|
||
writeFile(
|
||
dir,
|
||
'docs/guides/a1.md',
|
||
`# t\n\n| Antigravity | ${RETIRED_NAME}-style hooks | ${RETIRED_NAME} support is live |\n`,
|
||
);
|
||
gitAddAll(dir);
|
||
|
||
const result = runGuard(dir);
|
||
assert.equal(result.status, 1, `expected exit 1, got ${result.status}; stdout: ${result.stdout}`);
|
||
assert.ok(
|
||
result.stderr.includes('docs/guides/a1.md:3:'),
|
||
`stderr should carry a path:line diagnostic: ${result.stderr}`,
|
||
);
|
||
} finally {
|
||
cleanup(dir);
|
||
}
|
||
});
|
||
});
|
||
|
||
describe('lint-retired-runtime-name — a version number never launders a claim', () => {
|
||
// Reviewer finding (MAJOR): the model-display escape accepted
|
||
// <version><punctuation> and <version><EOL> whenever no RUNTIME_WORDS term
|
||
// happened to appear, so five unqualified live-runtime claims exited 0.
|
||
// "Absence of a veto word" is not evidence: the rule now requires POSITIVE
|
||
// model-axis evidence, which inverts the failure direction from silently
|
||
// allowing to flagging.
|
||
const CASES = [
|
||
['a version ending the sentence', 'docs/guides/b1.md',
|
||
`The installer now offers ${RETIRED_NAME} 3.`],
|
||
['a version inside a runtime list', 'docs/guides/b2.md',
|
||
`GSD installs cleanly on ${RETIRED_NAME} 3, Kimi, and Codex.`],
|
||
['a version in parentheses', 'docs/guides/b3.md',
|
||
`Pick your coding tool (${RETIRED_NAME} 3) during setup.`],
|
||
['a "plugins" list — "plugin" is not a runtime word', 'docs/guides/c3.md',
|
||
`Supported plugins: Claude Code, Codex, ${RETIRED_NAME} 3.`],
|
||
['an "agents" list — "agent" is deliberately not a runtime word', 'docs/guides/c4.md',
|
||
`Supported agents include ${RETIRED_NAME} 3, Kimi, and Cursor.`],
|
||
];
|
||
|
||
for (const [label, relPath, body] of CASES) {
|
||
test(`exits 1 — ${label}`, () => {
|
||
const dir = createTempRepo();
|
||
try {
|
||
seedFillerFiles(dir, MIN_EXPECTED_FILES);
|
||
writeFile(dir, relPath, `# t\n\n${body}\n`);
|
||
gitAddAll(dir);
|
||
|
||
const result = runGuard(dir);
|
||
assert.equal(result.status, 1, `expected exit 1, got ${result.status}; stdout: ${result.stdout}`);
|
||
assert.ok(
|
||
result.stderr.includes(`${relPath}:3:`),
|
||
`stderr should carry a path:line diagnostic: ${result.stderr}`,
|
||
);
|
||
} finally {
|
||
cleanup(dir);
|
||
}
|
||
});
|
||
}
|
||
});
|
||
|
||
describe('lint-retired-runtime-name — pins are span-scoped, not line-scoped', () => {
|
||
// Reviewer finding (MAJOR): with line-level containment, a short snippet
|
||
// anywhere on a line pre-approved a brand-new claim on that same line.
|
||
// A pin now only ever excuses the occurrence its own text covers.
|
||
test('exits 1 when a new claim shares a line with a short pinned snippet', () => {
|
||
const dir = createTempRepo();
|
||
try {
|
||
seedFillerFiles(dir, MIN_EXPECTED_FILES);
|
||
writeFile(
|
||
dir,
|
||
'gsd-core/workflows/settings-advanced.md',
|
||
`# t\n\nKnown provider menu update: ${RETIRED_NAME} CLI is once again a selectable GSD runtime.\n`,
|
||
);
|
||
gitAddAll(dir);
|
||
|
||
const result = runGuard(dir);
|
||
assert.equal(result.status, 1, `expected exit 1, got ${result.status}; stdout: ${result.stdout}`);
|
||
} finally {
|
||
cleanup(dir);
|
||
}
|
||
});
|
||
|
||
test('exits 1 when a parenthetical provider pin shares a line with a new claim', () => {
|
||
const dir = createTempRepo();
|
||
try {
|
||
seedFillerFiles(dir, MIN_EXPECTED_FILES);
|
||
writeFile(
|
||
dir,
|
||
'agents/gsd-framework-selector.md',
|
||
`# t\n\nInstall target: Google (${RETIRED_NAME}) — choose ${RETIRED_NAME} CLI as your GSD runtime.\n`,
|
||
);
|
||
gitAddAll(dir);
|
||
|
||
const result = runGuard(dir);
|
||
assert.equal(result.status, 1, `expected exit 1, got ${result.status}; stdout: ${result.stdout}`);
|
||
} finally {
|
||
cleanup(dir);
|
||
}
|
||
});
|
||
|
||
test('exits 0 when every occurrence falls inside a pinned span', () => {
|
||
const dir = createTempRepo();
|
||
try {
|
||
seedFillerFiles(dir, MIN_EXPECTED_FILES);
|
||
writeFile(
|
||
dir,
|
||
'agents/gsd-framework-selector.md',
|
||
`# t\n\n{ label: "Google (${RETIRED_NAME})", description: "Committed to ${RETIRED_NAME} / Google Cloud / Vertex AI" },\n`,
|
||
);
|
||
gitAddAll(dir);
|
||
|
||
const result = runGuard(dir);
|
||
assert.equal(result.status, 0, `expected exit 0, got ${result.status}; stderr: ${result.stderr}`);
|
||
} finally {
|
||
cleanup(dir);
|
||
}
|
||
});
|
||
|
||
test('exits 1 for a new claim added to a fully-pinned file', () => {
|
||
const dir = createTempRepo();
|
||
try {
|
||
seedFillerFiles(dir, MIN_EXPECTED_FILES);
|
||
writeFile(
|
||
dir,
|
||
'agents/gsd-framework-selector.md',
|
||
`# t\n\n{ label: "Google (${RETIRED_NAME})", description: "Committed to ${RETIRED_NAME} / Google Cloud / Vertex AI" },\n`
|
||
+ `Install target: choose ${RETIRED_NAME} CLI as your GSD runtime.\n`,
|
||
);
|
||
gitAddAll(dir);
|
||
|
||
const result = runGuard(dir);
|
||
assert.equal(result.status, 1, `expected exit 1, got ${result.status}; stdout: ${result.stdout}`);
|
||
assert.ok(
|
||
result.stderr.includes('agents/gsd-framework-selector.md:4:'),
|
||
`the NEW line 4 must be reported: ${result.stderr}`,
|
||
);
|
||
} finally {
|
||
cleanup(dir);
|
||
}
|
||
});
|
||
});
|
||
|
||
describe('lint-retired-runtime-name — the stale-pin report must never be false', () => {
|
||
test('does not report a pin stale when its line is present but excused by another rule', () => {
|
||
// Reviewer finding (MAJOR): `usedPins` was recorded only on the Tier-2
|
||
// branch, and the general rules run first — so a pinned line that a
|
||
// general rule also matched never marked its pin used, producing a
|
||
// provably false "no line matches pinned snippet" whose printed remedy
|
||
// told the maintainer to delete a still-needed pin.
|
||
const dir = createTempRepo();
|
||
try {
|
||
seedFillerFiles(dir, MIN_EXPECTED_FILES);
|
||
writeFile(
|
||
dir,
|
||
'CONTEXT.md',
|
||
`# C\n\n${RETIRED_NAME}-style dialect, and ${RETIRED_NAME} [runtime removed #1928] in the log.\n`,
|
||
);
|
||
gitAddAll(dir);
|
||
|
||
const result = runGuard(dir);
|
||
assert.ok(
|
||
!result.stderr.includes('stale allowlist'),
|
||
`the pin IS present on that line, so no stale report may be emitted: ${result.stderr}`,
|
||
);
|
||
// Guard against a vacuous pass: the run must actually have flagged the
|
||
// unpinned dialect occurrence, not skipped the file.
|
||
assert.ok(
|
||
result.stderr.includes('CONTEXT.md:3:'),
|
||
`expected the unpinned occurrence to be flagged: ${result.stderr}`,
|
||
);
|
||
} finally {
|
||
cleanup(dir);
|
||
}
|
||
});
|
||
|
||
test('still reports a genuinely stale pin', () => {
|
||
const dir = createTempRepo();
|
||
try {
|
||
seedFillerFiles(dir, MIN_EXPECTED_FILES);
|
||
writeFile(dir, 'CONTEXT.md', '# C\n\nThe annotated session log line was rewritten.\n');
|
||
gitAddAll(dir);
|
||
|
||
const result = runGuard(dir);
|
||
assert.equal(result.status, 1, `expected exit 1, got ${result.status}; stdout: ${result.stdout}`);
|
||
assert.ok(
|
||
result.stderr.includes('stale allowlist entr'),
|
||
`stderr should name the stale allowlist entry: ${result.stderr}`,
|
||
);
|
||
} finally {
|
||
cleanup(dir);
|
||
}
|
||
});
|
||
});
|
||
|
||
describe('lint-retired-runtime-name — the escape hatch must carry a reason', () => {
|
||
test('exits 1 for a bare marker with no justification', () => {
|
||
const dir = createTempRepo();
|
||
try {
|
||
seedFillerFiles(dir, MIN_EXPECTED_FILES);
|
||
writeFile(
|
||
dir,
|
||
'docs/guides/d1.md',
|
||
`# t\n\n${RETIRED_NAME} CLI is a fully supported GSD runtime. <!-- gsd-allow-retired-runtime-name -->\n`,
|
||
);
|
||
gitAddAll(dir);
|
||
|
||
const result = runGuard(dir);
|
||
assert.equal(result.status, 1, `expected exit 1, got ${result.status}; stdout: ${result.stdout}`);
|
||
} finally {
|
||
cleanup(dir);
|
||
}
|
||
});
|
||
});
|
||
|
||
describe('lint-retired-runtime-name — .changeset/ shares CHANGELOG.md\'s tier', () => {
|
||
test('exits 0 for a changeset fragment describing the retirement', () => {
|
||
const dir = createTempRepo();
|
||
try {
|
||
seedFillerFiles(dir, MIN_EXPECTED_FILES);
|
||
writeFile(
|
||
dir,
|
||
'.changeset/foo.md',
|
||
`---\ntype: Fixed\npr: 0\n---\n**Retired the ${RETIRED_NAME} CLI reviewer lane** — Google stopped serving it.\n`,
|
||
);
|
||
gitAddAll(dir);
|
||
|
||
const result = runGuard(dir);
|
||
assert.equal(result.status, 0, `expected exit 0, got ${result.status}; stderr: ${result.stderr}`);
|
||
} finally {
|
||
cleanup(dir);
|
||
}
|
||
});
|
||
});
|