Skip to content

Accept job arg in SolidQueueAdapter#stopping? for Rails 8.2 compatibility#9

Open
Micaherb wants to merge 1 commit into
mainfrom
Micaherb/fix-rails-main-continuation
Open

Accept job arg in SolidQueueAdapter#stopping? for Rails 8.2 compatibility#9
Micaherb wants to merge 1 commit into
mainfrom
Micaherb/fix-rails-main-continuation

Conversation

@Micaherb
Copy link
Copy Markdown

@Micaherb Micaherb commented Jun 2, 2026

Summary

CI is failing on main and in PRs. This PR fixes the deterministic rails_main CI failure, where every job in the matrix fails with:

ContinuationTest#test_continuable_job_completes [test/integration/continuation_test.rb:28]:
Expected false to be truthy.

Root cause

Rails commit 6d1c401d (landed on rails/rails@main 2026-05-26, target version 8.2.0.alpha) — "Pass job instance to stopping?" — changed ActiveJob::Continuable#checkpoint! to call:

queue_adapter.stopping?(self)

instead of queue_adapter.stopping?. The upstream CHANGELOG explicitly requires every adapter to migrate:

Queue adapters that implement stopping? must accept the job as an optional positional argument, i.e. def stopping?(job = nil), in order to work with this version and older versions of Rails.

SolidQueueAdapter was relying on the no-arg stopping? predicate generated by class_attribute :stopping. Against Rails main every checkpoint! call raised ArgumentError, the continuable job errored out before completing, and the test asserted unfinished jobs were still present after the 5 s wait.

Fix

Define stopping?(job = nil) explicitly on the adapter. The optional positional arg keeps the method compatible with:

  • Rails 7.1 / 7.2 / 8.0 / 8.1 — call with no args, default nil is used
  • Rails 8.2+ — call with the job, currently unused

The job parameter is intentionally not consumed yet — this adapter doesn't support per-job interrupt reasons. That's a separate enhancement (Rails 8.2 also allows returning a custom reason; we just return false / true as before).

Test plan

Linked

Unblocks #7.

…lity

Rails 8.2 (rails/rails@6d1c401d, landed on main 2026-05-26) changed
`ActiveJob::Continuable#checkpoint!` to call `queue_adapter.stopping?(self)`,
passing the job instance. The upstream CHANGELOG requires every adapter that
implements `stopping?` to accept an optional positional argument:

> Queue adapters that implement `stopping?` must accept the job as an
> optional positional argument, i.e. `def stopping?(job = nil)`, in order to
> work with this version and older versions of Rails.

SolidQueueAdapter relied on the `stopping?` predicate generated by
`class_attribute :stopping`, which takes no arguments. Against Rails main
every `checkpoint!` call raised ArgumentError, so continuable jobs never
finished and `ContinuationTest#test_continuable_job_completes` failed
deterministically across the entire rails_main matrix.

Define `stopping?(job = nil)` explicitly. The optional arg keeps the method
compatible with Rails 7.1 / 7.2 / 8.0 / 8.1 (which call with no args) and
Rails 8.2+ (which passes the job). The job is currently unused -- this
adapter doesn't yet support per-job interrupt reasons; that's a separate
follow-up.
Comment on lines +17 to +19
def stopping?(job = nil)
self.class.stopping
end
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good catch - I'd rather see this stay as a PR though and point at that as you upgrade to 8.2, since it's gotta end up in solid queue proper very soon i'd imagine. someone has a PR opened a few days ago rails#747

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