shoryuken 7.0.0.rc1 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/push.yml +2 -2
  3. data/.github/workflows/specs.yml +27 -45
  4. data/.github/workflows/verify-action-pins.yml +1 -1
  5. data/.gitignore +3 -0
  6. data/.rspec +1 -0
  7. data/.ruby-version +1 -1
  8. data/.yard-lint.yml +279 -0
  9. data/CHANGELOG.md +58 -4
  10. data/Gemfile +1 -1
  11. data/README.md +2 -7
  12. data/Rakefile +4 -10
  13. data/bin/clean_localstack +52 -0
  14. data/bin/cli/base.rb +21 -0
  15. data/bin/cli/sqs.rb +60 -1
  16. data/bin/integrations +275 -0
  17. data/bin/scenario +154 -0
  18. data/lib/{shoryuken/extensions/active_job_extensions.rb → active_job/extensions.rb} +15 -4
  19. data/lib/active_job/queue_adapters/shoryuken_adapter.rb +208 -0
  20. data/lib/active_job/queue_adapters/shoryuken_concurrent_send_adapter.rb +78 -0
  21. data/lib/shoryuken/active_job/current_attributes.rb +139 -0
  22. data/lib/shoryuken/active_job/job_wrapper.rb +28 -0
  23. data/lib/shoryuken/body_parser.rb +8 -0
  24. data/lib/shoryuken/client.rb +14 -0
  25. data/lib/shoryuken/default_exception_handler.rb +9 -0
  26. data/lib/shoryuken/default_worker_registry.rb +29 -1
  27. data/lib/shoryuken/environment_loader.rb +78 -8
  28. data/lib/shoryuken/errors.rb +33 -0
  29. data/lib/shoryuken/fetcher.rb +37 -1
  30. data/lib/shoryuken/helpers/atomic_boolean.rb +19 -5
  31. data/lib/shoryuken/helpers/timer_task.rb +16 -2
  32. data/lib/shoryuken/launcher.rb +39 -0
  33. data/lib/shoryuken/logging/base.rb +1 -1
  34. data/lib/shoryuken/logging/pretty.rb +2 -2
  35. data/lib/shoryuken/logging/without_timestamp.rb +2 -2
  36. data/lib/shoryuken/logging.rb +37 -3
  37. data/lib/shoryuken/manager.rb +70 -1
  38. data/lib/shoryuken/middleware/chain.rb +3 -2
  39. data/lib/shoryuken/middleware/server/active_record.rb +8 -0
  40. data/lib/shoryuken/middleware/server/auto_delete.rb +10 -0
  41. data/lib/shoryuken/middleware/server/auto_extend_visibility.rb +26 -0
  42. data/lib/shoryuken/middleware/server/exponential_backoff_retry.rb +29 -0
  43. data/lib/shoryuken/middleware/server/timing.rb +11 -0
  44. data/lib/shoryuken/options.rb +129 -6
  45. data/lib/shoryuken/polling/base_strategy.rb +1 -0
  46. data/lib/shoryuken/polling/strict_priority.rb +39 -0
  47. data/lib/shoryuken/polling/weighted_round_robin.rb +42 -0
  48. data/lib/shoryuken/processor.rb +32 -1
  49. data/lib/shoryuken/queue.rb +93 -4
  50. data/lib/shoryuken/runner.rb +42 -4
  51. data/lib/shoryuken/util.rb +26 -1
  52. data/lib/shoryuken/version.rb +2 -1
  53. data/lib/shoryuken/worker/default_executor.rb +21 -1
  54. data/lib/shoryuken/worker/inline_executor.rb +24 -0
  55. data/lib/shoryuken/worker.rb +23 -1
  56. data/lib/shoryuken/worker_registry.rb +33 -0
  57. data/lib/shoryuken.rb +18 -6
  58. data/renovate.json +29 -2
  59. data/shoryuken.gemspec +2 -1
  60. data/spec/integration/.rspec +1 -0
  61. data/spec/integration/active_job/adapter_configuration/configuration_spec.rb +26 -0
  62. data/spec/integration/active_job/bulk_enqueue/bulk_enqueue_spec.rb +53 -0
  63. data/spec/integration/active_job/current_attributes/bulk_enqueue_spec.rb +50 -0
  64. data/spec/integration/active_job/current_attributes/complex_types_spec.rb +55 -0
  65. data/spec/integration/active_job/current_attributes/empty_context_spec.rb +41 -0
  66. data/spec/integration/active_job/current_attributes/full_context_spec.rb +63 -0
  67. data/spec/integration/active_job/current_attributes/partial_context_spec.rb +57 -0
  68. data/spec/integration/active_job/custom_attributes/number_attributes_spec.rb +37 -0
  69. data/spec/integration/active_job/custom_attributes/string_attributes_spec.rb +39 -0
  70. data/spec/integration/active_job/error_handling/job_wrapper_spec.rb +53 -0
  71. data/spec/integration/active_job/fifo_and_attributes/deduplication_spec.rb +86 -0
  72. data/spec/integration/active_job/retry/discard_on_spec.rb +43 -0
  73. data/spec/integration/active_job/retry/retry_on_spec.rb +36 -0
  74. data/spec/integration/active_job/roundtrip/roundtrip_spec.rb +52 -0
  75. data/spec/integration/active_job/scheduled/scheduled_spec.rb +76 -0
  76. data/spec/integration/active_record_middleware/active_record_middleware_spec.rb +84 -0
  77. data/spec/integration/auto_delete/auto_delete_spec.rb +53 -0
  78. data/spec/integration/auto_extend_visibility/auto_extend_visibility_spec.rb +57 -0
  79. data/spec/integration/aws_config/aws_config_spec.rb +59 -0
  80. data/spec/integration/batch_processing/batch_processing_spec.rb +37 -0
  81. data/spec/integration/body_parser/json_parser_spec.rb +45 -0
  82. data/spec/integration/body_parser/proc_parser_spec.rb +54 -0
  83. data/spec/integration/body_parser/text_parser_spec.rb +43 -0
  84. data/spec/integration/concurrent_processing/concurrent_processing_spec.rb +45 -0
  85. data/spec/integration/dead_letter_queue/dead_letter_queue_spec.rb +91 -0
  86. data/spec/integration/exception_handlers/exception_handlers_spec.rb +69 -0
  87. data/spec/integration/exponential_backoff/exponential_backoff_spec.rb +67 -0
  88. data/spec/integration/fifo_ordering/fifo_ordering_spec.rb +44 -0
  89. data/spec/integration/large_payloads/large_payloads_spec.rb +30 -0
  90. data/spec/integration/launcher/launcher_spec.rb +40 -0
  91. data/spec/integration/message_attributes/message_attributes_spec.rb +54 -0
  92. data/spec/integration/message_operations/message_operations_spec.rb +59 -0
  93. data/spec/integration/middleware_chain/empty_chain_spec.rb +11 -0
  94. data/spec/integration/middleware_chain/execution_order_spec.rb +33 -0
  95. data/spec/integration/middleware_chain/removal_spec.rb +31 -0
  96. data/spec/integration/middleware_chain/short_circuit_spec.rb +40 -0
  97. data/spec/integration/polling_strategies/polling_strategies_spec.rb +46 -0
  98. data/spec/integration/queue_operations/queue_operations_spec.rb +84 -0
  99. data/spec/integration/rails/rails_72/Gemfile +6 -0
  100. data/spec/integration/rails/rails_72/activejob_adapter_spec.rb +98 -0
  101. data/spec/integration/rails/rails_80/Gemfile +6 -0
  102. data/spec/integration/rails/rails_80/activejob_adapter_spec.rb +98 -0
  103. data/spec/integration/rails/rails_80/continuation_spec.rb +79 -0
  104. data/spec/integration/rails/rails_81/Gemfile +6 -0
  105. data/spec/integration/rails/rails_81/activejob_adapter_spec.rb +98 -0
  106. data/spec/integration/rails/rails_81/continuation_spec.rb +79 -0
  107. data/spec/integration/retry_behavior/retry_behavior_spec.rb +45 -0
  108. data/spec/integration/spec_helper.rb +7 -0
  109. data/spec/integration/strict_priority_polling/strict_priority_polling_spec.rb +58 -0
  110. data/spec/integration/visibility_timeout/visibility_timeout_spec.rb +37 -0
  111. data/spec/integration/worker_enqueueing/worker_enqueueing_spec.rb +60 -0
  112. data/spec/integration/worker_groups/worker_groups_spec.rb +79 -0
  113. data/spec/integration/worker_lifecycle/worker_lifecycle_spec.rb +33 -0
  114. data/spec/integrations_helper.rb +243 -0
  115. data/spec/lib/active_job/extensions_spec.rb +149 -0
  116. data/spec/lib/active_job/queue_adapters/shoryuken_adapter_spec.rb +29 -0
  117. data/spec/{shoryuken/extensions/active_job_concurrent_send_adapter_spec.rb → lib/active_job/queue_adapters/shoryuken_concurrent_send_adapter_spec.rb} +3 -3
  118. data/spec/{shoryuken/extensions/active_job_wrapper_spec.rb → lib/shoryuken/active_job/job_wrapper_spec.rb} +4 -4
  119. data/spec/{shoryuken → lib/shoryuken}/environment_loader_spec.rb +1 -1
  120. data/spec/{shoryuken → lib/shoryuken}/helpers/hash_utils_spec.rb +14 -14
  121. data/spec/{shoryuken → lib/shoryuken}/helpers/string_utils_spec.rb +3 -3
  122. data/spec/{shoryuken → lib/shoryuken}/helpers_integration_spec.rb +9 -9
  123. data/spec/lib/shoryuken/logging_spec.rb +242 -0
  124. data/spec/lib/shoryuken/message_spec.rb +109 -0
  125. data/spec/lib/shoryuken/middleware/entry_spec.rb +68 -0
  126. data/spec/lib/shoryuken/middleware/server/active_record_spec.rb +133 -0
  127. data/spec/{shoryuken → lib/shoryuken}/middleware/server/auto_extend_visibility_spec.rb +50 -0
  128. data/spec/{shoryuken → lib/shoryuken}/options_spec.rb +2 -2
  129. data/spec/{shoryuken → lib/shoryuken}/util_spec.rb +1 -1
  130. data/spec/lib/shoryuken/version_spec.rb +17 -0
  131. data/spec/lib/shoryuken/worker_registry_spec.rb +63 -0
  132. data/spec/shared_examples_for_active_job.rb +29 -9
  133. data/spec/spec_helper.rb +34 -3
  134. metadata +225 -96
  135. data/.devcontainer/Dockerfile +0 -17
  136. data/.devcontainer/base.Dockerfile +0 -43
  137. data/.devcontainer/devcontainer.json +0 -35
  138. data/Appraisals +0 -17
  139. data/gemfiles/.gitignore +0 -1
  140. data/gemfiles/rails_7_2.gemfile +0 -19
  141. data/gemfiles/rails_8_0.gemfile +0 -19
  142. data/gemfiles/rails_8_1.gemfile +0 -19
  143. data/lib/shoryuken/extensions/active_job_adapter.rb +0 -123
  144. data/lib/shoryuken/extensions/active_job_concurrent_send_adapter.rb +0 -50
  145. data/spec/integration/active_job_continuation_spec.rb +0 -145
  146. data/spec/integration/launcher_spec.rb +0 -127
  147. data/spec/shoryuken/extensions/active_job_adapter_spec.rb +0 -8
  148. data/spec/shoryuken/extensions/active_job_base_spec.rb +0 -85
  149. data/spec/shoryuken/extensions/active_job_continuation_spec.rb +0 -110
  150. /data/spec/{shoryuken → lib/shoryuken}/body_parser_spec.rb +0 -0
  151. /data/spec/{shoryuken → lib/shoryuken}/client_spec.rb +0 -0
  152. /data/spec/{shoryuken → lib/shoryuken}/default_exception_handler_spec.rb +0 -0
  153. /data/spec/{shoryuken → lib/shoryuken}/default_worker_registry_spec.rb +0 -0
  154. /data/spec/{shoryuken → lib/shoryuken}/fetcher_spec.rb +0 -0
  155. /data/spec/{shoryuken → lib/shoryuken}/helpers/atomic_boolean_spec.rb +0 -0
  156. /data/spec/{shoryuken → lib/shoryuken}/helpers/atomic_counter_spec.rb +0 -0
  157. /data/spec/{shoryuken → lib/shoryuken}/helpers/atomic_hash_spec.rb +0 -0
  158. /data/spec/{shoryuken → lib/shoryuken}/helpers/timer_task_spec.rb +0 -0
  159. /data/spec/{shoryuken → lib/shoryuken}/inline_message_spec.rb +0 -0
  160. /data/spec/{shoryuken → lib/shoryuken}/launcher_spec.rb +0 -0
  161. /data/spec/{shoryuken → lib/shoryuken}/manager_spec.rb +0 -0
  162. /data/spec/{shoryuken → lib/shoryuken}/middleware/chain_spec.rb +0 -0
  163. /data/spec/{shoryuken → lib/shoryuken}/middleware/server/auto_delete_spec.rb +0 -0
  164. /data/spec/{shoryuken → lib/shoryuken}/middleware/server/exponential_backoff_retry_spec.rb +0 -0
  165. /data/spec/{shoryuken → lib/shoryuken}/middleware/server/timing_spec.rb +0 -0
  166. /data/spec/{shoryuken → lib/shoryuken}/polling/base_strategy_spec.rb +0 -0
  167. /data/spec/{shoryuken → lib/shoryuken}/polling/queue_configuration_spec.rb +0 -0
  168. /data/spec/{shoryuken → lib/shoryuken}/polling/strict_priority_spec.rb +0 -0
  169. /data/spec/{shoryuken → lib/shoryuken}/polling/weighted_round_robin_spec.rb +0 -0
  170. /data/spec/{shoryuken → lib/shoryuken}/processor_spec.rb +0 -0
  171. /data/spec/{shoryuken → lib/shoryuken}/queue_spec.rb +0 -0
  172. /data/spec/{shoryuken → lib/shoryuken}/runner_spec.rb +0 -0
  173. /data/spec/{shoryuken → lib/shoryuken}/worker/default_executor_spec.rb +0 -0
  174. /data/spec/{shoryuken → lib/shoryuken}/worker/inline_executor_spec.rb +0 -0
  175. /data/spec/{shoryuken → lib/shoryuken}/worker_spec.rb +0 -0
  176. /data/spec/{shoryuken_spec.rb → lib/shoryuken_spec.rb} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 44ec6add623605d696f0a4151aab96d37331250fa66a6b804edea13b06a2b816
4
- data.tar.gz: efe2733bb86113a83b7788041262421c84ee4c50a47718b32ef8bdb505fa15fe
3
+ metadata.gz: 8aa80df1d9e932b7541e1ced2dc836e8d16334f886d304928f7b1b9d69f9451e
4
+ data.tar.gz: 34c2e2d53e6f25ff1fecbb8992b66c30291f4c386cc89bea1daeb2fee7070fa9
5
5
  SHA512:
6
- metadata.gz: 84daafb107ff842e74cdb3872885b6c01ea34d95a5eaf6cf2efeeb3398bc835e570ea5b7f93b9451e4e5841d1d27b53ea35db677a4ddd78cdd75c13b417eebae
7
- data.tar.gz: ad0dcb19240b8179c62bb6b74e23b1801d1f0d671a0f72a5b26d74a0bbd1f47158abd57a6cee091d88fe903ea91ce09afd34702f9086cb4b2cf14a9a17397509
6
+ metadata.gz: 8a7ec77e7eb0f199fa6ee0ad22e3c3750b896832943d4a388c7e8c41aa6ac6273ada3d2683e06fc452fc37c5e30ac12fe3476df9a141cd36351521c4f040fba5
7
+ data.tar.gz: bd79f0794dbf0b3b00902452cfce63410d8c5c835ad08a012c385f21a7fc228bd41b824e1abdbcfd13e26b52f7ebaeec271c9e7a4053ac11a99cf2a6115f023c
@@ -19,12 +19,12 @@ jobs:
19
19
  id-token: write
20
20
 
21
21
  steps:
22
- - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
22
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
23
23
  with:
24
24
  fetch-depth: 0
25
25
 
26
26
  - name: Set up Ruby
27
- uses: ruby/setup-ruby@d5126b9b3579e429dd52e51e68624dda2e05be25 # v1.267.0
27
+ uses: ruby/setup-ruby@708024e6c902387ab41de36e1669e43b5ee7085e # v1.283.0
28
28
  with:
29
29
  bundler-cache: false
30
30
 
@@ -2,17 +2,36 @@ name: Specs
2
2
  on:
3
3
  - push
4
4
  - pull_request
5
+ permissions:
6
+ contents: read
5
7
  jobs:
6
- all_specs:
7
- name: All Specs
8
+ specs:
9
+ name: Specs
8
10
  strategy:
9
11
  matrix:
10
- ruby: ['3.1', '3.2', '3.3', '3.4']
11
- gemfile: ['Gemfile']
12
+ ruby: ['3.2', '3.3', '3.4', '4.0']
12
13
  runs-on: ubuntu-latest
13
14
  steps:
14
15
  - name: Checkout code
15
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
16
+ uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
17
+
18
+ - uses: ruby/setup-ruby@708024e6c902387ab41de36e1669e43b5ee7085e # v1.283.0
19
+ with:
20
+ ruby-version: ${{ matrix.ruby }}
21
+ bundler-cache: true
22
+
23
+ - name: Run specs
24
+ run: bundle exec rake spec
25
+
26
+ integrations:
27
+ name: Integrations
28
+ strategy:
29
+ matrix:
30
+ ruby: ['3.2', '3.3', '3.4', '4.0']
31
+ runs-on: ubuntu-latest
32
+ steps:
33
+ - name: Checkout code
34
+ uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
16
35
 
17
36
  - name: Start LocalStack
18
37
  run: docker compose up -d
@@ -26,58 +45,21 @@ jobs:
26
45
  done
27
46
  '
28
47
 
29
- - uses: ruby/setup-ruby@d5126b9b3579e429dd52e51e68624dda2e05be25 # v1.267.0
48
+ - uses: ruby/setup-ruby@708024e6c902387ab41de36e1669e43b5ee7085e # v1.283.0
30
49
  with:
31
50
  ruby-version: ${{ matrix.ruby }}
32
51
  bundler-cache: true
33
52
 
34
- - name: Run specs
35
- run: bundle exec rake spec
36
- env:
37
- BUNDLE_GEMFILE: ${{ matrix.gemfile }}
38
-
39
53
  - name: Run integration specs
40
54
  run: bundle exec rake spec:integration
41
- env:
42
- BUNDLE_GEMFILE: ${{ matrix.gemfile }}
43
-
44
- rails_specs:
45
- name: Rails Specs
46
- strategy:
47
- matrix:
48
- rails: ['7.2', '8.0', '8.1']
49
- include:
50
- - rails: '7.2'
51
- ruby: '3.2'
52
- gemfile: gemfiles/rails_7_2.gemfile
53
- - rails: '8.0'
54
- ruby: '3.3'
55
- gemfile: gemfiles/rails_8_0.gemfile
56
- - rails: '8.1'
57
- ruby: '3.4'
58
- gemfile: gemfiles/rails_8_1.gemfile
59
- runs-on: ubuntu-latest
60
- env:
61
- BUNDLE_GEMFILE: ${{ matrix.gemfile }}
62
- steps:
63
- - name: Checkout code
64
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
65
-
66
- - uses: ruby/setup-ruby@d5126b9b3579e429dd52e51e68624dda2e05be25 # v1.267.0
67
- with:
68
- ruby-version: ${{ matrix.ruby }}
69
- bundler-cache: true
70
-
71
- - name: Run Rails specs
72
- run: bundle exec rake spec:rails
73
55
 
74
56
  ci-success:
75
57
  name: CI Success
76
58
  runs-on: ubuntu-latest
77
59
  if: always()
78
60
  needs:
79
- - all_specs
80
- - rails_specs
61
+ - specs
62
+ - integrations
81
63
  steps:
82
64
  - name: Check all jobs passed
83
65
  if: |
@@ -7,7 +7,7 @@ jobs:
7
7
  verify:
8
8
  runs-on: ubuntu-latest
9
9
  steps:
10
- - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
10
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
11
11
  - name: Check SHA pins
12
12
  run: |
13
13
  if grep -E -r "uses: .*/.*@(v[0-9]+|main|master)($|[[:space:]]|$)" --include="*.yml" --include="*.yaml" .github/workflows/ | grep -v "#"; then
data/.gitignore CHANGED
@@ -27,3 +27,6 @@ shoryuken.yml
27
27
  rubocop.html
28
28
  .byebug_history
29
29
  .localstack
30
+ spec/integration/**/Gemfile.lock
31
+ spec/integration/**/vendor/
32
+ spec/integration/**/.bundle/
data/.rspec CHANGED
@@ -1,2 +1,3 @@
1
1
  --color
2
2
  --require spec_helper
3
+ --exclude-pattern "spec/integration/**/*"
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.4.7
1
+ 4.0.0
data/.yard-lint.yml ADDED
@@ -0,0 +1,279 @@
1
+ # YARD-Lint Configuration
2
+ # See https://github.com/mensfeld/yard-lint for documentation
3
+
4
+ # Global settings for all validators
5
+ AllValidators:
6
+ YardOptions:
7
+ - "--private"
8
+ - "--protected"
9
+ Exclude:
10
+ - "\\.git"
11
+ - vendor/**/*
12
+ - node_modules/**/*
13
+ - spec/**/*
14
+ - test/**/*
15
+ - bin/**/*
16
+ - examples/**/*
17
+ - test_workers/**/*
18
+ FailOnSeverity: convention
19
+ MinCoverage: 100
20
+ DiffMode:
21
+ DefaultBaseRef:
22
+
23
+ # Documentation validators
24
+ Documentation/UndocumentedObjects:
25
+ Description: Checks for classes, modules, and methods without documentation.
26
+ Enabled: true
27
+ Severity: error
28
+ ExcludedMethods:
29
+ - initialize/0
30
+ - "/^_/"
31
+
32
+ Documentation/UndocumentedMethodArguments:
33
+ Description: Checks for method parameters without @param tags.
34
+ Enabled: true
35
+ Severity: error
36
+
37
+ Documentation/UndocumentedBooleanMethods:
38
+ Description: Checks that question mark methods document their boolean return.
39
+ Enabled: true
40
+ Severity: error
41
+
42
+ Documentation/UndocumentedOptions:
43
+ Description: Detects methods with options hash parameters but no @option tags.
44
+ Enabled: true
45
+ Severity: error
46
+
47
+ Documentation/MarkdownSyntax:
48
+ Description: Detects common markdown syntax errors in documentation.
49
+ Enabled: true
50
+ Severity: error
51
+
52
+ Documentation/EmptyCommentLine:
53
+ Description: Detects empty comment lines at the start or end of documentation blocks.
54
+ Enabled: true
55
+ Severity: convention
56
+ EnabledPatterns:
57
+ Leading: true
58
+ Trailing: true
59
+
60
+ Documentation/BlankLineBeforeDefinition:
61
+ Description: Detects blank lines between YARD documentation and method definition.
62
+ Enabled: true
63
+ Severity: convention
64
+ OrphanedSeverity: convention
65
+ EnabledPatterns:
66
+ SingleBlankLine: true
67
+ OrphanedDocs: true
68
+
69
+ # Tags validators
70
+ Tags/Order:
71
+ Description: Enforces consistent ordering of YARD tags.
72
+ Enabled: true
73
+ Severity: error
74
+ EnforcedOrder:
75
+ - param
76
+ - option
77
+ - return
78
+ - raise
79
+ - example
80
+
81
+ Tags/InvalidTypes:
82
+ Description: Validates type definitions in @param, @return, @option tags.
83
+ Enabled: true
84
+ Severity: error
85
+ ValidatedTags:
86
+ - param
87
+ - option
88
+ - return
89
+
90
+ Tags/TypeSyntax:
91
+ Description: Validates YARD type syntax using YARD parser.
92
+ Enabled: true
93
+ Severity: error
94
+ ValidatedTags:
95
+ - param
96
+ - option
97
+ - return
98
+ - yieldreturn
99
+
100
+ Tags/MeaninglessTag:
101
+ Description: Detects @param/@option tags on classes, modules, or constants.
102
+ Enabled: true
103
+ Severity: error
104
+ CheckedTags:
105
+ - param
106
+ - option
107
+ InvalidObjectTypes:
108
+ - class
109
+ - module
110
+ - constant
111
+
112
+ Tags/CollectionType:
113
+ Description: Validates Hash collection syntax consistency.
114
+ Enabled: true
115
+ Severity: error
116
+ EnforcedStyle: long
117
+ ValidatedTags:
118
+ - param
119
+ - option
120
+ - return
121
+ - yieldreturn
122
+
123
+ Tags/TagTypePosition:
124
+ Description: Validates type annotation position in tags.
125
+ Enabled: true
126
+ Severity: error
127
+ CheckedTags:
128
+ - param
129
+ - option
130
+ EnforcedStyle: type_after_name
131
+
132
+ Tags/ApiTags:
133
+ Description: Enforces @api tags on public objects.
134
+ Enabled: false
135
+ Severity: error
136
+ AllowedApis:
137
+ - public
138
+ - private
139
+ - internal
140
+
141
+ Tags/OptionTags:
142
+ Description: Requires @option tags for methods with options parameters.
143
+ Enabled: true
144
+ Severity: error
145
+
146
+ Tags/ExampleSyntax:
147
+ Description: Validates Ruby syntax in @example tags.
148
+ Enabled: true
149
+ Severity: warning
150
+
151
+ Tags/RedundantParamDescription:
152
+ Description: Detects meaningless parameter descriptions that add no value.
153
+ Enabled: true
154
+ Severity: convention
155
+ CheckedTags:
156
+ - param
157
+ - option
158
+ Articles:
159
+ - The
160
+ - the
161
+ - A
162
+ - a
163
+ - An
164
+ - an
165
+ MaxRedundantWords: 6
166
+ GenericTerms:
167
+ - object
168
+ - instance
169
+ - value
170
+ - data
171
+ - item
172
+ - element
173
+ EnabledPatterns:
174
+ ArticleParam: true
175
+ PossessiveParam: true
176
+ TypeRestatement: true
177
+ ParamToVerb: true
178
+ IdPattern: true
179
+ DirectionalDate: true
180
+ TypeGeneric: true
181
+
182
+ Tags/InformalNotation:
183
+ Description: Detects informal tag notation patterns like "Note:" instead of @note.
184
+ Enabled: true
185
+ Severity: warning
186
+ CaseSensitive: false
187
+ RequireStartOfLine: true
188
+ Patterns:
189
+ Note: "@note"
190
+ Todo: "@todo"
191
+ TODO: "@todo"
192
+ FIXME: "@todo"
193
+ See: "@see"
194
+ See also: "@see"
195
+ Warning: "@deprecated"
196
+ Deprecated: "@deprecated"
197
+ Author: "@author"
198
+ Version: "@version"
199
+ Since: "@since"
200
+ Returns: "@return"
201
+ Raises: "@raise"
202
+ Example: "@example"
203
+
204
+ Tags/NonAsciiType:
205
+ Description: Detects non-ASCII characters in type annotations.
206
+ Enabled: true
207
+ Severity: warning
208
+ ValidatedTags:
209
+ - param
210
+ - option
211
+ - return
212
+ - yieldreturn
213
+ - yieldparam
214
+
215
+ Tags/TagGroupSeparator:
216
+ Description: Enforces blank line separators between different YARD tag groups.
217
+ Enabled: false
218
+ Severity: convention
219
+ TagGroups:
220
+ param:
221
+ - param
222
+ - option
223
+ return:
224
+ - return
225
+ error:
226
+ - raise
227
+ - throws
228
+ example:
229
+ - example
230
+ meta:
231
+ - see
232
+ - note
233
+ - todo
234
+ - deprecated
235
+ - since
236
+ - version
237
+ - api
238
+ yield:
239
+ - yield
240
+ - yieldparam
241
+ - yieldreturn
242
+ RequireAfterDescription: false
243
+
244
+ # Warnings validators - catches YARD parser errors
245
+ Warnings/UnknownTag:
246
+ Description: Detects unknown YARD tags.
247
+ Enabled: true
248
+ Severity: error
249
+
250
+ Warnings/UnknownDirective:
251
+ Description: Detects unknown YARD directives.
252
+ Enabled: true
253
+ Severity: error
254
+
255
+ Warnings/InvalidTagFormat:
256
+ Description: Detects malformed tag syntax.
257
+ Enabled: true
258
+ Severity: error
259
+
260
+ Warnings/InvalidDirectiveFormat:
261
+ Description: Detects malformed directive syntax.
262
+ Enabled: true
263
+ Severity: error
264
+
265
+ Warnings/DuplicatedParameterName:
266
+ Description: Detects duplicate @param tags.
267
+ Enabled: true
268
+ Severity: error
269
+
270
+ Warnings/UnknownParameterName:
271
+ Description: Detects @param tags for non-existent parameters.
272
+ Enabled: true
273
+ Severity: error
274
+
275
+ # Semantic validators
276
+ Semantic/AbstractMethods:
277
+ Description: Ensures @abstract methods do not have real implementations.
278
+ Enabled: true
279
+ Severity: error
data/CHANGELOG.md CHANGED
@@ -1,16 +1,70 @@
1
- ## [7.0.0] - Unreleased
1
+ ## [7.0.0] - 2026-01-19
2
+
3
+ **See the [Upgrading to 7.0](https://github.com/ruby-shoryuken/shoryuken/wiki/Upgrading-to-7.0) guide for detailed migration instructions.**
4
+
5
+ - Breaking: Add `Shoryuken::Errors` module with domain-specific error classes
6
+ - Introduces `Shoryuken::Errors::BaseError` as base class for all Shoryuken errors
7
+ - `Shoryuken::Errors::QueueNotFoundError` for non-existent or inaccessible SQS queues
8
+ - `Shoryuken::Errors::InvalidConfigurationError` for configuration validation failures
9
+ - `Shoryuken::Errors::InvalidWorkerRegistrationError` for worker registration conflicts
10
+ - `Shoryuken::Errors::InvalidPollingStrategyError` for invalid polling strategy configuration
11
+ - `Shoryuken::Errors::InvalidEventError` for invalid lifecycle event names
12
+ - `Shoryuken::Errors::InvalidDelayError` for delays exceeding SQS 15-minute maximum
13
+ - `Shoryuken::Errors::InvalidArnError` for invalid ARN format
14
+ - Replaces generic Ruby exceptions (ArgumentError, RuntimeError) with specific error types
15
+
16
+ - Removed: `Shoryuken::Shutdown` class
17
+ - This class was unused since the Celluloid removal in 2016
18
+ - Originally used to raise on worker threads during hard shutdown
19
+ - Current shutdown flow uses `Interrupt` and executor-level shutdown instead
20
+
21
+ - Fix: Raise ArgumentError when using delay with FIFO queues
22
+ - FIFO queues do not support per-message DelaySeconds
23
+ - Previously caused confusing AWS errors with ActiveJob's `retry_on` (Rails 6.1+ defaults to `wait: 3.seconds`)
24
+ - Now raises clear ArgumentError with guidance to use `wait: 0`
25
+ - Fixes #924
26
+
27
+ - Enhancement: Use fiber-local storage for logging context
28
+ - Replaces thread-local storage with Fiber[] for proper isolation in async environments
29
+ - Ensures logging context doesn't leak between fibers in the same thread
30
+ - Leverages Ruby 3.2+ fiber-local storage API
31
+
32
+ - Enhancement: Add yard-lint with comprehensive YARD documentation
33
+ - Adds yard-lint gem for documentation linting
34
+ - Documents all public classes, modules, and methods with YARD tags
35
+ - Ensures 100% documentation coverage
36
+
37
+ - Enhancement: Add `enqueue_all` for bulk ActiveJob enqueuing (Rails 7.1+)
38
+ - Implements efficient bulk enqueuing using SQS `send_message_batch` API
39
+ - Called by `ActiveJob.perform_all_later` for batching multiple jobs
40
+ - Batches jobs in groups of 10 (SQS limit) per queue
41
+ - Groups jobs by queue name for efficient multi-queue handling
42
+
2
43
  - Enhancement: Add ActiveJob Continuations support (Rails 8.1+)
3
44
  - Implements `stopping?` method in ActiveJob adapters to signal graceful shutdown
4
45
  - Enables jobs to checkpoint progress and resume after interruption
5
46
  - Handles past timestamps correctly (SQS treats negative delays as immediate delivery)
6
47
  - Tracks shutdown state in Launcher via `stopping?` flag
7
48
  - Leverages existing Shoryuken shutdown lifecycle (stop/stop! methods)
8
- - Includes comprehensive integration tests with continuable jobs
9
49
  - See Rails PR #55127 for more details on ActiveJob Continuations
10
50
 
51
+ - Enhancement: Add CurrentAttributes persistence support
52
+ - Enables Rails `ActiveSupport::CurrentAttributes` to flow from enqueue to job execution
53
+ - Automatically serializes current attributes into job payload when enqueuing
54
+ - Restores attributes before job execution and resets them afterward
55
+ - Supports multiple CurrentAttributes classes
56
+ - Based on Sidekiq's approach using `ActiveJob::Arguments` for serialization
57
+ - Usage: `require 'shoryuken/active_job/current_attributes'` and
58
+ `Shoryuken::ActiveJob::CurrentAttributes.persist('MyApp::Current')`
59
+
60
+ - Breaking: Drop support for Ruby 3.1 (EOL March 2025)
61
+ - Minimum required Ruby version is now 3.2.0
62
+ - Supported Ruby versions: 3.2, 3.3, 3.4
63
+ - Users on Ruby 3.1 should upgrade or remain on Shoryuken 6.x
64
+
11
65
  - Breaking: Remove support for Rails versions older than 7.2
12
- - Rails 7.0 and 7.1 have reached end-of-life and are no longer supported
13
- - Supported versions: Rails 7.2, 8.0, and 8.1
66
+ - Rails 7.0 and 7.1 have reached end-of-life (April 2025) and are no longer supported
67
+ - Supported Rails versions: 7.2, 8.0, and 8.1
14
68
  - Users on older Rails versions should upgrade or remain on Shoryuken 6.x
15
69
 
16
70
  - Enhancement: Replace Concurrent::AtomicFixnum with pure Ruby AtomicCounter
data/Gemfile CHANGED
@@ -9,10 +9,10 @@ group :test do
9
9
  gem 'multi_xml'
10
10
  gem 'simplecov'
11
11
  gem 'warning'
12
+ gem 'yard-lint'
12
13
  end
13
14
 
14
15
  group :development do
15
- gem 'appraisal', git: 'https://github.com/thoughtbot/appraisal.git'
16
16
  gem 'pry-byebug'
17
17
  gem 'rubocop'
18
18
  end
data/README.md CHANGED
@@ -63,15 +63,10 @@ To run all unit specs against the latest dependency versions, execute
63
63
  bundle exec rake spec
64
64
  ```
65
65
 
66
- To run all Rails-related specs against all supported versions of Rails, execute
67
-
68
- ```sh
69
- bundle exec appraisal rake spec:rails
70
- ```
71
-
72
- To run integration specs, start a mock SQS server on `localhost:5000`. One such option is [cjlarose/moto-sqs-server](https://github.com/cjlarose/moto-sqs-server). Then execute
66
+ To run integration specs (including Rails tests), start LocalStack and run:
73
67
 
74
68
  ```sh
69
+ docker compose up -d
75
70
  bundle exec rake spec:integration
76
71
  ```
77
72
 
data/Rakefile CHANGED
@@ -5,19 +5,13 @@ $stdout.sync = true
5
5
 
6
6
  begin
7
7
  require 'rspec/core/rake_task'
8
- RSpec::Core::RakeTask.new(:spec) do |t|
9
- t.exclude_pattern = 'spec/integration/**/*_spec.rb'
10
- end
8
+ RSpec::Core::RakeTask.new(:spec)
11
9
 
12
10
  namespace :spec do
13
- desc 'Run Rails specs only'
14
- RSpec::Core::RakeTask.new(:rails) do |t|
15
- t.pattern = 'spec/shoryuken/{environment_loader_spec,extensions/active_job_*}.rb'
16
- end
17
-
18
11
  desc 'Run integration specs only'
19
- RSpec::Core::RakeTask.new(:integration) do |t|
20
- t.pattern = 'spec/integration/**/*_spec.rb'
12
+ task :integration do
13
+ puts "Running integration tests..."
14
+ system('./bin/integrations') || exit(1)
21
15
  end
22
16
  end
23
17
  rescue LoadError
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ # Removes all integration test SQS queues from LocalStack
5
+ #
6
+ # Useful when having a long-running LocalStack instance that cannot be fully
7
+ # restarted between test runs. All integration test queues use the 'it-' prefix,
8
+ # making them easy to identify and remove.
9
+ #
10
+ # Usage:
11
+ # bin/clean_localstack
12
+
13
+ require 'aws-sdk-sqs'
14
+
15
+ THREADS_COUNT = 3
16
+
17
+ sqs = Aws::SQS::Client.new(
18
+ region: 'us-east-1',
19
+ endpoint: 'http://localhost:4566',
20
+ access_key_id: 'fake',
21
+ secret_access_key: 'fake'
22
+ )
23
+
24
+ # Find all queues with 'it-' prefix
25
+ response = sqs.list_queues(queue_name_prefix: 'it-')
26
+ queues_for_removal = response.queue_urls || []
27
+
28
+ if queues_for_removal.empty?
29
+ puts "No integration test queues found (prefix: it-)"
30
+ exit 0
31
+ end
32
+
33
+ puts "Found #{queues_for_removal.size} queues to remove"
34
+
35
+ queue = SizedQueue.new(THREADS_COUNT)
36
+
37
+ threads = Array.new(THREADS_COUNT) do
38
+ Thread.new do
39
+ while (queue_url = queue.pop)
40
+ queue_name = queue_url.split('/').last
41
+ puts "Removing queue: #{queue_name}"
42
+ sqs.delete_queue(queue_url: queue_url)
43
+ end
44
+ end
45
+ end
46
+
47
+ queues_for_removal.each { |url| queue << url }
48
+
49
+ queue.close
50
+ threads.each(&:join)
51
+
52
+ puts "Cleanup complete"
data/bin/cli/base.rb CHANGED
@@ -1,7 +1,14 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Shoryuken
2
4
  module CLI
5
+ # Base class for CLI commands providing common helper methods.
3
6
  class Base < Thor
4
7
  no_commands do
8
+ # Prints entries as a formatted table
9
+ #
10
+ # @param entries [Array<Array>] rows to print as a table
11
+ # @return [void]
5
12
  def print_table(entries)
6
13
  column_sizes = print_columns_size(entries)
7
14
 
@@ -10,6 +17,10 @@ module Shoryuken
10
17
  end
11
18
  end
12
19
 
20
+ # Calculates the maximum width for each column
21
+ #
22
+ # @param entries [Array<Array>] the table rows
23
+ # @return [Hash<Integer, Integer>] column index to max width mapping
13
24
  def print_columns_size(entries)
14
25
  column_sizes = Hash.new(0)
15
26
 
@@ -23,11 +34,21 @@ module Shoryuken
23
34
  column_sizes
24
35
  end
25
36
 
37
+ # Formats a column value with padding
38
+ #
39
+ # @param column [Object] the column value to format
40
+ # @param size [Integer] the target width
41
+ # @return [String] the formatted column
26
42
  def print_format_column(column, size)
27
43
  size_with_padding = size + 4
28
44
  column.to_s.ljust(size_with_padding)
29
45
  end
30
46
 
47
+ # Outputs a failure message and optionally exits
48
+ #
49
+ # @param msg [String] the failure message
50
+ # @param quit [Boolean] whether to exit the program
51
+ # @return [void]
31
52
  def fail_task(msg, quit = true)
32
53
  say "[FAIL] #{msg}", :red
33
54
  exit(1) if quit