ES /docs

Database import retries exhausted: migration id(1843) - ActiveRecord::RecordNotFound: Couldn't find

Summary: ImportWorker cannot find newly-copied Pano because state=abandoned is excluded by default_scope

결과#

RCA 의 "즉시 조치 (Critical)" 권고에 따라 Option A (원본 abandoned pano 필터링) 와 Option B (Pano.find(new_id) 3지점을 unscoped.find 로 방어) 를 함께 적용한 PR 을 tesla 저장소에 생성했다. Blind validator 가 attempt 1 에서 APPROVED 를 반환했다.

Pull Requests#

Repo PR Branch
tesla https://dev.azure.com/cupix/tesla/_git/tesla/pullrequest/88787 feature/TSLA-13558

변경 내용#

tesla — app/operations/migration_import_operation.rb

  • migrate_panos 진입 지점에서 filter_out_abandoned_panos(pano_data, capture_org_id) 를 호출해 원본 state == 'abandoned' 인 pano 를 non-destructive 하게 제거한 filtered_pano_data 를 만들고, 이후 migrate_model('pano', ...) / migrate_model('pano_resource', ...) / migrate_model('mask', ...) / migrate_resource_object / migrate_tile_object / migrate_mask_object / set_pano_states_done 모두 이 필터링된 데이터로 호출한다.
  • filter_out_abandoned_panos helper 신설: pano_data.dupfiltered['pano'] = original_panos.reject { ... } 로 새 hash 를 만들어 caller-owned 원본 인자는 mutate 하지 않는다. 걸러진 pano 수와 원본 id 목록을 Cupix::Logger.info(class:, method:) 로 기록한다.
  • migrate_tile_object, migrate_mask_object, set_pano_states_done 세 지점의 Pano.find(new_id) (또는 model_name.camelize.constantize.find(new_id)) 호출을 unscoped.find(new_id) 로 변경해 Statable::Panodefault_scope { where.not(state: :abandoned) } 를 우회한다. Option A 로 걸러지지 않는 잔여 경로에 대한 방어 코드.

Validation#

Item Result
rubocop PASS (0 offenses)
srb tc PASS (no errors)
rspec SKIP (worktree credentials unavailable — depends on CI)
blind validator APPROVED (attempt 1)

Cleanup#

bash
cd /home/ec2-user/repos/tesla
git worktree remove /home/ec2-user/error-sweeper/.worktrees/824fa57f-da39-4076-8304-1a67aece327b/tesla