From e47154e50336181f25661234eb5a28967faa95be Mon Sep 17 00:00:00 2001 From: Fredrik Bagge Carlson Date: Thu, 19 Nov 2026 04:36:01 +0000 Subject: [PATCH] Load images with ImageIO in the PR commenter ImageMagick_jll v7.1.2001 requires libgs.so.9, which the resolved Ghostscript_jll v10 does not provide. Loading every image therefore failed, VisualRegressionTests returned PROCESSING_ERROR with a difference of 1.0, and the PR comment reported 1.0 for every figure. FileIO loads PNG files with ImageIO when it is installed, so the script now installs ImageIO instead of ImageMagick. The comment now reports the status instead of the difference for results with PROCESSING_ERROR, and the log prints the corresponding errors. Co-Authored-By: Claude Opus 5.5 --- utils/pr_commenter.jl | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/utils/pr_commenter.jl b/utils/pr_commenter.jl index 1af3c82..cd5ecba 100644 --- a/utils/pr_commenter.jl +++ b/utils/pr_commenter.jl @@ -100,11 +100,13 @@ function get_message(res, org, new_org, old_commit, new_branch_name) for r in res if r.status != ControlExamplePlots.EXACT_MATCH ndiff += 1 - diff = (isdefined(r, :diff) && isa(r.diff, Number)) ? r.diff : 1.0 + # An image that could not be loaded has status PROCESSING_ERROR and diff 1.0 + has_diff = r.status != ControlExamplePlots.PROCESSING_ERROR && isdefined(r, :diff) && isa(r.diff, Number) + diff = has_diff ? r.diff : 1.0 # Symbol in front of number symbol = ( diff < 0.015 ? good : (diff < 0.03 ? warning : error)) # Number/message we print - status = (isdefined(r, :diff) && isa(r.diff, Number)) ? round(r.diff, digits=3) : string(r.status) + status = has_diff ? round(r.diff, digits=3) : string(r.status) # Name of file fig_name = basename(r.refFilename) # Append figure to message @@ -156,7 +158,9 @@ try println("adding packages") Pkg.add("UUIDs") Pkg.add("GitHub") - Pkg.add("ImageMagick") # Has no UUID + # FileIO loads PNG files with ImageIO when it is installed, otherwise with ImageMagick. + # ImageMagick_jll v7.1.2001 requires libgs.so.9, which Ghostscript_jll v10 does not provide. + Pkg.add("ImageIO") println("running checkout_ControlSystems_PR") checkout_ControlSystems_PR(org, origin, ENV["PR_ID"]) @@ -168,6 +172,9 @@ try res, ndiff = gen_figures() println("$ndiff images have changes") + for r in res + r.status == ControlExamplePlots.PROCESSING_ERROR && println("Failed to compare $(basename(r.refFilename)): ", r.err) + end import UUIDs