aireview 2.2.0 → 2.3.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.
@@ -1,25 +1,22 @@
1
1
  # frozen_string_literal: true
2
- require 'set'
3
2
  require_relative 'errors'
4
3
  require_relative 'llm_failure'
5
4
  require_relative 'model_state'
6
5
 
7
6
  module Aireview
8
- # Walks the models and keys of a stage. An overload is a property of the
9
- # model, a quota is a property of "key + model", so a 503 switches the
10
- # model and a quota switches the key. An overloaded model goes into
11
- # quarantine and is skipped until it expires; once the chain has been
12
- # walked, the walk goes round again over the models whose quarantine has
13
- # expired. Two limits: the time budget of the run and the number of
14
- # requests sent per model per stage (ModelState).
7
+ # Walks the models of a stage. An overloaded model goes into quarantine and
8
+ # is skipped until it expires; once the chain has been walked, the walk goes
9
+ # round again over the models whose quarantine has expired. Two limits: the
10
+ # time budget of the run and the number of requests sent per model per stage
11
+ # (ModelState).
15
12
  class LlmRouter # rubocop:disable Metrics/ClassLength
16
- Route = Struct.new(:candidate, :candidate_index, :key, :key_index, :key_count, keyword_init: true) do
13
+ Route = Struct.new(:candidate, :candidate_index, :key, keyword_init: true) do
17
14
  def fallback?
18
15
  candidate_index.positive?
19
16
  end
20
17
 
21
18
  def to_s
22
- key_count > 1 ? "#{candidate} (key #{key_index + 1}/#{key_count})" : candidate.to_s
19
+ candidate.to_s
23
20
  end
24
21
  end
25
22
 
@@ -33,8 +30,6 @@ module Aireview
33
30
  end
34
31
 
35
32
  Slot = Struct.new(:candidate, :index)
36
- # The key the next model of the same provider continues from.
37
- Carry = Struct.new(:key_source, :key_index)
38
33
  Delay = Struct.new(:seconds, :source)
39
34
 
40
35
  SWITCH_HINT = 'Try again later or switch model via --generate-model/--critique-model.'
@@ -74,30 +69,27 @@ module Aireview
74
69
 
75
70
  # The block receives a route and a request timeout, makes the request and
76
71
  # returns the answer. An error raised by the block is classified, then
77
- # comes a retry, another key, another model, or ApiError once the routes
78
- # are exhausted. pinned — only the model that answered last in this
79
- # stage (the JSON repair): its failure is RouteExhaustedError, and the
80
- # stage restarts on another model.
72
+ # comes a retry, another model, or ApiError once the routes are
73
+ # exhausted. pinned — only the model that answered last in this stage
74
+ # (the JSON repair): its failure is RouteExhaustedError, and the stage
75
+ # restarts on another model.
81
76
  def call(stage:, request_chars:, pinned: false, &request)
82
77
  @deadline ||= now + @config.llm_time_budget
83
78
  visits = []
84
79
  noted = Set.new
85
- carry = nil
86
80
  loop do
87
81
  slots = available_slots(stage, request_chars, pinned, visits, noted)
88
82
  slot = slots.empty? ? nil : ready_slot(stage, slots, visits)
89
83
  raise exhausted_error(stage, visits, pinned) unless slot
90
84
 
91
- status, value = try_candidate(stage, slot, visits, carry, &request)
85
+ status, value = try_candidate(stage, slot, visits, &request)
92
86
  return value if status == :ok
93
-
94
- carry = value
95
87
  end
96
88
  end
97
89
 
98
- # Stages answered by a model other than the primary one, for the report.
99
- def fallback_models
100
- @used.select { |_, route| route.fallback? }.transform_values { |route| route.candidate.to_s }
90
+ # Stages answered by any model, for the report.
91
+ def models
92
+ @used.transform_values { |route| route.candidate.display_name }
101
93
  end
102
94
 
103
95
  # The model that answered last in the stage and its place in the chain.
@@ -162,7 +154,7 @@ module Aireview
162
154
  end
163
155
 
164
156
  def bare_route(candidate, index)
165
- Route.new(candidate: candidate, candidate_index: index, key_count: 1)
157
+ Route.new(candidate: candidate, candidate_index: index)
166
158
  end
167
159
 
168
160
  def skip_reason(stage, candidate, request_chars)
@@ -179,7 +171,7 @@ module Aireview
179
171
  ensure_time_left!(stage, bare_route(slots.first.candidate, slots.first.index), visits)
180
172
  moment = now
181
173
  ready = slots.find { |slot| state(slot.candidate).quarantine_left(moment) <= 0 }
182
- return ready if ready
174
+ return stronger_critic(stage, slots, ready, moment) || ready if ready
183
175
 
184
176
  slot = slots.min_by { |item| state(item.candidate).quarantine_left(moment) }
185
177
  wait = state(slot.candidate).quarantine_left(moment)
@@ -195,48 +187,50 @@ module Aireview
195
187
  slot
196
188
  end
197
189
 
198
- # On :next_model hands over the current key: an overload is a property of
199
- # the model, and the next model of the same provider continues from the
200
- # same key instead of going back to the first one, whose quota may
201
- # already be gone.
202
- #
203
- # Every visit either sends a request or excludes the model: otherwise the
204
- # walk round the pool would never stop. A model whose keys are all out of
205
- # daily quota is excluded until the end of the run.
206
- def try_candidate(stage, slot, visits, carry, &request)
207
- routes = candidate_routes(stage, slot, carry)
208
- tried = false
209
- routes.each do |route|
210
- next if quota_exhausted?(stage, route, visits)
211
-
212
- tried = true
213
- log_switch(stage, route, visits)
214
- status, response = try_route(stage, route, visits, &request)
215
- return [:ok, remember(stage, route, response)] if status == :ok
216
- return [:next_model, Carry.new(route.candidate.key_source, route.key_index)] if status == :next_model
217
- end
218
- state(slot.candidate).exclude('daily quota exhausted on every key') unless tried
219
- [:next_model, carry]
220
- end
221
-
222
- # The keys start from the carried one (after an overload — the current
223
- # key, after an answer — the one that answered), the rest follow: a quota
224
- # is bound to "key + model", a failure on one model does not write the
225
- # key off for another.
226
- def candidate_routes(stage, slot, carry)
227
- keys = @config.candidate_api_keys(slot.candidate)
228
- routes = keys.each_with_index.map do |key, key_index|
229
- Route.new(candidate: slot.candidate, candidate_index: slot.index, key: key,
230
- key_index: key_index, key_count: keys.size)
231
- end
232
- routes.rotate(start_key(stage, slot, carry))
190
+ # A critique by the model that answered in Generate is the last resort
191
+ # of a ranked pool. When a model the critique chain puts before it is
192
+ # only quarantined and its release fits into the budget, wait for it:
193
+ # otherwise an overload in Generate turns the critique into a self-check
194
+ # (Generate and Critique on one model). Only the chain's own preference
195
+ # counts, so an explicit critique.start stays first; own chains and
196
+ # rank: any are not ranked and keep their order. Models out until the
197
+ # end of the run are not in slots. nil — nobody to wait for.
198
+ def stronger_critic(stage, slots, ready, moment)
199
+ generate = self_critique(stage, ready)
200
+ return nil unless generate
201
+
202
+ stronger = slots.select { |item| item.index < ready.index }
203
+ slot = stronger.min_by { |item| state(item.candidate).quarantine_left(moment) }
204
+ wait = slot && state(slot.candidate).quarantine_left(moment)
205
+ # The wait is optional: a full request must still fit after it, or a
206
+ # critique by the available model beats a failed review.
207
+ return nil if wait.nil? || wait + @config.llm_timeout.to_f > remaining_time
208
+
209
+ @logger.warn(format('LLM critique: waiting %<wait>.0fs for %<model>s instead of critiquing with %<same>s, ' \
210
+ 'the model that answered in generate', wait: wait, model: slot.candidate, same: generate))
211
+ pause(wait)
212
+ slot
213
+ end
214
+
215
+ # The Generate model when it is the only one ready for a ranked
216
+ # Critique; else nil.
217
+ def self_critique(stage, ready)
218
+ generate = @used['generate']&.candidate
219
+ return nil unless stage == 'critique' && generate&.same_model?(ready.candidate)
220
+
221
+ generate if @routing.ranked_critique?(generate)
233
222
  end
234
223
 
235
- def start_key(stage, slot, carry)
236
- return carry.key_index if carry && carry.key_source == slot.candidate.key_source
224
+ # Every visit either sends a request or excludes the model: otherwise the
225
+ # walk round the pool would never stop.
226
+ def try_candidate(stage, slot, visits, &)
227
+ key = @config.candidate_api_keys(slot.candidate).first
228
+ route = Route.new(candidate: slot.candidate, candidate_index: slot.index, key: key)
229
+ log_switch(stage, route, visits)
230
+ status, response = try_route(stage, route, visits, &)
231
+ return [:ok, remember(stage, route, response)] if status == :ok
237
232
 
238
- cursor_candidate, cursor_key = @cursor.fetch(stage, [0, 0])
239
- cursor_candidate == slot.index ? cursor_key : 0
233
+ [:next_model, nil]
240
234
  end
241
235
 
242
236
  # A visit to a route: requests until an answer, a retry or a refusal. try
@@ -272,7 +266,7 @@ module Aireview
272
266
  if decision == :retry
273
267
  return :retry if requests_left?(stage, route) && waited_before_retry?(stage, route, delay)
274
268
 
275
- decision = give_up(kind)
269
+ decision = :next_model
276
270
  end
277
271
  record_failure(stage, route, kind, decision, error)
278
272
  visits << Visit.new(route: route, kind: kind, tries: try, error: error)
@@ -286,29 +280,23 @@ module Aireview
286
280
  false
287
281
  end
288
282
 
289
- # :retry with a delay, :next_key, :next_model or :fail.
283
+ # :retry with a delay, :next_model or :fail.
290
284
  def decide(kind, try, error)
291
285
  case kind
292
286
  when :fatal then [:fail]
293
- when :unavailable then [:next_model]
294
- when :daily_quota then [:next_key]
295
- when :rate_limit then try == 1 ? [:retry, rate_limit_delay(error)] : [:next_key]
287
+ when :unavailable, :daily_quota then [:next_model]
288
+ when :rate_limit then try == 1 ? [:retry, rate_limit_delay(error)] : [:next_model]
296
289
  else try == 1 ? [:retry, short_delay] : [:next_model]
297
290
  end
298
291
  end
299
292
 
300
- def give_up(kind)
301
- kind == :rate_limit ? :next_key : :next_model
302
- end
303
-
304
- # A daily quota marks the key of the model, a missing model marks the
305
- # model for the whole run, an overload or a timeout quarantines it, a
306
- # per-minute limit quarantines it for the provider's hint (the next key
307
- # is tried at once; the quarantine only affects the next visit).
293
+ # A daily quota or a missing model excludes the model for the whole run,
294
+ # an overload or a timeout quarantines it, a per-minute limit quarantines
295
+ # it for the provider's hint.
308
296
  def record_failure(stage, route, kind, decision, error)
309
297
  model = state(route.candidate)
310
298
  case kind
311
- when :daily_quota then model.exhaust_key(route.key_index)
299
+ when :daily_quota then model.exclude('daily quota exhausted earlier in this run')
312
300
  when :unavailable then model.exclude('model unavailable earlier in this run')
313
301
  when :rate_limit then quarantine(stage, route, rate_limit_delay(error).seconds)
314
302
  when :overloaded, :timeout then quarantine(stage, route, @config.overloaded_quarantine) if decision == :next_model
@@ -368,18 +356,9 @@ module Aireview
368
356
  [@config.llm_timeout.to_f, remaining_time].min
369
357
  end
370
358
 
371
- def quota_exhausted?(stage, route, visits)
372
- return false unless state(route.candidate).key_exhausted?(route.key_index)
373
-
374
- @logger.info("LLM #{stage}: skipping #{route}, daily quota exhausted earlier in this run")
375
- visits << Visit.new(route: route, note: 'daily quota exhausted earlier in this run')
376
- true
377
- end
378
-
379
- # A model that answered is not overloaded, whichever key answered: a
380
- # quarantine set through another key of the same model is lifted.
359
+ # A model that answered is not overloaded: its quarantine is lifted.
381
360
  def remember(stage, route, response)
382
- @cursor[stage] = [route.candidate_index, route.key_index]
361
+ @cursor[stage] = route.candidate_index
383
362
  @used[stage] = route
384
363
  state(route.candidate).lift_quarantine
385
364
  response
@@ -396,7 +375,7 @@ module Aireview
396
375
  # The next request of the stage (the JSON repair, for instance) starts
397
376
  # from the model that answered; the rest stay in reserve after it.
398
377
  def ordered_chain(stage)
399
- start_candidate, = @cursor.fetch(stage, [0, 0])
378
+ start_candidate = @cursor.fetch(stage, 0)
400
379
  chain_for(stage).each_with_index.to_a.rotate(start_candidate)
401
380
  end
402
381
 
@@ -14,16 +14,19 @@ module Aireview
14
14
  # The address is part of the name, scheme included: two servers with the
15
15
  # same model (http and https ones too) are two models for quarantine,
16
16
  # reserves and the review key.
17
+ def display_name
18
+ "#{provider}/#{model}"
19
+ end
20
+
17
21
  def to_s
18
- name = "#{provider}/#{model}"
19
- api_base ? "#{name}@#{api_base.chomp('/')}" : name
22
+ api_base ? "#{display_name}@#{api_base.chomp('/')}" : display_name
20
23
  end
21
24
 
22
25
  # Every way a start or a CLI override may name this model: bare,
23
26
  # "provider/name", or the full name with the address. One list for the
24
27
  # config check and for picking the model, so they cannot disagree.
25
28
  def names
26
- [model.to_s, "#{provider}/#{model}", to_s].uniq
29
+ [model.to_s, display_name, to_s].uniq
27
30
  end
28
31
 
29
32
  def same_model?(other)
@@ -122,6 +122,12 @@ module Aireview
122
122
  chain(stage).first
123
123
  end
124
124
 
125
+ # Critique is ranked against the model that answered in Generate: both
126
+ # stages walk the pool and the rank is not_below_generate.
127
+ def ranked_critique?(after)
128
+ rank_applies?(after)
129
+ end
130
+
125
131
  def weaker?(critique_candidate, generate_candidate)
126
132
  return false unless pool_member?(critique_candidate) && pool_member?(generate_candidate)
127
133
 
@@ -1,18 +1,15 @@
1
1
  # frozen_string_literal: true
2
- require 'set'
3
2
 
4
3
  module Aireview
5
4
  # What the router learned about a model during the run. Three things with
6
5
  # different lifetimes: sent requests are counted per stage, a quarantine
7
6
  # lasts until a moment in time, an exclusion lasts until the end of the
8
- # run (the provider has no such model, every key is out of quota) or the
9
- # end of the stage (an invalid result). Keys with an exhausted daily quota
10
- # are remembered separately: a quota is a property of "key + model", a
11
- # quarantine a property of the model.
7
+ # run (the provider has no such model, daily quota is exhausted) or the
8
+ # end of the stage (an invalid result).
12
9
  class ModelState
13
10
  # Every request sent, the short retry and the JSON repair included,
14
- # spends an attempt regardless of its outcome; the keys of a model share
15
- # one counter, a quarantine does not reset it.
11
+ # spends an attempt regardless of its outcome; a quarantine does not
12
+ # reset it.
16
13
  MAX_REQUESTS_PER_STAGE = 3
17
14
 
18
15
  attr_reader :excluded_reason
@@ -23,7 +20,6 @@ module Aireview
23
20
  @quarantined_until = nil
24
21
  @excluded_reason = nil
25
22
  @stage_exclusions = {}
26
- @exhausted_keys = Set.new
27
23
  end
28
24
 
29
25
  def sent(stage)
@@ -42,7 +38,7 @@ module Aireview
42
38
  @quarantined_until = until_time
43
39
  end
44
40
 
45
- # A model that answered is not overloaded, whichever key answered.
41
+ # A model that answered is not overloaded.
46
42
  def lift_quarantine
47
43
  @quarantined_until = nil
48
44
  end
@@ -61,14 +57,6 @@ module Aireview
61
57
  @stage_exclusions[stage.to_s] = reason
62
58
  end
63
59
 
64
- def exhaust_key(key_index)
65
- @exhausted_keys << key_index
66
- end
67
-
68
- def key_exhausted?(key_index)
69
- @exhausted_keys.include?(key_index)
70
- end
71
-
72
60
  # Why the model cannot be tried in the stage; nil — it can (the
73
61
  # quarantine is checked separately: it is a wait, not a ban).
74
62
  def skip_reason(stage)
@@ -3,28 +3,66 @@ require 'uri'
3
3
 
4
4
  module Aireview
5
5
  class MrParser
6
- Result = Struct.new(:url, :base_url, :project_path, :project_id, :iid, keyword_init: true)
6
+ Result = Struct.new(:platform, :url, :base_url, :project_path, :project_id, :iid, keyword_init: true)
7
7
 
8
8
  MR_PATH = %r{\A/(?<project>.+)/-/merge_requests/(?<iid>\d+)\z}
9
+ # github.com and GitHub Enterprise share the path; the PR page tabs and a
10
+ # trailing slash point at the same pull request.
11
+ PR_PATH = %r{\A/(?<owner>[^/]+)/(?<repo>[^/]+)/pull/(?<number>\d+)(?:/(?:files|commits|checks))?/?\z}
12
+ # What GitHub allows in owner and repository names. Checked here, so that
13
+ # the "owner/repo" id goes into API paths as is, and a malformed URL
14
+ # fails as a URL error instead of a 404.
15
+ GITHUB_NAME = /\A[A-Za-z0-9_.-]+\z/
9
16
 
10
17
  def self.parse(url)
11
18
  uri = URI.parse(url.to_s)
12
19
  raise ParseError, 'Merge request URL must include http:// or https://' unless uri.is_a?(URI::HTTP)
13
20
 
21
+ gitlab(url, uri) || github(url, uri) || raise(ParseError, "Unsupported merge request URL: #{url}")
22
+ rescue URI::InvalidURIError => e
23
+ raise ParseError, "Invalid merge request URL: #{e.message}"
24
+ end
25
+
26
+ def self.gitlab(url, uri)
14
27
  match = MR_PATH.match(uri.path)
15
- raise ParseError, "Unsupported merge request URL: #{url}" unless match
28
+ return unless match
16
29
 
17
30
  project_path = match[:project]
18
-
19
31
  Result.new(
32
+ platform: :gitlab,
20
33
  url: url,
21
- base_url: "#{uri.scheme}://#{uri.host}#{":#{uri.port}" if uri.port && ![80, 443].include?(uri.port)}",
34
+ base_url: base_url(uri),
22
35
  project_path: project_path,
23
36
  project_id: URI.encode_www_form_component(project_path),
24
37
  iid: match[:iid].to_i
25
38
  )
26
- rescue URI::InvalidURIError => e
27
- raise ParseError, "Invalid merge request URL: #{e.message}"
28
39
  end
40
+
41
+ # GitHub takes the repository as two path segments (repos/owner/repo),
42
+ # not one encoded segment like a GitLab project id.
43
+ def self.github(url, uri)
44
+ match = PR_PATH.match(uri.path)
45
+ return unless match
46
+
47
+ owner, repo = match.values_at(:owner, :repo)
48
+ unless [owner, repo].all? { |name| GITHUB_NAME.match?(name) }
49
+ raise ParseError, "Unsupported pull request URL: #{url}"
50
+ end
51
+
52
+ Result.new(
53
+ platform: :github,
54
+ url: url,
55
+ base_url: base_url(uri),
56
+ project_path: "#{owner}/#{repo}",
57
+ project_id: "#{owner}/#{repo}",
58
+ iid: match[:number].to_i
59
+ )
60
+ end
61
+
62
+ def self.base_url(uri)
63
+ "#{uri.scheme}://#{uri.host}#{":#{uri.port}" if uri.port && ![80, 443].include?(uri.port)}"
64
+ end
65
+
66
+ private_class_method :gitlab, :github, :base_url
29
67
  end
30
68
  end
@@ -0,0 +1,99 @@
1
+ # frozen_string_literal: true
2
+ require_relative 'errors'
3
+ require_relative 'utils'
4
+ require_relative 'gitlab_client'
5
+ require_relative 'github_client'
6
+
7
+ module Aireview
8
+ # The only place that knows which platform a review target belongs to:
9
+ # which client to build, how to tell a CI retry from a new push and how to
10
+ # name the target in messages. No requests and no response handling here —
11
+ # those live in the clients.
12
+ module Platform
13
+ PLATFORMS = %i[gitlab github].freeze
14
+
15
+ module_function
16
+
17
+ def client(config:, target:, logger:)
18
+ case platform(target)
19
+ when :gitlab
20
+ GitlabClient.new(
21
+ base_url: config.gitlab_url || target.base_url,
22
+ token: config.require_gitlab_token!,
23
+ logger: logger
24
+ )
25
+ when :github
26
+ GithubClient.new(
27
+ api_url: config.github_api_url || GithubClient.api_url_for(target.base_url),
28
+ token: config.require_github_token!,
29
+ review_author: config.github_review_author,
30
+ logger: logger
31
+ )
32
+ end
33
+ end
34
+
35
+ # A Retry of the GitLab job, not a new pipeline: see
36
+ # GitlabClient#retried_job?. GitHub numbers the attempts of a workflow
37
+ # run itself: "Re-run jobs" makes attempt 2. Outside CI nothing is a retry.
38
+ def retried_run?(client:, target:, env:)
39
+ case platform(target)
40
+ when :gitlab
41
+ project_id, job_id = gitlab_job(env)
42
+ project_id ? client.retried_job?(project_id, job_id) : false
43
+ when :github
44
+ github_actions?(env) && env['GITHUB_RUN_ATTEMPT'].to_i > 1
45
+ end
46
+ end
47
+
48
+ def update_hint(target:, env:)
49
+ case platform(target)
50
+ when :gitlab
51
+ gitlab_job(env) ? 'retry the job to update' : 'use --force to review again'
52
+ when :github
53
+ github_actions?(env) ? 're-run the workflow to update' : 'use --force to review again'
54
+ end
55
+ end
56
+
57
+ def label(target)
58
+ case platform(target)
59
+ when :gitlab then "MR #{target.project_path}!#{target.iid}"
60
+ when :github then "PR #{target.project_path}##{target.iid}"
61
+ end
62
+ end
63
+
64
+ def name(target)
65
+ case platform(target)
66
+ when :gitlab then 'GitLab'
67
+ when :github then 'GitHub'
68
+ end
69
+ end
70
+
71
+ def noun(target)
72
+ case platform(target)
73
+ when :gitlab then 'merge request'
74
+ when :github then 'pull request'
75
+ end
76
+ end
77
+
78
+ def platform(target)
79
+ platform = target.platform
80
+ raise ArgumentError, "Unsupported platform: #{platform.inspect}" unless PLATFORMS.include?(platform)
81
+
82
+ platform
83
+ end
84
+ private_class_method :platform
85
+
86
+ def gitlab_job(env)
87
+ project_id, job_id = env.values_at('CI_PROJECT_ID', 'CI_JOB_ID')
88
+ return if Aireview::Utils.blank?(project_id) || Aireview::Utils.blank?(job_id)
89
+
90
+ [project_id, job_id]
91
+ end
92
+ private_class_method :gitlab_job
93
+
94
+ def github_actions?(env)
95
+ env['GITHUB_ACTIONS'] == 'true'
96
+ end
97
+ private_class_method :github_actions?
98
+ end
99
+ end
@@ -5,8 +5,9 @@ module Aireview
5
5
  class Publisher
6
6
  PREFIX = '**aireview review**'
7
7
 
8
- def initialize(gitlab_client:, logger: Logger.new($stderr))
9
- @gitlab_client = gitlab_client
8
+ def initialize(client:, platform_name: 'GitLab', logger: Logger.new($stderr))
9
+ @client = client
10
+ @platform_name = platform_name
10
11
  @logger = logger
11
12
  end
12
13
 
@@ -17,7 +18,7 @@ module Aireview
17
18
  author_id = current_user_id
18
19
  legacy = nil
19
20
 
20
- @gitlab_client.fetch_merge_request_notes(project_id, iid).each do |note|
21
+ @client.fetch_merge_request_notes(project_id, iid).each do |note|
21
22
  next if note['system']
22
23
  next if note.dig('author', 'id') != author_id
23
24
 
@@ -35,9 +36,9 @@ module Aireview
35
36
 
36
37
  if existing
37
38
  @logger.info("Updating review note #{existing[:id]}")
38
- @gitlab_client.update_merge_request_note(project_id, iid, existing[:id], body)
39
+ @client.update_merge_request_note(project_id, iid, existing[:id], body)
39
40
  else
40
- @gitlab_client.post_merge_request_note(project_id, iid, body)
41
+ @client.post_merge_request_note(project_id, iid, body)
41
42
  end
42
43
  end
43
44
 
@@ -55,8 +56,8 @@ module Aireview
55
56
  def current_user_id
56
57
  return @current_user_id if defined?(@current_user_id)
57
58
 
58
- id = @gitlab_client.fetch_current_user['id']
59
- raise ApiError, 'GitLab did not return the current user id' if Aireview::Utils.blank?(id)
59
+ id = @client.fetch_current_user['id']
60
+ raise ApiError, "#{@platform_name} did not return the current user id" if Aireview::Utils.blank?(id)
60
61
 
61
62
  @current_user_id = id
62
63
  end