From 77e17922a222da439d2c5d07f37106bdaf6691da Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Sat, 14 Nov 2026 12:39:28 +0100 Subject: [PATCH] :paperclip: Compare bools by their flags and segments in design snapshots A bool shows its segments. Its transform and the order of its corners say nothing its flags and segments do not: sync orients its children from its turn and flips, and fitting it resets its transform. A turned bool in a flipped board could store a transform that does not mirror, or its corners in another order, depending on which step last fitted it. Design snapshots now leave its transform out and take its corners in any order. Harness only; the benchmark is not run. AI-assisted-by: claude-opus-5-5 --- common/src/app/common/test_helpers/composable/oracle.cljc | 5 +++++ common/test/common_tests/logic/composable_gen_test.cljc | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/common/src/app/common/test_helpers/composable/oracle.cljc b/common/src/app/common/test_helpers/composable/oracle.cljc index b8e3ad4a5b..464bc78e7f 100644 --- a/common/src/app/common/test_helpers/composable/oracle.cljc +++ b/common/src/app/common/test_helpers/composable/oracle.cljc @@ -259,6 +259,11 @@ (as-> snapshot (cond-> (dissoc snapshot :transform :transform-inverse) (#{:fill :auto} (:layout-item-h-sizing shape)) (dissoc :width) (#{:fill :auto} (:layout-item-v-sizing shape)) (dissoc :height)))) + ;; a bool shows its segments; its transform and the order of + ;; its corners say nothing its flags and segments do not + (cond-> (= :bool (:type shape)) + (-> (dissoc :transform :transform-inverse) + (d/update-when :points geom/ordered-corners))) ;; no fills or strokes show as an empty list or none at all (update :fills #(or % [])) (update :strokes #(or % [])) diff --git a/common/test/common_tests/logic/composable_gen_test.cljc b/common/test/common_tests/logic/composable_gen_test.cljc index 27995cf474..751e95b06b 100644 --- a/common/test/common_tests/logic/composable_gen_test.cljc +++ b/common/test/common_tests/logic/composable_gen_test.cljc @@ -4338,3 +4338,11 @@ (t/is (map? (cg/run {:world [2 0 {:variants true :rich-variants true :text true :layout :grid :layout-copies false :layout-children false}] :ops [[:duplicate] [:structure 0 4] [:swap 7] [:rotate 11] [:transform 1 11 0 12]]})))) + +(t/deftest generated-a-bool-in-a-flipped-board-shows-its-segments + ;; a turned bool in a flipped board may store a transform that does not + ;; mirror, while its flags and segments show it as its board turns it + (t/is (map? (cg/run {:world [2 1 {:variants true :rich-variants true :text true :layout nil + :layout-copies true :layout-children false}] + :ops [[:remove-child 0 0 0 0] [:add-child 1] [:structure 0 4 0] [:transform 0 16 0 3] + [:rotate 0 0 0 0] [:rotate 1 0 0 0]]}))))