mirror of
https://github.com/penpot/penpot.git
synced 2026-11-25 20:30:35 +00:00
The 0033-normalize-main-instance-names migration walks the shape tree following the :shapes vectors. When a parent listed a child id missing from the container :objects map (a dangling reference), the traversal stored the nil child into :objects, creating a nil key that made check-file-data reject the whole file: get-file answered 500 "invalid file data" and the file could not be opened or migrated further. Fix it in two parts: - 0033 returns the container untouched when a listed child does not exist, so the traversal never stores a nil shape. - The append-only migration 0035-fix-dangling-children prunes from every :shapes vector, in pages and components, the ids absent from the owning container :objects map, logging each fix at trace level. It mirrors 0032-fix-children-not-in-parent, which repairs the opposite inconsistency. Both parts are needed: 0033 runs before the repair migration, so without the guard the same file fails again in the same migrate call. Add regression tests for the traversal guard and for the repair migration, and record in mem:clojure/logging the convention that :hints start lowercase. Closes #12936 AI-assisted-by: qwen3.8-flash
1.2 KiB
1.2 KiB
Clojure Logging Conventions
Structured logging through app.common.logging (l/trc/l/dbg/l/info/l/wrn/l/error/l/fatal): :hint carries the human-readable message, every other datum goes in its own keyword field (:id, :container, :removed, ...).
:hintvalues start lowercase:"fix dangling children", not"Fix dangling children". Uppercase-first hints exist as legacy (~57 occurrences, the densest inbackend/src; alsol/trcin migrationlegacy-28andlog/errorinapp.common.files.repair) — do not copy them, and do not mass-rewrite them unless the surrounding code needs the change.- A name that requires uppercase (an env var like
PENPOT_MEDIA_PROCESSING_SERVICE_URI, an acronym likeMCPorLDAP) stays uppercase inside an otherwise lowercase sentence. - Repair work done by a file migration logs at
l/trc, only when it changes something, and with the ids it touched: the house style ofmigrations.cljc(legacy-28precedes; the file has nowarn/infolines). The shippedlog4j2.xmlpins theapplogger toinfo(static file,monitorInterval="60"), so those trace lines appear only after the operator raises the level; the durable record of a repaired file is the migration id in its:migrations.