🐛 Drop the uniform structure flag of older copy texts

Copy texts in files older than mid-2025 can hold
:text-content-structure-same-attrs next to :text-content-structure,
which marked a structure change of a text with one style. The text
override migration recomputed the groups and dropped the structure flag
but left this one in :touched, where nothing reads it, and validation
did not report it. It is now one of the legacy text groups, so the
migration and the :legacy-text-touched repair drop it too. Found in
the copy A2 of the QA fixture text-components-propagation.penpot while
re-running PENPOT-2261.

convert-text-overrides-test: the flag goes with the structure flag and
without it. repair-components-test/legacy-text-touched: a copy holding
it is reported and repaired.

AI-assisted-by: claude-opus-5-5
This commit is contained in:
alonso.torres 2026-10-16 12:25:28 +02:00
parent ee448fd5a1
commit de30b8434e
3 changed files with 25 additions and 3 deletions

View File

@ -409,7 +409,7 @@
(vary-meta assoc ::deferred-swaps true))))
(def ^:private legacy-text-groups
#{:text-content-attribute :text-content-structure})
#{:text-content-attribute :text-content-structure :text-content-structure-same-attrs})
(defn legacy-text-touched?
"Whether `shape` holds the text override groups of files older than the
@ -452,7 +452,8 @@
"Store the text overrides of the file's copies per letters and per style.
Files older than the feature components/text-overrides mark a copy text
with `:text-content-attribute` (any style) and `:text-content-structure`
(the number of paragraphs or runs); now it holds `:text-content-text` and
(the number of paragraphs or runs, with `:text-content-structure-same-attrs`
when the styles were uniform); now it holds `:text-content-text` and
one group per style unit (`cttx/style-units`). Older files still mark it
with `:content-group` alone, which allows every group. Each copy text with
the old groups is compared with its near main, and takes the groups the

View File

@ -63,6 +63,21 @@
(convert)
(touched :copy-child)))))
(t/deftest the-uniform-structure-flag-goes-with-the-others
;; older files mark a structure change of a uniform text with
;; `:text-content-structure-same-attrs` too
(t/is (= #{:content-group :text-content-text}
(-> (old-copy [[["Price:"] ["$10" {:weight 700}]]]
#{:content-group :text-content-structure :text-content-structure-same-attrs})
(convert)
(touched :copy-child))))
(t/testing "it goes without the structure flag as well"
(t/is (= #{:content-group :text-content-text}
(-> (old-copy [[["Price:"] ["$10" {:weight 700}]]]
#{:content-group :text-content-text :text-content-structure-same-attrs})
(convert)
(touched :copy-child))))))
(t/deftest an-old-flag-where-nothing-differs-sets-nothing
(t/is (= #{:fill-group}
(-> (old-copy main #{:content-group :text-content-attribute :fill-group})

View File

@ -369,7 +369,13 @@
#{:content-group :text-content-attribute}))]
(t/is (= #{:legacy-text-touched} found))
(t/is (nil? errors))
(t/is (empty? (:touched (ths/get-shape file' :copy-child))))))
(t/is (empty? (:touched (ths/get-shape file' :copy-child)))))
(t/testing "the uniform structure flag is an old flag too"
(let [[found file' errors] (repair (ths/update-shape (simple) :copy-child :touched
#{:content-group :text-content-structure-same-attrs}))]
(t/is (= #{:legacy-text-touched} found))
(t/is (nil? errors))
(t/is (empty? (:touched (ths/get-shape file' :copy-child)))))))
;; ---- Nesting