RestClient::Forbidden: 403 Forbidden
Fix Plan: NoMethodError private method service_jwt (Cupix::NotificationService)
Changes#
tesla: lib/cupix/notification_service.rb#
- What:
def self.service_jwt와def self.find_or_create_internal_user두 class method 를 파일 하단(구 213-241)에서private키워드(구 line 131) 직전으로 이동시키고,private_class_method :service_jwt, :find_or_create_internal_user를private_class_method :find_or_create_internal_user로 축소한다. 결과적으로service_jwt는 public class method,find_or_create_internal_user는 private class method 가 된다. - Why:
create_user_recipe(instance method, line 20) 가 인증 헤더를 만들 때Authorization: "Bearer #{self.class.service_jwt}"로service_jwt를 explicit receiver (self.class) 로 호출한다. Ruby 에서 private method 는 explicit receiver 로 호출할 수 없으므로 rubocop 자동수정 커밋54f4417c2이 추가한private_class_method :service_jwt때문에NoMethodError가 발생한다.service_jwt를 public 으로 되돌리면 호출부가 동작한다. - Note (구현 중 발견): 단순히
private_class_method에서:service_jwt만 제거하면 rubocopLint/IneffectiveAccessModifier가 재발한다 —def self.service_jwt가private키워드(line 131) 아래에 위치해 cop 이 singleton method 를 flag 하기 때문이다(원 커밋54f4417c2가private_class_method를 추가한 이유). 이를 회피하려고 두 class method 를private키워드 위로 이동시키고, 내부 전용인find_or_create_internal_user만private_class_method로 명시 private 유지했다.service_jwt본문 로직은 변경 없음. - Lines: class method 2개 이동 + private_class_method 1줄 축소 (32 insertions / 32 deletions — 순수 이동)
Acceptance Criteria#
-
service_jwt는 public class method 가 된다 (private_class_method인자에서 제거됨). -
create_user_recipe의self.class.service_jwt호출부(line 20)는 변경하지 않는다. -
service_jwt정의 본문(JWT 캐시/발급 로직)은 변경하지 않는다 — 순수 이동. -
find_or_create_internal_user는 여전히private_class_method로 남는다. -
ruby -c lib/cupix/notification_service.rb가 Syntax OK 를 반환한다. -
bundle exec rubocop lib/cupix/notification_service.rb가 offense 0 (특히Lint/IneffectiveAccessModifier없음). -
bundle exec srb tc lib/cupix/notification_service.rb가 통과한다.
Tests#
- 기존 테스트: notification_service 전용 spec 없음 (
spec/lib/cupix/notification_service_spec.rb부재) — skip. - 신규 테스트: 자동 fix 범위 최소화 원칙에 따라 신규 spec 은 추가하지 않는다. (RCA 의 "장기 개선" 항목인 회귀 spec 추가는 별도 트랙 — access-modifier 회귀를 잡는 spec 은 이 pure-code fix 와 분리하여 handoff.)