From 56830abbd9dcf27f5466eac6f96e828808d2b051 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Sat, 7 Nov 2026 20:38:41 +0100 Subject: [PATCH] :paperclip: Keep a switched copy text's override of a typography it lacks When a switch carries a copy text's typography override, the model dropped it unless every other typographic style carried with it, since a typography reference cannot describe styles split between the copy and its main. That holds for a typography the copy applied. A copy text that lacks its main's typography and overrides only its size has no reference to split: production keeps the typography override, the same state a sync leaves, and the model now keeps it too. Harness only; the benchmark is not run. AI-assisted-by: claude-opus-5-5 --- .../src/app/common/test_helpers/composable/shadow.cljc | 9 ++++++--- common/test/common_tests/logic/composable_gen_test.cljc | 8 ++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/common/src/app/common/test_helpers/composable/shadow.cljc b/common/src/app/common/test_helpers/composable/shadow.cljc index aaf0ef7855..500800e62e 100644 --- a/common/src/app/common/test_helpers/composable/shadow.cljc +++ b/common/src/app/common/test_helpers/composable/shadow.cljc @@ -663,9 +663,12 @@ (not (contains? text-differences unit))) unit))) text-groups) - mixed-typography? (some #(not= (contains? carried-text-units :typography) - (contains? carried-text-units %)) - [:family :weight :size :line-height :spacing :case])] + ;; a typography the copy applied carries only with all its styles + mixed-typography? (and (some #(or (:typography-ref-id %) (:typography-ref-file %)) + (tree-seq map? :children (:content old))) + (some #(not= (contains? carried-text-units :typography) + (contains? carried-text-units %)) + [:family :weight :size :line-height :spacing :case]))] (reduce-kv (fn [result group _] (if-let [unit (get text-groups group)] diff --git a/common/test/common_tests/logic/composable_gen_test.cljc b/common/test/common_tests/logic/composable_gen_test.cljc index e14db90912..0dadd8cfda 100644 --- a/common/test/common_tests/logic/composable_gen_test.cljc +++ b/common/test/common_tests/logic/composable_gen_test.cljc @@ -1700,6 +1700,14 @@ :ops [[:add-variant 0] [:switch 0] [:add-variant 0 0 0 0] [:delete 2 0 0 0] [:add-variant 0 0 0 0]]})))) +(t/deftest switching-a-copy-text-without-the-mains-typography-keeps-that-override + (t/is (map? (cg/run {:world [3 2 {:variants true :text-styles true :layout nil :variant-diff false + :layout-item-margins false :grid-square false :rich-variants true + :layout-children false :grid-empty false :layout-copies true :text true}] + :ops [[:add-variant 0] [:switch 5] [:delete 25 0 0 0] [:text-style 12 8 1] + [:text 26 3 0 0] [:add-variant 2] [:switch 0] [:variant-property 0 0 0 0] + [:switch 20]]})))) + (t/deftest random-variant-compositions (let [coverage (atom {}) failure (atom nil)]