fix: resume vacuum trails after short stops

Issue: #205
User-Visible: yes
This commit is contained in:
Sergey Matyunin
2026-08-19 20:55:38 +03:00
parent d31ad3c562
commit 56e01148f8
12 changed files with 258 additions and 10 deletions
+11
View File
@@ -488,6 +488,17 @@ export const MUTANTS = [
+ " show_names: d.source === 'draw' && d.mode === 'create' ? true : d.showNames,",
}],
},
{
id: 'vacuum-trail-resume-disabled',
guard: 'node scripts/trail-resume-test-guard.mjs',
because: 'an ended same-map run inside the accepted 30-minute window must reopen instead '
+ 'of rotating into previous; focused pure and recorder sequences must reject the old unconditional split',
patches: [{
file: 'custom_components/houseplan/trails.py',
find: ' resumed = bool(cur and can_resume_trail_run(cur, map_id, now))',
replace: ' resumed = False',
}],
},
];
// --- механика ---------------------------------------------------------------
+22
View File
@@ -0,0 +1,22 @@
#!/usr/bin/env node
import { spawnSync } from 'node:child_process';
import { existsSync } from 'node:fs';
import { join } from 'node:path';
const localPython = process.platform === 'win32'
? join(process.cwd(), '.venv', 'Scripts', 'python.exe')
: join(process.cwd(), '.venv', 'bin', 'python');
const python = process.env.PYTHON
|| (existsSync(localPython) ? localPython : (process.platform === 'win32' ? 'python' : 'python3'));
const result = spawnSync(python, [
'-m', 'pytest',
'tests_backend/test_trails.py',
'tests_backend/test_trail_recorder.py',
'-q', '-k', 'resume or short_available',
], { stdio: 'inherit' });
if (result.error) {
console.error(`trail resume guard could not start ${python}: ${result.error.message}`);
process.exit(2);
}
process.exit(result.status ?? 2);