mirror of
https://github.com/penpot/penpot.git
synced 2026-10-29 22:10:34 +00:00
- Most repairs change one shape, or the shape and its subtree, with a function, and each one wrote the same 12 to 15 lines around it: the log line, the empty changes of the page, the file data and the update of the shape. repair-shapes and repair-component hold that, so each method keeps its own name and says only what it changes. The functions several repairs repeated go once: detach-shape, the frame lookup of :frame-not-found and :invalid-frame, the no-op of the repairs that cannot be done, and the variant id of three variant repairs. The log lines now name the code that was repaired, which for :ref-shape-is-not-head and :ref-shape-is-head they misspelled. - Three error codes could never be reported, because each check runs only on shapes that already pass it: :component-not-main (in the check of a main head, reached only when :main-instance is true, and of a copy head, reached only when it is not), :should-be-component-root (reached only when :component-root is true) and :not-component-not-allowed (a main context counts as inside a main). They go, with their repairs and their place in error-codes. The check that a shape inside a component is no head also tested :component-id, which such a shape never has. The branch of check-shape for a shape that is neither a head nor a copy shape is a cond. No behavior change: the repair tests and the suites are unchanged. repair.cljc: 815 -> 534 lines. AI-assisted-by: claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>