Skip to content

Fix generic ActiveJob signatures - #2696

Open
iamhaseebn wants to merge 1 commit into
Shopify:mainfrom
iamhaseebn:fix-active-job-generic-return-types
Open

Fix generic ActiveJob signatures#2696
iamhaseebn wants to merge 1 commit into
Shopify:mainfrom
iamhaseebn:fix-active-job-generic-return-types

Conversation

@iamhaseebn

@iamhaseebn iamhaseebn commented Aug 8, 2026

Copy link
Copy Markdown

Motivation

Generic ActiveJob subclasses currently generate bare job class references in perform_later signatures. Sorbet requires generic classes to include type arguments, so the generated RBI fails type checking.

Fixes #2233.

Implementation

  • Detect generic ActiveJob subclasses using T::Generic === constant.
  • Look up their non-fixed type members and use T.untyped for each generated type argument.
  • Use the parameterized job type for both the callback parameter and the perform_later return type.
  • Preserve existing signatures for non-generic jobs.

Tests

  • Added regression coverage for jobs with one type member and multiple type members.
  • Ran bundle exec bin/test spec/tapioca/dsl/compilers/active_job_spec.rb.
  • Ran the complete suite: 821 tests, 3,190 assertions, 0 failures, 0 errors, 2 skips.
  • Ran bundle exec bin/typecheck and bundle exec bin/style.
  • Ran documentation, README, gem RBI, and shim verification checks.

@iamhaseebn
iamhaseebn requested a review from a team as a code owner August 8, 2026 20:46
@iamhaseebn

Copy link
Copy Markdown
Author

I have signed the CLA!

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.

Tapioca::Dsl::Compilers::ActiveJob creates an invalid RBI for generic job classes

1 participant