que-rb/que

Que fails to calculate args and kwargs on Ruby 3.2 with ActiveJob

kevinrobayna opened this issue · 1 comments

As part of the release 3.0 of Ruby there was a breaking change for the way args are delegated into. We adopted such change in this PR #319.

Ruby released a bugfix on the mechanism which was solved on the version 3.2. This now causes que to fail when using the latest version of ruby.

ZimbiX commented

For completeness, here are the spec failures on Ruby 3.2:

  1) Error:
Que::ActiveJob::JobExtensions::when used with a non-Que job queue#test_0001_shouldn't cause problems:
ArgumentError: wrong number of arguments (given 2, expected 1; required keyword: keyword_arg)
    /home/brendan/Projects/que/spec/que/active_job/extensions.job_extensions_spec.rb:46:in `run'
    /home/brendan/Projects/que/lib/que/job_methods.rb:51:in `_run'
    /home/brendan/Projects/que/lib/que/active_job/extensions.rb:21:in `perform'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activejob-6.1.6.1/lib/active_job/execution.rb:48:in `block in perform_now'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/i18n-1.12.0/lib/i18n.rb:322:in `with_locale'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activejob-6.1.6.1/lib/active_job/translation.rb:9:in `block (2 levels) in <module:Translation>'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `instance_exec'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/time/zones.rb:66:in `use_zone'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activejob-6.1.6.1/lib/active_job/timezones.rb:9:in `block (2 levels) in <module:Timezones>'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `instance_exec'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activejob-6.1.6.1/lib/active_job/instrumentation.rb:21:in `block in instrument'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/notifications.rb:203:in `block in instrument'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/notifications.rb:203:in `instrument'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activejob-6.1.6.1/lib/active_job/instrumentation.rb:31:in `instrument'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activejob-6.1.6.1/lib/active_job/instrumentation.rb:14:in `block (2 levels) in <module:Instrumentation>'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `instance_exec'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activejob-6.1.6.1/lib/active_job/logging.rb:24:in `tag_logger'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activejob-6.1.6.1/lib/active_job/logging.rb:15:in `block (2 levels) in <module:Logging>'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `instance_exec'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:137:in `run_callbacks'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activejob-6.1.6.1/lib/active_job/execution.rb:47:in `perform_now'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activejob-6.1.6.1/lib/active_job/execution.rb:25:in `block in execute'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:98:in `run_callbacks'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activejob-6.1.6.1/lib/active_job/execution.rb:23:in `execute'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activejob-6.1.6.1/lib/active_job/queue_adapters/inline_adapter.rb:15:in `enqueue'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activejob-6.1.6.1/lib/active_job/enqueuing.rb:59:in `block in enqueue'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activejob-6.1.6.1/lib/active_job/instrumentation.rb:21:in `block in instrument'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/notifications.rb:203:in `block in instrument'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/notifications.rb:203:in `instrument'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activejob-6.1.6.1/lib/active_job/instrumentation.rb:31:in `instrument'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activejob-6.1.6.1/lib/active_job/instrumentation.rb:9:in `block (2 levels) in <module:Instrumentation>'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `instance_exec'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activejob-6.1.6.1/lib/active_job/logging.rb:24:in `tag_logger'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activejob-6.1.6.1/lib/active_job/logging.rb:14:in `block (2 levels) in <module:Logging>'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `instance_exec'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:137:in `run_callbacks'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activejob-6.1.6.1/lib/active_job/enqueuing.rb:55:in `enqueue'
    /home/brendan/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activejob-6.1.6.1/lib/active_job/enqueuing.rb:22:in `perform_later'
    /home/brendan/Projects/que/spec/que/active_job/extensions.job_extensions_spec.rb:65:in `block (3 levels) in <top (required)>'

  2) Failure:
Que::Job::running jobs through ActiveJob when a subclass has our helpers included#test_0006_should symbolize hash argument keys [/home/brendan/Projects/que/spec/que/job_spec.rb:77]:
--- expected
+++ actual
@@ -1 +1 @@
-[{:a=>1, :b=>2}]
+[{:a=>1, :b=>2}, {:c=>3, :d=>4}]


  3) Failure:
Que::Job::running jobs through ActiveJob when a subclass has our helpers included#test_0007_should symbolize hash argument keys even if they were originally passed as strings [/home/brendan/Projects/que/spec/que/job_spec.rb:85]:
--- expected
+++ actual
@@ -1 +1 @@
-[{:a=>1, :b=>2}]
+[{:a=>1, :b=>2}, {:c=>3, :d=>4}]


  4) Error:
Que::Job::running jobs through ActiveJob when a subclass has our helpers included#test_0011_should handle keyword arguments even if they were originally passed as strings:
ArgumentError: wrong number of arguments (given 1, expected 0; required keyword: a)
    /home/brendan/Projects/que/spec/que/job_spec.rb:527:in `execute'
    /home/brendan/Projects/que/spec/que/job_spec.rb:124:in `block (2 levels) in included'

  5) Failure:
Que::Job::running jobs through ActiveJob when a subclass has our helpers included#test_0009_should symbolize keyword argument keys even if they were originally passed as strings [/home/brendan/Projects/que/spec/que/job_spec.rb:99]:
Expected: {:a=>1, :b=>2}
  Actual: {}

  6) Failure:
Que::Job::running jobs through ActiveJob when a subclass has our helpers included#test_0002_should pass its keyword arguments to the run method [/home/brendan/Projects/que/spec/que/job_spec.rb:41]:
Expected: {:a=>1, :b=>2}
  Actual: {}

  7) Failure:
Que::Job::running jobs through ActiveJob when a subclass has our helpers included#test_0004_should deep-freeze its keyword arguments [/home/brendan/Projects/que/spec/que/job_spec.rb:60]:
--- expected
+++ actual
@@ -1 +1 @@
-{:array=>[], :hash=>{}, :string=>"blah"}
+{}


  8) Error:
Que::Job::running jobs through ActiveJob when a subclass has our helpers included#test_0010_should handle keyword arguments just fine:
ArgumentError: wrong number of arguments (given 1, expected 0; required keyword: a)
    /home/brendan/Projects/que/spec/que/job_spec.rb:527:in `execute'
    /home/brendan/Projects/que/spec/que/job_spec.rb:110:in `block (2 levels) in included'

  9) Failure:
Que::Job::running jobs through ActiveJob when a subclass has our helpers included#test_0008_should symbolize keyword argument keys [/home/brendan/Projects/que/spec/que/job_spec.rb:91]:
Expected: {:a=>1, :b=>2}
  Actual: {}

558 runs, 9130 assertions, 6 failures, 3 errors, 5 skips

You have skipped tests. Run with --verbose for details.
rake aborted!
Command failed with status (1)
/home/brendan/.rbenv/versions/3.2.2/bin/bundle:25:in `load'
/home/brendan/.rbenv/versions/3.2.2/bin/bundle:25:in `<main>'
Tasks: TOP => spec => test
(See full trace by running task with --trace)