sidekiq-undertaker 1.7.0 → 1.8.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 (33) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby-build.yml +4 -2
  3. data/.rubocop.yml +3 -2
  4. data/.rubocop_todo.yml +12 -8
  5. data/CHANGELOG.md +12 -1
  6. data/Gemfile +4 -4
  7. data/README.md +1 -0
  8. data/lib/sidekiq/undertaker/version.rb +1 -1
  9. data/lib/sidekiq/undertaker/web_extension/api_helpers.rb +43 -32
  10. data/lib/sidekiq/undertaker.rb +5 -3
  11. data/renovate.json +3 -2
  12. data/sidekiq-undertaker.gemspec +3 -3
  13. data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_filter/when_filter_page_is_called/behaves_like_a_page/the_displayed_page_is_correct_for_sidekiqv8.approved.txt +377 -0
  14. data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_filter/when_job_classbucket_page_is_called/behaves_like_a_page/the_displayed_page_is_correct_for_sidekiqv8.approved.txt +362 -0
  15. data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_filter/when_job_classbucket_page_is_polled/behaves_like_a_page/the_displayed_page_is_correct_for_sidekiqv8.approved.txt +362 -0
  16. data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_filter/when_job_classerror_classbucket_page_is_called/behaves_like_a_page/the_displayed_page_is_correct_for_sidekiqv8.approved.txt +352 -0
  17. data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_filter/when_job_classerror_classbucket_page_is_polled/behaves_like_a_page/the_displayed_page_is_correct_for_sidekiqv8.approved.txt +352 -0
  18. data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_morgue/when_job_classerrorbucket_is_called/with_all_failures_and_errors/behaves_like_a_page/{the_displayed_page_is_correct_for_sidekiqv7.approved.txt → the_displayed_page_is_correct_for_sidekiqv8.approved.txt} +205 -93
  19. data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_morgue/when_job_classerrorbucket_is_called/with_job_class_error_and_specific_error_message/behaves_like_a_page/{the_displayed_page_is_correct_for_sidekiqv7.approved.txt → the_displayed_page_is_correct_for_sidekiqv8.approved.txt} +203 -91
  20. data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_morgue/when_job_classerrorbucket_is_called/with_job_class_error_and_specific_error_message/with_pagination/behaves_like_a_page/{the_displayed_page_is_correct_for_sidekiqv7.approved.txt → the_displayed_page_is_correct_for_sidekiqv8.approved.txt} +269 -155
  21. data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_morgue/when_job_classerrorbucket_is_called/with_specific_job_class_and_a_specific_error/behaves_like_a_page/the_displayed_page_is_correct_for_sidekiqv8.approved.txt +407 -0
  22. data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_morgue/when_job_classerrorbucket_is_called/with_specific_job_class_and_a_specific_error/with_pagination/behaves_like_a_page/{the_displayed_page_is_correct_for_sidekiqv7.approved.txt → the_displayed_page_is_correct_for_sidekiqv8.approved.txt} +269 -155
  23. data/spec/sidekiq/undertaker/web_extension_spec.rb +12 -13
  24. data/spec/spec_helper.rb +13 -0
  25. data/spec/support/monkey_patch/approvals/writers/text_writer.rb +20 -0
  26. metadata +17 -17
  27. data/.github/dependabot.yml +0 -8
  28. data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_filter/when_filter_page_is_called/behaves_like_a_page/the_displayed_page_is_correct_for_sidekiqv7.approved.txt +0 -265
  29. data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_filter/when_job_classbucket_page_is_called/behaves_like_a_page/the_displayed_page_is_correct_for_sidekiqv7.approved.txt +0 -250
  30. data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_filter/when_job_classbucket_page_is_polled/behaves_like_a_page/the_displayed_page_is_correct_for_sidekiqv7.approved.txt +0 -250
  31. data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_filter/when_job_classerror_classbucket_page_is_called/behaves_like_a_page/the_displayed_page_is_correct_for_sidekiqv7.approved.txt +0 -240
  32. data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_filter/when_job_classerror_classbucket_page_is_polled/behaves_like_a_page/the_displayed_page_is_correct_for_sidekiqv7.approved.txt +0 -240
  33. data/spec/fixtures/approvals/sidekiq_undertaker_webextension/show_morgue/when_job_classerrorbucket_is_called/with_specific_job_class_and_a_specific_error/behaves_like_a_page/the_displayed_page_is_correct_for_sidekiqv7.approved.txt +0 -295
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0359e510258ac3be48937b1bccc12a4585c99fb3c75aa3e3add9239ac0ec4cff'
4
- data.tar.gz: 1ba883ee46aa19e5887b3d6bd17bd2efcbb0c73c7f7b3abead70f36ea7e18957
3
+ metadata.gz: 0ac5227e064151d05774f0446bf8aa4cf02e488c9689c1a8bb3c71ed93b9f0fc
4
+ data.tar.gz: 42c47061b8a366b275f486f4dc7866ef066bc3ecbe8cbf3cb20c9a17d2299f7f
5
5
  SHA512:
6
- metadata.gz: 37d24a25149c44d1884b840face88728f89187cafae0cbe2c734dd3f39d3412ad6bf3a3faec596daac144b58efc5bec348cb24eab1bc3a5c531ce31d3342fc39
7
- data.tar.gz: 2da7fee92e23648bf9f1a051f40adf358c605ec108e58666a81ee654164fd5792573417f1a8157ca061e79816d62e6b582d5f1182efdc8816d757a741702b1a5
6
+ metadata.gz: 7b462971e556909f8ace910d541c993a0a5ced6f081262da4497a57799bfe89b7247826a4b2a42931d4974dc9ad952a1647e191390aa9a315ed275f9583cdec9
7
+ data.tar.gz: 3032d2ee35ff319103150e3c3600c9c2905db3f9d60d1038e408a6a7a63ca1febf3b9f9e3554596903ab78fce8c3a86fc007c4335a0ddbe274c8c3f77f23f9b2
@@ -30,9 +30,11 @@ jobs:
30
30
  matrix:
31
31
  # SEE: https://github.com/ruby/setup-ruby#supported-versions
32
32
  # https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs#expanding-or-adding-matrix-configurations
33
- ruby-version: ['ruby', '3.1', '3.2', 'jruby', 'jruby-9.4.4.0']
33
+ ruby-version: ['head', '3.4', '3.3', '3.2']
34
34
  experimental: [false]
35
35
  include: # HINT: Do not use arrays for values here
36
+ - ruby-version: 'jruby'
37
+ experimental: true
36
38
  - ruby-version: 'truffleruby'
37
39
  experimental: true
38
40
  - ruby-version: 'truffleruby+graalvm'
@@ -71,7 +73,7 @@ jobs:
71
73
  with:
72
74
  name: coverage-report
73
75
  path: ./coverage
74
- - uses: paambaati/codeclimate-action@v5.0.0
76
+ - uses: paambaati/codeclimate-action@v9.0.0
75
77
  env:
76
78
  # Set CC_TEST_REPORTER_ID as secret of your repo
77
79
  CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
data/.rubocop.yml CHANGED
@@ -1,13 +1,14 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
- require:
3
+ plugins:
4
4
  - rubocop-rake
5
5
  - rubocop-rspec
6
6
 
7
+ require:
7
8
  - rt_rubocop_defaults
8
9
 
9
10
  AllCops:
10
- TargetRubyVersion: 3.1
11
+ TargetRubyVersion: 3.2
11
12
  Layout/LineLength:
12
13
  Exclude:
13
14
  - 'sidekiq-undertaker.gemspec'
data/.rubocop_todo.yml CHANGED
@@ -1,20 +1,15 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2023-12-16 11:38:55 UTC using RuboCop version 1.59.0.
3
+ # on 2025-03-13 16:14:24 UTC using RuboCop version 1.74.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 4
9
+ # Offense count: 3
10
10
  # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Severity.
11
11
  Metrics/AbcSize:
12
- Max: 22
13
-
14
- # Offense count: 1
15
- # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, Severity.
16
- Metrics/MethodLength:
17
- Max: 14
12
+ Max: 19
18
13
 
19
14
  # Offense count: 21
20
15
  # Configuration parameters: Max, AllowedIdentifiers, AllowedPatterns.
@@ -29,3 +24,12 @@ RSpec/IndexedLet:
29
24
  # SupportedStyles: have_received, receive
30
25
  RSpec/MessageSpies:
31
26
  EnforcedStyle: receive
27
+
28
+ # Offense count: 1
29
+ # This cop supports unsafe autocorrection (--autocorrect-all).
30
+ # Configuration parameters: EnforcedStyle.
31
+ # SupportedStyles: always, always_true, never
32
+ Style/FrozenStringLiteralComment:
33
+ Exclude:
34
+ - '**/*.arb'
35
+ - 'spec/support/monkey_patch/approvals/writers/text_writer.rb'
data/CHANGELOG.md CHANGED
@@ -2,9 +2,20 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
- ## [1.7.0] - 2023-12-15
5
+ ## [1.8.0] - 2025-03-17
6
6
 
7
7
  ## Changed
8
+ - Remove Dependabot
9
+ - Add Renovate dependency dashboard
10
+ - Update test dependency sinatra to v4
11
+ - Update paambaati/codeclimate-action action to v9
12
+ - Update build config
13
+ - Upgrade Sidekiq to version 8
14
+ - Drop Ruby 3.1 suppport
15
+
16
+ ## [1.7.0] - 2023-12-15
17
+
18
+ ### Changed
8
19
  - Dropped Ruby 2.x support
9
20
  - Dropped Sidekiq 6.x support
10
21
  - Updated rspec-sidekiq to 4.1
data/Gemfile CHANGED
@@ -2,21 +2,21 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "approvals", "~> 0.0.25"
5
+ gem "approvals", "~> 0.1.0"
6
6
  gem "mock_redis", "~> 0.19"
7
7
  gem "pry", "~> 0.12"
8
8
  gem "rack-test", "~> 2.0"
9
9
  gem "rake", "~> 13.0"
10
10
  gem "rb-readline", "~> 0.5"
11
11
  gem "rspec", "~> 3.12"
12
- gem "rspec-sidekiq", "~> 4.1"
12
+ gem "rspec-sidekiq", "~> 5.0"
13
13
  gem "rt_rubocop_defaults", "~> 2.6"
14
14
  gem "rubocop", "~> 1.59"
15
15
  gem "rubocop-rake", "~> 0.6"
16
- gem "rubocop-rspec", "~> 2.25"
16
+ gem "rubocop-rspec", "~> 3.0"
17
17
  gem "rubocop_runner", "~> 2.2"
18
18
  gem "simplecov", "~> 0.21"
19
- gem "sinatra", "~> 3.1"
19
+ gem "sinatra", "~> 4.0"
20
20
  gem "timecop", "~> 0.9"
21
21
 
22
22
  # Good for debuging on travis-ci.org
data/README.md CHANGED
@@ -84,6 +84,7 @@ The [Sidekiq-Cleaner](https://github.com/HackingHabits/sidekiq-cleaner) gem was
84
84
  [Zlatko Rednjak](https://github.com/Rednjak) added the initial version of the `CHANGELOG.md`.
85
85
  [Lucas Dell'Isola](https://github.com/ldellisola) added the export/import feature for dead jobs.
86
86
  [thoesl](https://github.com/thoesl) added the error message based filter.
87
+ [Simon Himmelreich](https://github.com/shimel1) prepared the upgrade to Sidekiq 8.
87
88
 
88
89
  For the complete list of network members have a look at the [fork overview](https://github.com/ThomasKoppensteiner/sidekiq-undertaker/network/members).
89
90
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Sidekiq
4
4
  module Undertaker
5
- VERSION = "1.7.0"
5
+ VERSION = "1.8.0"
6
6
  end
7
7
  end
@@ -16,7 +16,7 @@ module Sidekiq
16
16
  def show_filter
17
17
  store_request_params
18
18
 
19
- @dead_jobs = Sidekiq::Undertaker::JobFilter.filter_dead_jobs(parsed_params)
19
+ @dead_jobs = Sidekiq::Undertaker::JobFilter.filter_dead_jobs(filter_params)
20
20
  @distribution = Sidekiq::Undertaker::JobDistributor.new(@dead_jobs).group_by_job_class
21
21
  @total_dead = @dead_jobs.size
22
22
 
@@ -26,7 +26,7 @@ module Sidekiq
26
26
  def show_filter_by_job_class_bucket_name
27
27
  store_request_params
28
28
 
29
- @dead_jobs = Sidekiq::Undertaker::JobFilter.filter_dead_jobs(parsed_params)
29
+ @dead_jobs = Sidekiq::Undertaker::JobFilter.filter_dead_jobs(filter_params)
30
30
  @distribution = Sidekiq::Undertaker::JobDistributor.new(@dead_jobs).group_by_error_class
31
31
  @total_dead = @dead_jobs.size
32
32
 
@@ -36,7 +36,7 @@ module Sidekiq
36
36
  def show_filter_by_job_class_error_class_bucket_name
37
37
  store_request_params
38
38
 
39
- @dead_jobs = Sidekiq::Undertaker::JobFilter.filter_dead_jobs(parsed_params)
39
+ @dead_jobs = Sidekiq::Undertaker::JobFilter.filter_dead_jobs(filter_params)
40
40
  @distribution = Sidekiq::Undertaker::JobDistributor.new(@dead_jobs).group_by_error_msg
41
41
  @total_dead = @dead_jobs.size
42
42
 
@@ -46,7 +46,7 @@ module Sidekiq
46
46
  def show_undertaker_by_job_class_error_class_error_msg_bucket_name
47
47
  store_request_params
48
48
 
49
- @dead_jobs = Sidekiq::Undertaker::JobFilter.filter_dead_jobs(parsed_params)
49
+ @dead_jobs = Sidekiq::Undertaker::JobFilter.filter_dead_jobs(filter_params)
50
50
 
51
51
  # Display dead jobs as list
52
52
  @dead_jobs = @dead_jobs.map(&:job)
@@ -55,7 +55,7 @@ module Sidekiq
55
55
 
56
56
  # Pagination
57
57
  @total_dead = @dead_jobs.size
58
- @current_page = (parsed_params[:page] || 1).to_i
58
+ @current_page = (url_params("page") || 1).to_i
59
59
  @count = 50 # per page
60
60
  @dead_jobs = @dead_jobs[((@current_page - 1) * @count), @count]
61
61
 
@@ -65,18 +65,19 @@ module Sidekiq
65
65
 
66
66
  # Remove unrelated arguments to allow _paginate url to be clean
67
67
  # Hack to continue to reuse sidekiq's _pagination template
68
- params.delete("job_class")
69
- params.delete("bucket_name")
70
- params.delete("error_class")
71
- params.delete("error_msg")
68
+ # FIXME: https://github.com/sidekiq/sidekiq/blob/main/lib/sidekiq/web/action.rb#L64-L67
69
+ # params.delete("job_class")
70
+ # params.delete("bucket_name")
71
+ # params.delete("error_class")
72
+ # params.delete("error_msg")
72
73
 
73
74
  render_result("morgue.erb")
74
75
  end
75
76
 
76
77
  def post_undertaker
77
- raise ::ArgumentError.new("Key missing") unless parsed_params["key"]
78
+ raise ::ArgumentError.new("Key missing") unless url_params("key")
78
79
 
79
- jobs = parsed_params["key"].map { |k| Sidekiq::DeadSet.new.fetch(*parse_params(k)).first }.compact
80
+ jobs = url_params("key").map { |k| Sidekiq::DeadSet.new.fetch(*parse_key(k)).first }.compact
80
81
 
81
82
  handle_selected_jobs jobs
82
83
  rescue ::ArgumentError
@@ -84,11 +85,11 @@ module Sidekiq
84
85
  end
85
86
 
86
87
  def handle_selected_jobs(jobs)
87
- return send_data(*prepare_data(jobs.map(&:item), EXPORT_CHUNK_SIZE)) if parsed_params["export"]
88
+ return send_data(*prepare_data(jobs.map(&:item), EXPORT_CHUNK_SIZE)) if url_params("export")
88
89
 
89
- if parsed_params["retry"]
90
+ if url_params("retry")
90
91
  jobs.each(&:retry)
91
- elsif parsed_params["delete"]
92
+ elsif url_params("delete")
92
93
  jobs.each(&:delete)
93
94
  end
94
95
 
@@ -97,7 +98,7 @@ module Sidekiq
97
98
 
98
99
  def post_undertaker_job_class_error_class_error_msg_bucket_name_delete
99
100
  store_request_params
100
- @dead_jobs = Sidekiq::Undertaker::JobFilter.filter_dead_jobs(parsed_params)
101
+ @dead_jobs = Sidekiq::Undertaker::JobFilter.filter_dead_jobs(filter_params)
101
102
  @dead_jobs.each do |dead_job|
102
103
  dead_job.job.delete
103
104
  end
@@ -108,7 +109,7 @@ module Sidekiq
108
109
  def post_undertaker_job_class_error_class_error_msg_bucket_name_retry
109
110
  store_request_params
110
111
 
111
- @dead_jobs = Sidekiq::Undertaker::JobFilter.filter_dead_jobs(parsed_params)
112
+ @dead_jobs = Sidekiq::Undertaker::JobFilter.filter_dead_jobs(filter_params)
112
113
  @dead_jobs.each do |dead_job|
113
114
  dead_job.job.retry
114
115
  end
@@ -118,16 +119,15 @@ module Sidekiq
118
119
 
119
120
  def post_undertaker_job_class_error_class_error_msg_bucket_name_export
120
121
  store_request_params
121
-
122
- @dead_jobs = Sidekiq::Undertaker::JobFilter.filter_dead_jobs(parsed_params)
122
+ @dead_jobs = Sidekiq::Undertaker::JobFilter.filter_dead_jobs(filter_params)
123
123
  send_data(*prepare_data(@dead_jobs.map { |j| j.job.item }, EXPORT_CHUNK_SIZE))
124
124
  end
125
125
 
126
126
  def post_import_jobs
127
- file = parsed_params["upload_file"]
127
+ file = url_params("upload_file")
128
128
  raise ::ArgumentError.new("The file is not a json") if file.nil? || file[:type] != "application/json"
129
129
 
130
- data = parsed_params["upload_file"][:tempfile].read
130
+ data = url_params("upload_file")[:tempfile].read
131
131
  dead_set = Sidekiq::DeadSet.new
132
132
 
133
133
  JSON.parse(data).each do |job|
@@ -143,18 +143,29 @@ module Sidekiq
143
143
  end
144
144
 
145
145
  def store_request_params
146
- @req_job_class = parsed_params["job_class"]
147
- @req_bucket_name = parsed_params["bucket_name"]
148
- @req_error_class = parsed_params["error_class"]
149
- @req_error_msg = parsed_params["error_msg"]
150
- end
151
-
152
- def parsed_params
153
- @parsed_params ||= if params["error_msg"] && params["error_msg"] != "all"
154
- params.merge("error_msg" => Base64.urlsafe_decode64(params["error_msg"]))
155
- else
156
- params
157
- end
146
+ @req_bucket_name = parsed_route_params(:bucket_name)
147
+ @req_error_class = parsed_route_params(:error_class)
148
+ @req_error_msg = parsed_route_params(:error_msg)
149
+ @req_job_class = parsed_route_params(:job_class)
150
+ end
151
+
152
+ def filter_params
153
+ {
154
+ "bucket_name" => parsed_route_params(:bucket_name),
155
+ "error_class" => parsed_route_params(:error_class),
156
+ "error_msg" => parsed_route_params(:error_msg),
157
+ "job_class" => parsed_route_params(:job_class)
158
+ }
159
+ end
160
+
161
+ def parsed_route_params(key)
162
+ if key == :error_msg
163
+ msg = route_params(key)
164
+ msg = Base64.urlsafe_decode64(msg) if !msg.nil? && msg != "all"
165
+ msg
166
+ else
167
+ route_params(key)
168
+ end
158
169
  end
159
170
 
160
171
  def view_path
@@ -10,9 +10,11 @@ rescue LoadError
10
10
  end
11
11
 
12
12
  if defined?(Sidekiq::Web)
13
- Sidekiq::Web.register Sidekiq::Undertaker::WebExtension
14
- Sidekiq::Web.tabs["Undertaker"] = "undertaker/filter"
15
- Sidekiq::Web.settings.locales << File.join(File.dirname(__FILE__), "../../web/locales")
13
+ Sidekiq::Web.configure do |config|
14
+ config.register(Sidekiq::Undertaker::WebExtension, name: "Undertaker", tab: "Undertaker",
15
+ index: "undertaker/filter")
16
+ config.locales << File.join(File.dirname(__FILE__), "../../web/locales")
17
+ end
16
18
  end
17
19
 
18
20
  module Sidekiq
data/renovate.json CHANGED
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "extends": [
3
- "config:base"
4
- ]
3
+ "config:recommended"
4
+ ],
5
+ "dependencyDashboard": true
5
6
  }
@@ -27,12 +27,12 @@ Gem::Specification.new do |spec|
27
27
  "rubygems_mfa_required" => "true"
28
28
  }
29
29
 
30
- spec.required_ruby_version = ">= 3.1.0"
30
+ spec.required_ruby_version = ">= 3.2.0"
31
31
 
32
32
  spec.files = `git ls-files -z`.split("\x0")
33
33
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
34
34
  spec.require_paths = ["lib", "lib/sidekiq/undertaker"]
35
35
 
36
- spec.add_runtime_dependency "rubyzip", "~> 2.3"
37
- spec.add_runtime_dependency "sidekiq", "~> 7"
36
+ spec.add_dependency "rubyzip", "~> 2.3"
37
+ spec.add_dependency "sidekiq", "~> 8"
38
38
  end