Conversation
- POST /api/v1/answers/internal/s3-upload-detected 추가 - POST /api/v1/drill-answers/internal/s3-upload-detected 추가 - AnswerService.handleS3UploadDetected() / DrillAnswerService.handleS3UploadDetected() 구현 - SELECT FOR UPDATE + isFeedbackNone() 체크로 Lambda 중복 invoke 방지 - completeAnswerUpload / submitDrillAnswer 멱등성 보강 - findByIdForUpdate() 적용, isFeedbackNone() 기준으로 Lambda invoke 여부 결정 - AnswerRepository / DrillAnswerRepository에 findByIdForUpdate(), findByAudioUrlForUpdate() 추가
completeAnswerUpload/submitDrillAnswer와 handleS3UploadDetected가 순서에 관계없이 두 번 실행됐을 때 Lambda invoke가 1회만 발생하는지 검증. 핵심: 두 Mock이 동일한 Answer 엔티티 객체를 반환하므로 첫 번째 호출의 requestFeedback() 상태 변경이 두 번째 호출의 isFeedbackNone() 체크에 반영됨. - AnswerIdempotencyTest: 세션 답변 3 시나리오 - DrillAnswerIdempotencyTest: 드릴 답변 3 시나리오 - AnswerServiceTest: findById → findByIdForUpdate 모킹 수정
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.
Summary
POST /api/v1/answers/internal/s3-upload-detected및POST /api/v1/drill-answers/internal/s3-upload-detected엔드포인트 추가completeAnswerUpload/submitDrillAnswer에SELECT FOR UPDATE+isFeedbackNone()게이트 적용 — 두 경로가 동시에 도달해도 Lambda invoke 1회만 발생AnswerIdempotencyTest,DrillAnswerIdempotencyTest)Changes
S3UploadDetectedRequest.javaDTO 신규AnswerRepository/DrillAnswerRepository—findByIdForUpdate(),findByAudioUrlForUpdate()(PESSIMISTIC_WRITE) 추가AnswerService.handleS3UploadDetected()/DrillAnswerService.handleS3UploadDetected()신규 구현AnswerController/DrillAnswerController—/internal/s3-upload-detected엔드포인트 추가Test plan
AnswerIdempotencyTest— completeUpload 선행 / s3Detected 선행 / FREE 유저 3 시나리오 통과 확인DrillAnswerIdempotencyTest— 동일 3 시나리오 통과 확인POST /api/v1/answers/internal/s3-upload-detected직접 호출 → PENDING Answer가 SUCCESS로 변경되고 Lambda invoke 로그 확인feedback_already_requested로그만 남고 Lambda 미호출 확인