mirror of
https://github.com/penpot/penpot.git
synced 2026-11-26 21:00:32 +00:00
repair-file built every repair of a pass from the file data taken before the pass. Repairs write whole values (a :mod-component with the whole component, a :set with the whole :shapes vector), so two repairs on the same component or shape attribute undid each other: the last write won, the lost fix came back as an error, and each clash cost another pass. Each repair's changes are now applied before the next repair is built. A private repair-file* returns the data and the changes; repair-file returns the changes, which give the same result when applied in order, and repair-file-until-valid reuses the data instead of applying the batch again (on the backend a second apply wrote an orphan page fragment). Repairs now see what earlier repairs of the pass did, so :ref-shape-not-found does nothing when its shape was removed or its ref shape resolves again; it would otherwise detach a copy that an earlier :invalid-main-instance-id repair had already relinked. Tests stub repair-error, through a multi-arity fn so the JS build can call it, and cover two clashing errors on one component in either order, three missing children fixed in one pass, and repairs on removed shapes. Closes #13239 AI-assisted-by: claude-opus-5-5