From 71aeb860791709b3011d692b1683e09394c5daaa Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 9 Sep 2026 01:20:06 +0300 Subject: [PATCH] test: check-docs mutant guard judges docs, not screenshot freshness MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Run 2793 (changed_mutants 2/3): the clean run of `resource-docs-flatten-current-yaml` was red before any mutation because the screenshot fingerprint is stale after #490 — strict mode, which #479 reserves for the beta candidate. The guard now runs `--screenshots=warn`; a test keeps every check-docs guard in that mode. Issue: #496 User-Visible: no --- scripts/mutation-gate.mjs | 5 ++++- test/mutation-gate.test.mjs | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/scripts/mutation-gate.mjs b/scripts/mutation-gate.mjs index 5c16aeb6..07425c9f 100644 --- a/scripts/mutation-gate.mjs +++ b/scripts/mutation-gate.mjs @@ -559,7 +559,10 @@ const MUTANT_DEFINITIONS = [ }, { id: 'resource-docs-flatten-current-yaml', - guard: 'node scripts/check-docs.mjs', + // Свежесть скриншотов — предупреждение (#479): мутант проверяет YAML-сниппет + // README, а не отпечаток кадров; строгий режим красил чистый прогон на любом + // src-диффе без пересъёмки (run 2793, #496). + guard: 'node scripts/check-docs.mjs --screenshots=warn', because: 'the supported HA 2026.2+ resource snippet must stay nested under lovelace; ' + 'a plausible-looking top-level resources block is the user-facing defect from #462 AC1', patches: [{ diff --git a/test/mutation-gate.test.mjs b/test/mutation-gate.test.mjs index 57889347..6d6b79c1 100644 --- a/test/mutation-gate.test.mjs +++ b/test/mutation-gate.test.mjs @@ -551,3 +551,12 @@ test('#492 §6.4: реестр базы читается из git без поб const leftovers = (await import('node:fs')).readdirSync(join(repoRoot, 'scripts')).filter((f) => f.startsWith('.mutation-gate.base-')); assert.deepEqual(leftovers, [], 'временный модуль удалён'); }); + +// #496 (run 2793): гвард на check-docs в строгом режиме красил ЧИСТЫЙ прогон на +// любом src-диффе без пересъёмки скриншотов — свежесть кадров с #479 судится на +// кандидате, а мутант проверяет содержимое документации. +test('#496: гварды check-docs не требуют свежих скриншотов', () => { + const strict = MUTANTS.filter((m) => /check-docs\.mjs/.test(m.guard) && !/--screenshots=warn/.test(m.guard)); + assert.deepEqual(strict.map((m) => m.id), []); + assert.ok(MUTANTS.some((m) => /check-docs\.mjs --screenshots=warn/.test(m.guard)), 'хотя бы один гвард check-docs есть'); +});