🐛 Keep missing-shape diagnostics readable with mixed labels

Sort labels by their printed value so keyword and fallback string labels
can appear in the same diagnostic. The failing regression now passes.

Validation: schema and runner suites, 44 tests / 119 assertions.

AI-assisted-by: GPT-6
This commit is contained in:
alonso.torres 2026-10-23 09:34:33 +02:00
parent 418a060ce4
commit a8bad1c8c8
2 changed files with 8 additions and 1 deletions

View File

@ -251,7 +251,7 @@
(when (nil? shape)
(let [present (->> (vals (:objects page))
(map (comp thi/label :id))
(sort)
(sort-by str)
(vec))]
(throw (ex-info (str "Unbound shape name: " (pr-str name)
". Shapes present in current page: " (pr-str present))

View File

@ -582,3 +582,10 @@
result (n/applied-result duplicate (tm/file before) (tm/file after))
new-head (tm/shape-by-id after (:new-head result))]
(t/is (= ((n/main-head-of "a") before) (:parent-id new-head)))))
(t/deftest missing-shape-diagnostics-accept-mixed-label-types
(let [situation (setup/simple-component-with-labeled-copy)
error (try (tm/resolve-shape situation :missing)
(catch #?(:clj Exception :cljs js/Error) error error))]
(t/is (= ::tm/unbound-shape-name (:type (ex-data error))))
(t/is (some #{:copy-child} (:present (ex-data error))))))