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
+5 -4
View File
@@ -9,6 +9,8 @@ import {
lowerCounts,
readBaseline,
readText,
reportStale,
staleCounts,
TEST_FILE,
toKey,
writeBaseline,
@@ -139,12 +141,11 @@ export function check({
if (grown.length) {
error('Fix the test, delete it if its feature is gone, or use skipIf/runIf when it depends on the environment.');
}
const lowerable = Object.entries(baseline).filter(([key, n]) => (counts[key] ?? 0) < n);
if (lowerable.length && !update)
log(`${lowerable.length} file(s) skip fewer tests than the baseline: run with --update to lower it.`);
const stale = staleCounts(baseline, counts);
reportStale(stale, { file: 'skip-baseline.json', command: 'lint:skips', root, error });
const sum = (map) => Object.values(map).reduce((a, b) => a + b, 0);
log(
`skips: ${sum(counts)} skipped or todo test(s), baseline allows ${sum(baseline)}; ${Object.keys(only).length} file(s) with .only`
);
return grown.length || Object.keys(only).length ? 1 : 0;
return grown.length || stale.length || Object.keys(only).length ? 1 : 0;
}