fix(review): persist last_review + correct resolver enrollment key#37
Open
jongjunn wants to merge 1 commit into
Open
fix(review): persist last_review + correct resolver enrollment key#37jongjunn wants to merge 1 commit into
jongjunn wants to merge 1 commit into
Conversation
두 개의 프로덕션 버그 수정 (둘 다 infrastructure/repositories.py): 1. MySQLReviewCardRepository.save_card 가 last_review 를 저장하지 않아 review_card.last_review 가 항상 NULL 로 남았다. find_review_targets 의 멱등성 조건(rc.last_review IS NULL OR qs.submitted_at > rc.last_review)이 항상 참이 되어 야간 배치가 매 실행마다 전 카드를 재리뷰(당일 재리뷰로 처리 → FSRS stability 왜곡). 실측: 같은 날 재실행 시 skipped=0, updated=453. INSERT/UPDATE 에 last_review 추가. 2. MySQLEnrollmentQuizResolver.get_member_id 가 `enrollment WHERE id=%s` 로 조회했으나 enrollment 테이블 PK 는 enrollment_id 이고 id 컬럼은 없음 (V1__baseline.sql). "Unknown column 'id'" 로 유사문제 추천 경로 전체가 실패했다. WHERE enrollment_id=%s 로 수정. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
무엇을 / 왜
야간 FSRS 복습 배치(
review_update)가 08:10 배포로 살아난 뒤 확인 중 발견한 프로덕션 버그 2건 (둘 다infrastructure/repositories.py).1.
save_card가last_review를 저장 안 함 → 멱등성 붕괴 (stability 왜곡)review_card.last_review가 항상NULL로 남아,find_review_targets의 멱등성 조건rc.last_review IS NULL OR qs.submitted_at > rc.last_review이 항상 참 → 야간 배치가 매 실행마다 전 카드를 재리뷰. 코드 주석이 경고한 "같은 카드를 매일 다시 굽는" 상황(당일 재리뷰 → FSRS stability 왜곡)이 실제로 발생.실측: 같은 날 수동 재실행 시
targets=453 updated=453 skipped=0(아침에 갱신한 카드가 하나도 스킵 안 됨).수정: INSERT 컬럼·ON DUPLICATE KEY UPDATE에
last_review추가.2.
MySQLEnrollmentQuizResolver.get_member_id잘못된 키 컬럼SELECT ... FROM enrollment WHERE id = %s→enrollmentPK는enrollment_id이고id컬럼은 없음(V1__baseline.sql).Unknown column 'id'로 유사문제 추천 경로 전체가 실패.WHERE enrollment_id = %s로 수정.영향
후속(이 PR 범위 밖, 별도 확인 필요)
get_card가last_review·state를 로드하지 않아 재리뷰 시 FSRS 경과일 계산이 부정확할 수 있음 (naive/aware datetime 이슈 얽힘 — py-fsrs tz 동작 확인 후 처리).review_log가 한 번도 기록되지 않음(개인 가중치 재학습 원천이 비어있음).테스트
🤖 Generated with Claude Code