fix: the room_wall_ids invariant applies to model v8 and later again (#316, review r4 H1)

The r3-M1 fix was applied as a mechanical substring replacement and flipped
BOTH model_version conditions in the file; the independent room_wall_ids
invariant (#244/#252) silently stopped checking every v9+ document. Only the
opening_host requirement is scoped to model v8 — room_wall_ids is back to
'v8 and every later version', now pinned by its first regression test
(phantom wall_ids reported on v9 and v8; executed red on the broken
comparison, green after the fix).

Issue: #316
User-Visible: no
This commit is contained in:
Codex
2026-08-27 00:21:23 +03:00
parent 05ec0a1de8
commit 1c598a287a
2 changed files with 31 additions and 1 deletions
+1 -1
View File
@@ -225,7 +225,7 @@ export function checkReferences({ config, layout = {} } = {}, { notes = [] } = {
'комнаты назначения не существует в том же пространстве');
}
}
if (Number(config?.model_version || 0) === 8) {
if (Number(config?.model_version || 0) >= 8) {
const wallIds = Array.isArray(room?.wall_ids) ? room.wall_ids : [];
const poly = roomPolygon(room) || [];
if (wallIds.length !== poly.length) {
+30
View File
@@ -715,3 +715,33 @@ test('#316: непривязанный контурный проём — вал
'model v8 still requires an explicit host on every opening',
);
});
test('#316 r4: room_wall_ids проверяется и в v9 — фантомные ссылки ловятся', () => {
// CODE-REVIEW-316-r4 H1: правка условия opening_host не имеет права трогать
// независимый инвариант room_wall_ids (#244/#252) — он действует для v8 и
// всех последующих версий модели.
const m = {
config: {
model_version: 9,
spaces: [{
id: 'sp316b', title: 'S', view_box: [0, 0, 1, 1],
rooms: [{
id: 'r', name: 'R', area: null,
poly: [[0.1, 0.1], [0.5, 0.1], [0.5, 0.4], [0.1, 0.4]],
wall_ids: ['wall-ghost-1', 'wall-ghost-2', 'wall-ghost-3', 'wall-ghost-4'],
}],
wall_segments: [],
}],
markers: [], settings: {},
},
layout: {},
};
const kinds = checkReferences(m).filter((item) => item.kind === 'room_wall_ids');
assert.ok(kinds.length >= 1, 'phantom wall_ids must be reported on model v9');
const v8 = structuredClone(m);
v8.config.model_version = 8;
assert.ok(
checkReferences(v8).filter((item) => item.kind === 'room_wall_ids').length >= 1,
'and stay reported on model v8',
);
});