Skip to content

Fix boot failure without mini_magick for apps on the Vips transformer - #74

Merged
flavorjones merged 1 commit into
masterfrom
issue-57-lazy-mini-magick
Sep 30, 2026
Merged

flavorjones merged 1 commit into
masterfrom
issue-57-lazy-mini-magick

Conversation

@flavorjones

Copy link
Copy Markdown
Member

Motivation

activestorage-hotcell-client ships a transformer for each image backend: Transformers::Image::Vips and Transformers::Image::Magick. An application configures one of them as config.active_storage.variant_processor.

require "active_storage/hot_cell/client" loads both. The Magick transformer subclasses Rails' ActiveStorage::Transformers::ImageMagick, and that file requires image_processing/mini_magick (client.rb:9, magick.rb:4). image_processing 2.x no longer depends on mini_magick, so an application on the Vips transformer that does not install mini_magick fails to boot:

LoadError: ImageProcessing::MiniMagick requires the mini_magick gem. Please add `gem "mini_magick", "~> 5.0"` to your Gemfile.

Fizzy hit this in basecamp/fizzy#3056 and worked around it in basecamp/fizzy#3106 by bundling mini_magick it does not use.

Fixes #57

Details

  • client.rb autoloads Transformers::Image::Magick instead of requiring it. Requiring the gem no longer loads mini_magick.
  • An application that names the Magick transformer without mini_magick installed still gets image_processing's LoadError, at the point where it names the class.
  • The issue proposed the same for Analyzers::Image::Magick. It loads no ImageMagick code, so it stays required.
  • New tests run Ruby in a fresh process with a mini_magick.rb stand-in that raises LoadError, and cover both cases.

Copilot AI balanced review requested due to automatic review settings September 28, 2026 21:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@flavorjones
flavorjones force-pushed the issue-57-lazy-mini-magick branch from 0e7be83 to 13905b6 Compare September 29, 2026 22:29
Requiring activestorage-hotcell-client loaded the ImageMagick
transformer, whose Rails superclass requires mini_magick. Under
image_processing 2.x, which no longer depends on mini_magick, an
application on the Vips transformer failed to boot with LoadError.

Autoload the ImageMagick transformer, so only an application that
names it needs mini_magick.

[Fix #57]
@flavorjones
flavorjones force-pushed the issue-57-lazy-mini-magick branch from 13905b6 to 0d53ad6 Compare September 30, 2026 19:10
@flavorjones
flavorjones merged commit be7b286 into master Sep 30, 2026
16 checks passed
@flavorjones
flavorjones deleted the issue-57-lazy-mini-magick branch September 30, 2026 19:16
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.

activestorage-hotcell-client requires mini_magick at load even when only the Vips transformer is configured

2 participants