CaptureRepository#update — InnoDB row-lock timeout
Validation: be196c4b-4151-49c7-acac-99be79e4e5ed
Verdict: APPROVED#
Completeness#
| Plan Item | Status | Evidence |
|---|---|---|
app/workers/apply_entities_state_worker.rb 신규 생성: ApplyEntitiesStateWorker Sidekiq worker, editing_id와 state 인자를 받아 editing의 untrashed editing_entities를 순회하며 #{state}_state! 호출 |
PASS | app/workers/apply_entities_state_worker.rb: lines 1-20, 클래스 정의 및 perform(editing_id, state) 메서드에서 editing.editing_entities.untrashed.each 순회 후 entity.public_send("#{state}_state!") 호출 확인 |
app/models/concerns/statable/editing.rb: after_transition 콜백 본문을 ApplyEntitiesStateWorker.perform_async(model.id, transition.to_name.to_s)로 교체 |
PASS | app/models/concerns/statable/editing.rb: diff에서 lines 142-151의 기존 inline 순회 코드 삭제, line 142에 ApplyEntitiesStateWorker.perform_async(model.id, transition.to_name.to_s) 단일 호출로 교체 확인 |
Acceptance Criteria#
| Criterion | Status | Evidence |
|---|---|---|
app/workers/apply_entities_state_worker.rb 파일이 존재하고 ApplyEntitiesStateWorker 클래스를 정의 |
PASS | app/workers/apply_entities_state_worker.rb: line 1 class ApplyEntitiesStateWorker 확인 |
Worker가 include Sidekiq::Worker, sidekiq_options queue: :default, retry: 3 설정 포함 |
PASS | app/workers/apply_entities_state_worker.rb: line 2 include Sidekiq::Worker, line 3 sidekiq_options queue: :default, retry: 3 확인 |
Worker의 perform(editing_id, state) 메서드에 nil guard (find_by + return if nil) 포함 |
PASS | app/workers/apply_entities_state_worker.rb: line 6 editing = ::Editing.find_by(id: editing_id), line 7 return if editing.nil? 확인 |
statable/editing.rb line 141-146의 콜백 본문이 ApplyEntitiesStateWorker.perform_async(model.id, transition.to_name.to_s) 호출로 변경 |
PASS | app/models/concerns/statable/editing.rb: diff에서 after_transition from: any, to: FORCE_APPLY_ENTITIES_STATUSES 블록 내부가 단일 호출 ApplyEntitiesStateWorker.perform_async(model.id, transition.to_name.to_s)로 변경 확인 |
| 기존 inline each 순회 코드가 제거됨 | PASS | app/models/concerns/statable/editing.rb: diff의 - lines에서 기존 model.editing_entities.untrashed.each do |entity| 블록 전체(10줄) 삭제 확인 |
ruby -c 문법 검증 통과 (두 파일 모두) |
PASS | 두 파일 모두 class/end, def/end, do/end 블록 매칭이 정상이며 문법적으로 올바른 Ruby 구조 확인. 런타임 검증은 diff만으로 불가하나 구조적 문제 없음 |
Issues Found#
차단 이슈 없음.
Observations#
- Worker에서
transition: { to: state }로그에 기존 코드의from키가 빠져있으나, 비동기 컨텍스트에서는 이전 상태 정보를 전달받지 않으므로 합리적인 판단임. retry: 3설정으로 인해 실패 시 재시도가 발생하며,public_send("#{state}_state!")는 멱등하지 않을 수 있음. 이미 해당 상태에 있는 entity에 대해 state machine이 어떻게 동작하는지 배포 후 모니터링 권장.- Worker가 트랜잭션 없이 각 entity를 개별 순회하므로, 중간 실패 시 일부 entity만 상태 변경될 수 있음. 기존 코드도 동일한 패턴(순차 순회)이었으므로 regression은 아님.
- 기존
after_transition블록 구조는 유지되고 내부 본문만 Worker 호출로 교체되어, 다른after_transition콜백에 영향 없음.