Repository navigation
Add types for activejob v8.1 - #1090
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Generated with `rbs prototype rb` from the activejob 8.1.4 source and post-processed the same way as the other Rails 8.1 gems: drop members already defined elsewhere, fill missing type arguments, add accessors defined with class_attribute, mattr_accessor, and cattr_accessor, add methods defined with delegate, and carry over typed signatures from 6.0 where the method still has the same parameters. The job generator in lib/rails is left out, as its superclass comes from railties, which activejob doesn't depend on. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Rails no longer has QueAdapter or SuckerPunchAdapter, so nothing refers to Que::Job or SuckerPunch::Job. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Logging defines them on the job class with cattr_accessor and class_attribute in its included block, which rbs prototype doesn't see. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
job_id, arguments, executions, queue_name, priority, and the other job attributes, enqueue, and perform_later, which returns the job or false when it couldn't be enqueued. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
rbs prototype marks a block as required unless the method checks it. These forward the block or don't use it: the callbacks with method names (before_perform :foo), assert_no_enqueued_jobs and assert_no_performed_jobs without a block, and a few internal methods. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…:Base ActiveJob::Callbacks and ActiveJob::Exceptions include ActiveSupport::Callbacks and ActiveSupport::Rescuable, so job classes have rescue_from and set_callback. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This was referenced Oct 13, 2026
|
@amatsuda Thanks for your contribution! Please follow the instructions below for each change. Available commandsYou can use the following commands by commenting on this PR.
|
Member
Author
|
/merge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Adds signatures for activejob 8.1, based on 8.1.4.
The latest version in this repository was activejob 6.0, whose generated file came from Rails 6.0. Like the other Rails 8.1 gems (#1084, #1086, #1087), this PR regenerates the RBS from the 8.1.4 source and carries over the hand-written parts.
How it is made
activejob-generated.rbscomes fromrbs prototype rbrun onlib, then post-processed the same way as the other Rails 8.1 gems:untypedclass_attribute,mattr_accessor, andcattr_accessor, and methods defined withdelegate. Acattr_accessorinsideincluded do ... endgoes to the class that includes the concern, likeclass_attributeThe job generator in
lib/railsis left out, since its superclass comes from railties, which activejob doesn't depend on.Changes to the hand-written RBS
The first commit copies 6.0's hand-written files unchanged, so the following commits show only the 8.1-specific changes:
Que::JobandSuckerPunch::Job. Rails no longer has those adaptersloggerandlog_argumentstoActiveJob::Base.Loggingdefines them in itsincludedblockActiveJob::BaseextendsActiveSupport::Callbacks::ClassMethodsandActiveSupport::Rescuable::ClassMethods, so jobs haverescue_fromReturn types
job_id,arguments,executions,exception_executions,queue_name,priority,locale,timezone,enqueued_at,enqueue_error, andenqueue/perform_later, which return the job, orfalseif it couldn't be enqueued.Optional blocks
rbs prototypemarks a&blockparam as required unless the body checks it. All required blocks were checked against the source, and the 14 that only forward the block or don't use it were made optional: for example,before_perform :method_name, andassert_no_enqueued_jobswithout a block.Tests
Each commit that changes types adds tests that fail without it.
bin/test gems/activejob/8.1and RuboCop's strict cops pass on every commit from the generation commit onward.The existing gems that depend on activejob (actionmailer 7.0, actiontext 7.2, and activestorage 7.0) still resolve to activejob 6.0, and their tests pass.
🤖 Generated with Claude Code