gitlab-triage 1.59.0 → 1.60.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f0eb4b3c4c796bca65d1ec29040c8a7963cbdc4f9a7a2aca442819dd18e9473e
4
- data.tar.gz: 5d39d860952878d6843c430e216308d72d6457cb077d4731267597832b4eb32b
3
+ metadata.gz: 362f986d9736e3815c32e29afcfd5c47d230c18716e41fbb751123955fd86be2
4
+ data.tar.gz: 30f6942c9386605d5d3e788c284933f3811e1d4f0b7e97e2a1211b20bc1663d0
5
5
  SHA512:
6
- metadata.gz: a20e94634c5849d85e93018377672bb5070dcebe504fa5bb309ed2fd2027ccd54057be3efa9c44b3ca2e7bbe3657ce2994fd479d8017f90f70ed0f9f8acd6fac
7
- data.tar.gz: 8a127ec91870fae1afa0337880593390ca3430506b715bcf99c948c0c0cd6a8ad74343c832624b687f20664953a86e7f31afbd5ee1fa691056ee0e6c959edeb7
6
+ metadata.gz: b73d2d85f6650d9fd4a26a463e9affef97638e47926c6bd00fa91d45b3aa8a510c4c4ba4fe2afbb14c1394d43148ba1bba0e59fc6f07b69113cc61f18faf3abd
7
+ data.tar.gz: 98a66293d0194fd0b6d7636664e788f86c6918ebadb02a6f58cb0ae136b36f8a8fd1d3b883c64cc2a96f2a08421a08f56950e6c0065ede92f782357e2ab99f55
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab-triage (1.59.0)
4
+ gitlab-triage (1.60.0)
5
5
  activesupport (>= 5.1)
6
6
  globalid (~> 1.0, >= 1.0.1)
7
7
  graphql (>= 2.4.13, < 2.7.0)
data/README.md CHANGED
@@ -328,6 +328,10 @@ match work items that are at risk.
328
328
  `resource[:description]` is the work item's description in Markdown, the same as
329
329
  on `issues`.
330
330
 
331
+ `resource[:weight]` is the work item's own weight, the same as on `issues`. It is
332
+ `nil` when no weight is set, and always `nil` on GitLab Community Edition or a
333
+ namespace without the license for weights.
334
+
331
335
  `resource[:moved_to_id]` and `resource[:moved_to_work_item_url]` are the id and
332
336
  URL of the work item it was moved to, so rules that skip moved items with
333
337
  `resource[:moved_to_id].nil?` work the same as on `issues`. `moved_to_id` needs
@@ -6,7 +6,8 @@ module Gitlab
6
6
  module Triage
7
7
  module APIObservability
8
8
  class Tracker
9
- PAGINATION_PARAMS = %w[page per_page].freeze
9
+ # Keyset next links also echo the server's defaults (id, order_by, sort, include_archived).
10
+ PAGINATION_PARAMS = %w[page per_page cursor pagination id order_by sort include_archived].freeze
10
11
 
11
12
  attr_reader :calls, :resources_fetched
12
13
 
@@ -60,7 +61,7 @@ module Gitlab
60
61
  .sub(%r{/groups/[^/]+}, '/groups/:id')
61
62
  .gsub(%r{/\d+(/|\z)}, '/:id\1')
62
63
 
63
- query_keys = (URI.decode_www_form(uri.query || '').map(&:first) - PAGINATION_PARAMS).sort
64
+ query_keys = (URI.decode_www_form(uri.query || '').map { |key, _| key.delete_suffix('[]') }.uniq - PAGINATION_PARAMS).sort
64
65
 
65
66
  path += "?#{query_keys.join('&')}" if query_keys.any?
66
67
  path
@@ -24,9 +24,11 @@ module Gitlab
24
24
  raise_on_internal_server_error!(response)
25
25
  raise_on_too_many_requests!(response)
26
26
 
27
+ next_url = next_page_url(url, response)
28
+
27
29
  result = {
28
- more_pages: (response.headers["x-next-page"].to_s != ""),
29
- next_page_url: next_page_url(url, response),
30
+ more_pages: next_url.present?,
31
+ next_page_url: next_url,
30
32
  results: response.parsed_response,
31
33
  ratelimit_remaining: rate_limit_remaining(response.headers),
32
34
  ratelimit_reset_at: rate_limit_reset_at(response.headers)
@@ -160,8 +162,17 @@ module Gitlab
160
162
  end
161
163
 
162
164
  def next_page_url(url, response)
163
- return unless response.headers['x-next-page'].present?
165
+ return next_offset_page_url(url, response) if response.headers['x-next-page'].present?
166
+
167
+ next_link = response.headers['link'].to_s[/<([^>]+)>;\s*rel="next"/, 1]
168
+ return unless next_link
169
+
170
+ # Keyset pages have no X-Next-Page. The Link host comes from the server's
171
+ # own config and can differ from ours, so only its query is used.
172
+ "#{url.split('?', 2).first}?#{next_link.split('?', 2).last}"
173
+ end
164
174
 
175
+ def next_offset_page_url(url, response)
165
176
  next_page = "&page=#{response.headers['x-next-page']}"
166
177
 
167
178
  if url.include?('&page')
@@ -46,6 +46,7 @@ module Gitlab
46
46
  # Flat string, like the Issues API: ruby conditions compare
47
47
  # resource[:health_status] with values such as 'at_risk'.
48
48
  health_status: features.dig(:health_status, :health_status),
49
+ weight: features.dig(:weight, :weight),
49
50
  work_item_type: resource.dig(:work_item_type, :name),
50
51
  work_item_status: status_name(features),
51
52
  start_date: features.dig(:start_and_due_date, :start_date),
@@ -60,8 +60,8 @@ module Gitlab
60
60
  moved_to_id
61
61
  ].freeze
62
62
 
63
- # Widget payloads opted into via `features`. status and health_status are EE
64
- # only: CE accepts them on read endpoints and leaves them out of the response,
63
+ # Widget payloads opted into via `features`. status, weight and health_status are
64
+ # EE only: CE accepts them on read endpoints and leaves them out of the response,
65
65
  # as an unlicensed EE namespace does, so their values are then nil.
66
66
  LIST_FEATURES = %w[
67
67
  labels
@@ -69,6 +69,7 @@ module Gitlab
69
69
  milestone
70
70
  status
71
71
  start_and_due_date
72
+ weight
72
73
  award_emoji
73
74
  health_status
74
75
  description
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Gitlab
4
4
  module Triage
5
- VERSION = '1.59.0'
5
+ VERSION = '1.60.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-triage
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.59.0
4
+ version: 1.60.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitLab
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-11-25 00:00:00.000000000 Z
11
+ date: 2026-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport