DEV Community

Allison
Allison

Posted on • Originally published at infield.ai

Undocumented Gem Incompatibilities with Rails 7.1

TLDR: Use this script to check whether your app relies on any gems that are silently incompatible with Rails 7.1.

Upgrading Rails means first upgrading other dependencies that block the way. Some of these will have explicit incompatibilities documented in their gemspecs. If you try to run bundle update rails without upgrading these gems you'll see an error that bundler couldn't resolve the upgrade.

Other gems leave an open-ended rails requirement in their gemspec. This means bundler will allow a new version of Rails alongside your current version of those gems, but there's no guarantee from the maintainer that the two are compatible. This can lead to subtle bugs that don't get caught until production.

For example, take the popular data-migrate gem. Its gemspec requires activerecord >= 6.1 with no upper bound. Looking at the changelog, though, you'll see that support for Rails 7.1 wasn't added until version 9.2.0. Older versions will hit this exception when someone tries to run migrations under the latest Rails, even though bundler installs the package with no warning.

These "silent" incompatibilities are often documented in the maintainer’s changelog even though they’re not available to bundler. My startup Infield keeps a database of every ruby package and its changelog, which we parsed to find any mention of adding Rails 7.1 support. Then we filtered those results to only new package versions where bundler would have already allowed Rails 7.1 in the previous version. We found 23 of these:

Rails 7.1 compatibilities

Here’s a script to check for these in your app - just point it at your Gemfile.lock.

Hope this is useful!

Top comments (0)