ci(client): fail the count ratchets on an entry above the tree

lint:size, lint:layers, lint:rtl (both baselines), lint:skips and
lint:warnings only failed a count that passed its entry. A count that
fell below its entry was logged and nothing more, so a file that shrank
could grow back to its old entry unseen, and the entry of a deleted
file stayed behind for the next file at that path. lint:format and
lint:offline already fail on such a stale entry, and the docs said
these counts may only shrink.

Each of them now fails on an entry that lowerCounts would lower or
drop, naming its count or saying the file is gone, and tells to run
--update, which still only lowers. staleCounts and reportStale in
lib/ratchet.mjs hold the shared part. Every baseline matches the tree
today, so none needed lowering. The client CLAUDE.md says so, and that
CI lints through lint:warnings rather than lint:check.
This commit is contained in:
Maurice
2026-10-08 13:56:19 +02:00
parent 4344dbe923
commit bd267c67f8
18 changed files with 210 additions and 37 deletions
@@ -120,6 +120,17 @@ describe('lint:layers', () => {
expect(JSON.parse(readFileSync(tree.path(BASELINE), 'utf8'))).toEqual({ 'src/components/A.tsx': 1 });
});
it('LAYERS-008: fails an entry above the imports a file holds, or for a file that is gone, until --update', () => {
const files = { 'src/components/A.tsx': "import { m } from '../pages/x/model'\n" };
expect(run({ 'src/components/A.tsx': 2, 'src/components/Gone.tsx': 1 }, files)).toBe(1);
const out = tree.error.join('\n');
expect(out).toMatch(/src\/components\/A\.tsx is held at 2 in scripts\/layers-baseline\.json, but there are 1 now/);
expect(out).toMatch(/src\/components\/Gone\.tsx is held at 1 .*but the file is gone/);
expect(out).toMatch(/npm run lint:layers -- --update/);
tree.remove();
expect(run({ 'src/components/A.tsx': 2, 'src/components/Gone.tsx': 1 }, files, true)).toBe(0);
});
it('LAYERS-007: help/ and vacay/ are helpers and import no view', () => {
for (const helper of ['help', 'vacay']) {
expect(RULES[helper as keyof typeof RULES]).toEqual(