fix: scope near-axis resize validation

Keep unrelated pre-existing near-axis edges from disabling exact Resize handles, make tracked single-space fixtures visible to the invariants CLI, and add the three missing mutation gates plus real-plan coverage.

Issue: #290
User-Visible: no
This commit is contained in:
Sergey Matyunin
2026-08-24 16:30:25 +03:00
parent edf8b068ed
commit f6cf2c93ae
8 changed files with 398 additions and 302 deletions
+5 -2
View File
@@ -516,10 +516,13 @@ export function checkMixedRoleRecords(config) {
return violations;
}
/** Разобрать любой из трёх форматов, в которых приходит конфигурация. */
/** Разобрать runtime-ответы, сырой config и tracked single-space fixtures. */
export function readModel(text) {
const parsed = JSON.parse(text);
const config = parsed?.payload?.config ?? parsed?.result?.config ?? parsed?.config ?? parsed;
const source = parsed?.payload?.config ?? parsed?.result?.config ?? parsed?.config ?? parsed;
const config = !Array.isArray(source?.spaces) && parsed?.space
? { spaces: [parsed.space] }
: source;
const layout = parsed?.payload?.layout ?? parsed?.result?.layout ?? parsed?.layout ?? {};
return { config, layout };
}
+36
View File
@@ -975,6 +975,42 @@ export const MUTANTS = [
replace: ' const point = snapped;',
}],
},
{
id: 'near-axis-shared-owner-repair-partial',
guard: 'npx tsc -p tsconfig.test.json && node scripts/fix-test-build.mjs '
+ '&& node --test --test-name-pattern="#290 repairs a duplicated" test/near-axis.test.mjs',
because: 'a shared physical wall must move every coincident room-owner copy atomically (#290)',
patches: [{
file: 'src/near-axis.ts',
find: 'const replaceRoomPoints = (rooms: any[], move: EndpointMove): any[] => rooms.map((room) => {',
replace: 'const replaceRoomPoints = (rooms: any[], move: EndpointMove): any[] => rooms.map((room, index) => {\n'
+ ' if (index > 0) return room;',
}],
},
{
id: 'near-axis-shared-owner-double-counted',
guard: 'npx tsc -p tsconfig.test.json && node scripts/fix-test-build.mjs '
+ '&& node --test --test-name-pattern="#290 repairs a duplicated" test/near-axis.test.mjs',
because: 'coincident room-owner copies are one physical wall in the Optimize report (#290)',
patches: [{
file: 'src/near-axis.ts',
find: ' const key = segmentKey(a, b);',
replace: ' const key = `${segmentKey(a, b)}:${candidates.size}`;',
}],
},
{
id: 'near-axis-optimize-confirmation-bypassed',
guard: 'npm run bundle:sync && node demo/smoke_near_axis_optimize.mjs',
because: 'opening the Optimize preview or cancelling it must never persist a lossy repair (#290)',
patches: [{
file: 'src/houseplan-card.ts',
find: ' private _openAlignDialog = (): void => this._previewAlignDialog(false);',
replace: ' private _openAlignDialog = (): void => {\n'
+ ' this._previewAlignDialog(false);\n'
+ ' void this._runAlignToGrid();\n'
+ ' };',
}],
},
{
id: 'optimizer-micro-interval-cleanup-disabled',
guard: 'npx tsc -p tsconfig.test.json && node scripts/fix-test-build.mjs '