Fix atomic model-v8 draft writes

Issue: #314
User-Visible: yes
This commit is contained in:
Matysh
2026-08-26 09:13:50 +03:00
parent 5da7812099
commit 2347e8df88
16 changed files with 657 additions and 198 deletions
+15
View File
@@ -8,6 +8,7 @@ import {
commitWallSegmentModel,
deterministicWallSegmentId,
fixedTopologyWallLineageHints,
sanitizeRoomDraftPath,
wallModelOffGridValueCount,
WallSegmentModelError,
WALL_SEGMENT_MODEL_VERSION,
@@ -215,6 +216,20 @@ test('draft segment ids materialise once and remain stable', () => {
);
});
test('draft sanitation drops only the segment carried by a duplicate point', () => {
const draft = sanitizeRoomDraftPath({
points: [[0, 0], [0, 0], [1, 0], [1, 0], [1, 1]],
segments: [
{ id: 'zero-a', cm: 11 }, { id: 'edge-a', cm: 21 },
{ id: 'zero-b', cm: 12 }, { id: 'edge-b', cm: 22 },
],
});
assert.deepEqual(draft.points, [[0, 0], [1, 0], [1, 1]]);
assert.deepEqual(draft.segments, [
{ id: 'edge-a', cm: 21 }, { id: 'edge-b', cm: 22 },
]);
});
test('post-v8 atoms use fresh identity while promoted draft carriers keep theirs', () => {
const base = commitWallSegmentModel(configOf({
id: 'floor', title: 'Floor', rooms: [rectangle('room')],