Repository navigation
[fix] 셋리스트 재수집 시 트랙 미저장 수정 및 누락분 재수집 - #89
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (5)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe completed-concert query now includes performances with no setlist tracks. Setlist saves update existing records and replace tracks when incoming tracks are nonempty. The single-setlist scheduler requests error propagation from saves. ChangesSetlist recollection
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to No established issue remains that needs to be resolved before merge; normal checks can proceed. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
관련 이슈
Closes #88
변경 개요
트랙 0개로 먼저 저장된 셋리스트는 이후 setlist.fm에 곡이 채워져 재수집해도 트랙이 DB에 저장되지 않았다.
ON CONFLICT (setlist_fm_id) DO NOTHING으로 RETURNING 결과가 없어 트랙 INSERT를 건너뛰었고, 어드민 단건 수집은 저장 결과와 무관하게 성공으로 응답해 화면에는 보이지만 공연 상세 셋리스트는 비어 있었다. 또 06시 배치는 setlist 행이 없는 공연만 조회해, 이미 트랙 0개로 저장된 셋리스트(운영 74건)는 자동으로 복구되지 않았다.변경사항
db/repository.pysave_setlists:ON CONFLICT DO UPDATE ... RETURNING id로 변경, 새 tracks가 있으면 기존 트랙 DELETE 후 INSERT(빈 tracks면 기존 트랙 유지),raise_on_error옵션 추가db/repository.pyget_completed_concerts: 대상 조건을 "setlist 행 없음"에서 "setlist 행 없음 또는 트랙 0개"로 확장 (fetch_attempted_at7일 재시도 간격 유지)scheduler.pycollect_and_save_setlist:raise_on_error=True로 저장, 실패 시 예외 전파 → 내부 API 500 응답docs/pipeline.mdtests/test_repository.pyget_completed_concerts조건 테스트tests/test_scheduler.pyraise_on_error=True호출 검증, 저장 실패 시 예외 전파 테스트주요 구현 내용
setlist_fm_id면attribution_url·collected_at을 갱신하고 id를 항상 받는다. 새 결과에 트랙이 있을 때만 같은 트랜잭션에서 트랙을 교체하므로, setlist.fm에서 곡이 일시적으로 비어도 기존 트랙이 지워지지 않는다.run_setlist_collect)는 기존대로 실패 건만 로그 후 건너뛰고, 어드민 단건 경로만 예외를 올린다.fetch_attempted_at이 7일 이상 지나 배포 후 첫 실행에서 재조회되고, 이후 새로 생기는 빈 셋리스트도 주 1회 재확인된다.테스트
pytest415 passed,ruff check .통과)리뷰어 참고사항
PipelineServerException→ 어드민 화면 "수집에 실패했습니다." 표시 확인됨.ConcertService.getSetlist는collected_at최신 setlist를 읽으므로 재수집 결과가 바로 반영된다.setlist_track.id를 참조하는 테이블이 없어(Backend Flyway V1·V2 확인) 트랙 DELETE 후 INSERT가 안전하다.python scheduler.py run-job --job setlist로 즉시 실행하거나 06시 실행 뒤 아래 쿼리로 트랙 0개 건수 감소 확인코드 리뷰
변경사항 요약
db/repository.py:save_setlistsupsert + 트랙 교체,raise_on_error옵션 /get_completed_concerts대상 조건 확장scheduler.py: 단건 셋리스트 수집 저장 실패 전파tests/test_repository.py,tests/test_scheduler.py: 재현·예외 케이스 테스트/data-review결과 🔴 0건 / 🟡 0건 / 🔵 0건 (DML-only, print 없음, Python 3.9 문법, setlist.fm 요청 코드 변경 없음)✅ 특이사항 없음. 변경사항이 깔끔하게 구현되었습니다.
Summary by CodeRabbit