fix(import): remap vacuum routes to copied space (#611)

Repair both incoming routes and safe target-reference recovery, with backend
and mutation coverage for foreign and same-instance imports.

Issue: #611
User-Visible: yes
This commit is contained in:
Claude
2026-09-23 04:40:52 +03:00
parent 2a21ff65d4
commit 9f82960c2c
5 changed files with 208 additions and 0 deletions
+24
View File
@@ -5620,6 +5620,30 @@ const MUTANT_DEFINITIONS = [
replace: '**({"plan_only": plan_only}),',
}],
},
{
id: 'space-import-keeps-incoming-vacuum-route-space',
guard: 'node scripts/backend-test-guard.mjs issue_611_incoming_route_follows_fresh_space',
because: 'a copied vacuum route must follow the fresh space id on both foreign and '
+ 'same-instance imports instead of failing validation or silently targeting the source floor',
patches: [{
file: 'custom_components/houseplan/import_export.py',
find: ' route["space"] = new_space_id\n'
+ ' _report_remap(',
replace: ' route["space"] = old_space_id # mutant: keep source floor\n'
+ ' _report_remap(',
}],
},
{
id: 'space-import-keeps-target-vacuum-route-space',
guard: 'node scripts/backend-test-guard.mjs issue_611_target_route_follows_safe_space_repair',
because: 'the second-pass target repair must apply its proven exact/lineage space mapping to '
+ 'vacuum routes as well as marker.space',
patches: [{
file: 'custom_components/houseplan/import_export.py',
find: ' route["space"] = mapped\n',
replace: ' route["space"] = route.get("space") # mutant: ignore mapping\n',
}],
},
{
id: 'plan-only-revalidate-flag-dropped',
guard: 'node scripts/backend-test-guard.mjs plan_only_export_projects',