Skip to content

Fix the test suite on Rails 8.1 and test Ruby 3.2 to 4.0 with Rails 7.2 to 8.1 on pull requests - #564

Open
czj wants to merge 4 commits into
fnando:mainfrom
czj:modernize-ci
Open

czj wants to merge 4 commits into
fnando:mainfrom
czj:modernize-ci

Conversation

@czj

@czj czj commented Oct 25, 2026

Copy link
Copy Markdown

Hi Nando! While opening #563, I noticed that every CI job is red, and that none of them actually tests the pull request.

The workflow runs on pull_request_target, where actions/checkout checks out main, so each PR gets the results of main's code. And main itself fails for two unrelated reasons. On Rails 8.1, require "rails/railtie" raises NoMethodError: undefined method 'delegate_missing_to' when nothing loaded Rails before it, which is what the test suite does. On Rails 7.0 and 7.1, Active Support passes the quirks_mode option that json 3 removed, so one test fails (Rails 8.0 has the same issue).

This PR fixes both and brings the matrix up to date, one commit each:

  • lib/browser/rails.rb requires rails instead of rails/railtie. Apps already have Rails loaded at that point, so nothing changes for them.
  • The 7.0 and 7.1 gemfiles become 7.2 and 8.0, with json < 3 and a comment saying why. Update CI matrix to include all non-EOL ruby/rails pairings #554 by @mjankowski already proposed adding these two, so credit to them.
  • The workflow runs on pull_request, tests Ruby 3.2 (the gemspec's minimum), 3.3, 3.4 and 4.0 against the three gemfiles, and lets ruby/setup-ruby cache the bundle. It pins ubuntu-24.04, because ubuntu-latest is moving to 26.04, which has no Ruby 3.2 builds. The Rakefile's --auto-correct becomes --autocorrect, which RuboCop deprecated.
  • Since rake also runs RuboCop, the 6 offenses reported by RuboCop 1.92 are fixed, autocorrected and unchanged in behavior.

bundle exec rake passes locally with Ruby 4.0 on all three gemfiles. This PR's own pull_request_target run will still check out main and stay red, but the new pull_request run tests this branch (it may need your approval since I'm a first-time contributor).


🤖 Generated with Claude Code, but prompted, read, and verified by @czj, a caring human :)

czj and others added 4 commits October 25, 2026 14:42
On Rails 8.1, requiring rails/railtie on its own raises NoMethodError
(delegate_missing_to is undefined), which broke the test suite.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Active Support < 8.1 passes the quirks_mode option that json 3 removed,
so these gemfiles keep json 2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pull_request_target checks out main, so pull requests ran main's code
instead of their own. Pin ubuntu-24.04, which still has Ruby 3.2 builds,
and let setup-ruby cache the bundle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@czj

czj commented Oct 25, 2026

Copy link
Copy Markdown
Author

The red checks above come from the pull_request_target run, which checks out main (hence the 7_0 and 7_1 gemfiles this branch removes). The pull_request run that tests this branch is waiting for approval, so in the meantime here it is on my fork, green on all 12 jobs (Ruby 3.2 to 4.0, Rails 7.2 to 8.1): https://github.com/czj/browser/actions/runs/40190203585

@mjankowski

Copy link
Copy Markdown

I had forgotten about that old PR. If this does get a review, you way to contemplate dropping support for ruby 3.2 and rails 7.2 as well (next time you bump gem version), both of which are EOL (and rails 8.0 will be EOL in a few weeks).

Might simplify some of the conditional setup/versioning in here.

@czj

czj commented Oct 25, 2026

Copy link
Copy Markdown
Author

Thanks @mjankowski, good point! I'd rather keep this one about getting CI green, since dropping Ruby 3.2 and Rails 7.2 raises the gem's requirements and is really Nando's call for the next release. So I opened #565 on top of this branch: it requires Ruby 3.3, removes the 7.2 gemfile, lets the workflow go back to ubuntu-latest, and bumps RuboCop's target to 3.3.

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