fix: protect View config recovery (#612)

Issue: #612
User-Visible: yes
This commit is contained in:
Claude
2026-09-23 10:34:09 +03:00
parent 78698a075a
commit 2cfb6d2169
51 changed files with 569 additions and 446 deletions
+24
View File
@@ -72,6 +72,30 @@ function relocateEditorPatch(patch, cardSource, editorSource) {
// `find` обязан встречаться в файле ровно один раз: патч, который ложится «куда
// попало», проверяет не то, что объявлен проверять. Это контролирует --check.
const MUTANT_DEFINITIONS = [
{
id: 'view-conflict-requires-editor-runtime',
guard: 'node --test test/config-write-conflict.test.mjs',
because: '#612 AC1: View legitimately has no editor runtime, but its background config writes '
+ 'can still conflict. Requiring the editor restores the unhandled exception and prevents the '
+ 'authoritative reload.',
patches: [{
file: 'src/config-write-conflict.ts',
find: ' editorRuntime?._cancelPath();\n void reload();',
replace: ' editorRuntime!._cancelPath(); // mutant: View has no runtime\n void reload();',
}],
},
{
id: 'readonly-view-syncs-new-devices',
guard: 'node demo/smoke_readonly_cold_start.mjs',
because: '#612 AC2: a read-only household or kiosk View must never attempt the shared '
+ 'known_devices write. Removing the authority guard restores the unauthorized toast for '
+ 'every newly discovered HA device.',
patches: [{
file: 'src/houseplan-card.ts',
find: ' if (!this._norm || !this._loadOk || !this._serverCfg || !this._canEdit) return;',
replace: ' if (!this._norm || !this._loadOk || !this._serverCfg) return; // mutant: ignore write authority',
}],
},
{
id: 'discard-confirm-action-icon-falls-back-to-lock',
guard: 'node demo/smoke_discard_copy.mjs',