From c56c4cd4e7ba089fd55218efe7d3e1498e0db9ec Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Mon, 9 Nov 2026 22:17:03 +0100 Subject: [PATCH] :paperclip: Push a swap's authored geometry in its main's frame in the model A copy root turned with its parent held a swapped child that authored its geometry, and update-main pushed the swap into the main. The child showed no turn against its root, so the main's new shape took none. The update-main model moved a pushed swap's geometry into the main's frame only when its turn differed from the one the main would give it; when the turns agreed it kept the copy's authored geometry, turned with the copy root, and expected that turn in the main. A pushed swap that authors its geometry now pushes it in the frame of its main. Harness only; the benchmark is not run. AI-assisted-by: claude-opus-5-5 --- .../common/test_helpers/composable/shadow.cljc | 6 ++++-- .../logic/composable_gen_test.cljc | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/common/src/app/common/test_helpers/composable/shadow.cljc b/common/src/app/common/test_helpers/composable/shadow.cljc index dfa6d29e65..b5814e8f4e 100644 --- a/common/src/app/common/test_helpers/composable/shadow.cljc +++ b/common/src/app/common/test_helpers/composable/shadow.cljc @@ -462,9 +462,11 @@ (get before (:parent-id content-main)) (get after (:parent-id ref)))) groups (cond-> groups + ;; a pushed swap authors geometry in the frame of its main (and pushed-swap? - (not (same-value? geometry :geometry-group - (select-keys expected [:rotation :flip-x :flip-y])))) + (or (contains? groups :geometry-group) + (not (same-value? geometry :geometry-group + (select-keys expected [:rotation :flip-x :flip-y]))))) (assoc :geometry-group geometry) (and pushed-swap? diff --git a/common/test/common_tests/logic/composable_gen_test.cljc b/common/test/common_tests/logic/composable_gen_test.cljc index e7609cb884..399a74bc9b 100644 --- a/common/test/common_tests/logic/composable_gen_test.cljc +++ b/common/test/common_tests/logic/composable_gen_test.cljc @@ -2403,6 +2403,24 @@ (t/is (= 45 (:rotation expected))) (t/is (false? (shadow/same-value? (:pushed after) :geometry-group expected))))) +(t/deftest pushed-swap-shadow-leaves-out-the-turn-of-a-turned-copy-root + (let [geometry {:width 100 :height 120 :rotation 45 :flip-x nil :flip-y nil :content-scale nil} + before {:copy {:id :copy :shape-ref :main :component-root true :rotation 45 :shapes [:child]} + :main {:id :main :component-root true :rotation 0} + :child (merge {:id :child :parent-id :copy :component-id :target :shape-ref :position} + geometry) + :target-main {:id :target-main :component-id :target :parent-id :page + :rotation 0 :width 100 :height 100} + :page {:id :page :rotation 0}} + after (-> before + (assoc-in [:child :shape-ref] :pushed) + (assoc :pushed (assoc (:target-main before) :id :pushed + :shape-ref :target-main :parent-id :main))) + model (shadow/update-main {:child {:swap-group {} :geometry-group geometry}} before after :copy) + expected (get-in model [:pushed :geometry-group])] + (t/is (= 0 (:rotation expected))) + (t/is (= 120 (:height expected))))) + (t/deftest pushed-swap-shadow-predicts-content-without-reading-the-new-child (let [before {:copy {:id :copy :shape-ref :main :shapes [:child]} :main {:id :main}