Skip to content

Report the message when versions cannot be compared - #1

Merged
ingydotnet merged 1 commit into
clojurestar:mainfrom
yogthos:fix/incomparable-version-warning-message
Aug 2, 2026
Merged

Report the message when versions cannot be compared#1
ingydotnet merged 1 commit into
clojurestar:mainfrom
yogthos:fix/incomparable-version-warning-message

Conversation

@yogthos

@yogthos yogthos commented Aug 2, 2026

Copy link
Copy Markdown

expand-deps warns and keeps the selected coordinate when :compare-versions throws, but the warning carried (str error). Callers render warnings as data with pr-str (cli.clj does), so on the JVM that inlined the exception class and its whole ex-data:

{:warning :versions-not-comparable, :lib demo/libc, ...
 :message "clojure.lang.ExceptionInfo: Unable to compare versions for demo/libc: #:mvn{:version \"1.0.0\"} and #:local{:root \"/…\"} {:lib demo/libc, :coord-x {:mvn/version 1.0.0}, :coord-y {:local/root /…}}"}

On Glojure it was worse — (str error) there is #object[*lang.ExceptionInfo], so the message was lost outright. Now it carries (ex-message error).

While adding coverage for that path I found the catch clause was dead on Glojure, which resolves neither Exception nor Throwable:

interface conversion: reflect.Type is *lang.Class, not *reflect.rtype

So an incomparable pair panicked instead of warning. grenadine.test-support/throws? already makes this split, so newer? now makes it the same way with go/any. Nothing exercised the incomparable path before, which is why it went unnoticed.

Verified on all five runtimes — clj, bb, glj, jolt, lg — 130 assertions, 0 failures each, plus make test-cli (53 checks) to confirm the reader conditional survives stage-sources renaming .cljc to .clj for the Go build.

One related thing I did not fix here: repo.cljc's latest-version has the same unresolvable (catch Exception ...), so on Glojure malformed metadata escapes as a raw host panic rather than :grenadine.repo/invalid-metadata. rejects-missing-and-invalid-metadata passes there only because throws? cannot tell a panic from a throw. Adding the go/any branch fixes the panic, but the wrapper's ex-data still does not survive on Glojure for reasons I could not pin down in that call shape, so I left it out rather than ship a half-diagnosed change. Happy to open it separately.

The :versions-not-comparable warning carried (str error). Hosts render
warnings with pr-str, so that inlined the exception class and its ex-data on
the JVM, and on Glojure it came out as #object[*lang.ExceptionInfo] with the
message gone entirely. Carry (ex-message error) instead.

The catch clause was also dead on Glojure, which resolves neither Exception
nor Throwable: an incomparable pair panicked with an interface conversion
error rather than warning and keeping the selected coordinate. Split it the
way grenadine.test-support/throws? already does. Nothing covered that path,
which is why it went unnoticed.
@ingydotnet
ingydotnet merged commit fd5b47f into clojurestar:main Aug 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants