Skip to content

Add support for ActiveJob 7.1#42

Merged
adis-io merged 19 commits intomainfrom
add-support-for-action-mailers
Apr 9, 2026
Merged

Add support for ActiveJob 7.1#42
adis-io merged 19 commits intomainfrom
add-support-for-action-mailers

Conversation

@adis-io
Copy link
Copy Markdown
Contributor

@adis-io adis-io commented Apr 8, 2026

Original PR: #39


Breaking changes addressed

Action Mailer exception

In ActionMailer 7.1+ the following call throws an exception:

ActionMailer::MailDeliveryJob.new.queue_name

This is because MailDeliveryJob accepts the Mailer as the first argument and uses the mailer dynamically to get the queue name using deliver_later_queue_name. So, calling queue_name without passing the arguments throws an exception.

The only way to pass arguments is to call perform_later - which we cannot do just to get queue_name.

This was solved by adding special handling for MailDeliveryJob. We use deliver_later_queue_name from the mailer itself to get the queue name - same as MailDeliveryJob.

Checklist

  • Make sure existing tests pass
  • Write tests for expanded functionality of Mailer specific queue
  • Update Changelog

Copilot AI review requested due to automatic review settings April 8, 2026 11:57
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds Rails/ActiveJob 7.1 compatibility by avoiding ActionMailer::MailDeliveryJob.new.queue_name (which raises in 7.1+) and by expanding CI/appraisal coverage to test against Rails 7.1.

Changes:

  • Add mailer-specific consumer registration by deriving queue names from deliver_later_queue_name rather than instantiating MailDeliveryJob.
  • Expand integration specs to cover Rails 7.1 ActionMailer queue behaviors (including per-mailer queue names and custom delivery jobs).
  • Add a Rails 7.1 appraisal + gemfile and extend the GitHub Actions matrix accordingly.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
lib/advanced_sneakers_activejob/workers_registry.rb Adds ActionMailer-aware consumer definition to avoid Rails 7.1 MailDeliveryJob instantiation issues.
spec/integration/consumers_spec.rb Adds/adjusts integration coverage for ActionMailer queue handling, including Rails 7.1+ per-mailer queue names.
Appraisals Adds an activejob-7.1.x appraisal entry.
gemfiles/activejob_7.1.x.gemfile Adds the generated Rails 7.1 appraisal gemfile.
.github/workflows/main.yml Extends CI matrix to include Rails 7.1 and newer Ruby versions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/advanced_sneakers_activejob/workers_registry.rb Outdated
Comment thread Appraisals
Comment thread gemfiles/activejob_7.1.x.gemfile
Comment thread .github/workflows/main.yml Outdated
@adis-io adis-io force-pushed the add-support-for-action-mailers branch from 1c87130 to b0e37f4 Compare April 8, 2026 12:43
Copilot AI review requested due to automatic review settings April 8, 2026 12:43

This comment was marked as outdated.

@adis-io adis-io force-pushed the add-support-for-action-mailers branch from b0e37f4 to 70fc9d1 Compare April 8, 2026 12:54
Copilot AI review requested due to automatic review settings April 8, 2026 13:05

This comment was marked as outdated.

adis-io added 6 commits April 8, 2026 14:49
- Remove Ruby 2.5 and 2.6 from CI matrix
- Add Ruby 3.3 and 3.4 to CI matrix
- Remove EOL Rails 4.2 and 5.2 gemfiles
- Add Rails 7.2 appraisal and gemfile
- Pin concurrent-ruby 1.3.4 in 7.1.x appraisal
- Update exclude rules for Rails 6.x + Ruby 3.1+ incompatibility
- Bump actions/checkout from v2 to v4
…ing_adapter

Use <= instead of == to exclude all MailDeliveryJob descendants,
not just the base class. Custom delivery jobs that subclass
MailDeliveryJob require initialization arguments in Rails 7.1+ and
would raise when instantiated via worker.new.queue_name.
- Update required_ruby_version in gemspec from 2.5 to 2.7
- Add concurrent-ruby 1.3.4 pin to activejob_7.1.x and 7.2.x gemfiles
  to match Appraisals declarations
Document ActionMailer support, Rails 7.1/7.2 support, Ruby 3.3/3.4
support, dropped EOL versions, and MailDeliveryJob subclass fix.
Ruby 3.4 changed NoMethodError messages to use single quotes instead
of backticks, and Hash#inspect to use symbol-key syntax ({key: "val"})
instead of rocket syntax ({:key=>"val"}). Update test regexes to
accept both formats.
Match ActiveJob's own queue name composition by using .presence
instead of bare value, preventing a leading delimiter when the
prefix is an empty string.
@adis-io adis-io force-pushed the add-support-for-action-mailers branch from 4347df7 to 91c1750 Compare April 8, 2026 13:50
Copilot AI review requested due to automatic review settings April 8, 2026 14:00

This comment was marked as outdated.

@adis-io adis-io force-pushed the add-support-for-action-mailers branch from a83f8ba to a954431 Compare April 8, 2026 14:13
Copilot AI review requested due to automatic review settings April 8, 2026 14:20

This comment was marked as outdated.

@adis-io adis-io force-pushed the add-support-for-action-mailers branch from bc6b200 to 8cb7b09 Compare April 8, 2026 14:33
Rails 7.2 introduced Rails::HealthController which inherits from
ActionController::Base. During eager_load!, it tries to load this
controller, causing NameError when action_controller/railtie is not
required. Add the require to all three test app files.
Copilot AI review requested due to automatic review settings April 8, 2026 14:45
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@adis-io adis-io merged commit 247dce3 into main Apr 9, 2026
23 checks passed
@adis-io adis-io deleted the add-support-for-action-mailers branch April 9, 2026 07:30
@adis-io adis-io mentioned this pull request Apr 9, 2026
3 tasks
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.

4 participants