미디어 Presigned URL 업로드 및 삭제 API 구현 - #20
Merged
Merged
Conversation
hej090224
reviewed
Aug 5, 2026
hej090224
left a comment
Member
There was a problem hiding this comment.
전체적으로 잘 구성된 구현입니다. presigned URL 발급 → 서버 재검증 → 승격이라는 흐름 자체가 CLAUDE.md의 "클라이언트를 신뢰하지 않는다" 원칙과 잘 맞고, insertUnattached의 ON CONFLICT DO NOTHING으로 멱등성을 확보한 아이디어도 좋습니다. 인라인으로 몇 가지 개선 여지와 잠재적 버그 가능성을 남깁니다.
추가로 두 가지는 파일 라인에 걸기 애매해서 여기 적습니다.
- 마이그레이션 버전 충돌 우려: 이 PR의
V4__support_pending_media_uploads.sql과 별도로 열려있는 Friend 도메인 PR(#22)도V4__...sql을 추가합니다. 두 PR이 모두 머지되면 Flyway 버전 번호가 충돌하니, 나중에 머지되는 쪽에서 V5로 재번호가 필요합니다. 병합 순서 조율이 필요해 보입니다. - 테스트 커버리지:
CompleteMediaUploadService.execute()의 컨텐츠 타입/사이즈 서버 재검증 분기(43~47번 줄,storedObject.contentType/contentLength체크)를 직접 검증하는 테스트가 없습니다. 클라이언트가 선언한 값과 실제 업로드된 객체가 다른 경우를 막는 핵심 방어 로직이라 커버리지를 추가하면 좋겠습니다.
(참고로 V4__support_pending_media_uploads.sql의 ALTER COLUMN uploader_id SET NOT NULL은 PostgreSQL에서 기존 CHECK 제약 없이는 테이블 풀스캔 + ACCESS EXCLUSIVE 락을 유발할 수 있습니다. 지금 단계에서는 데이터량이 적어 문제없겠지만, blue-green 무중단 배포 원칙상 나중에 큰 테이블에 비슷한 마이그레이션을 쓸 땐 유의가 필요합니다.)
hej090224
approved these changes
Aug 5, 2026
hej090224
added a commit
that referenced
this pull request
Aug 5, 2026
develop merged PR #20's V4__support_pending_media_uploads.sql after this branch's V4__add_friend_request_indexes_and_pending_pair_constraint.sql was already written. Renumbering to V5 to avoid two migrations claiming version 4, which Flyway rejects (this is what broke CI on the merge commit).
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.
✨ 작업 내용
pending/객체를 영구 경로로 승격하도록 구현하였습니다.uploadKey의 재시도와 동시 요청에서도 중복Media가 생성되지 않도록 멱등성을 보장하였습니다.MediaStorage포트와 AWS S3 어댑터, Flyway V4 마이그레이션을 추가하였습니다.🔍 리뷰 시 참고사항
tbl_media.uploader_id는 기존 캡슐 작성자로 backfill한 뒤NOT NULL로 전환하였습니다.media_url컬럼은 2단계 삭제를 위해 남겨두고NOT NULL제약만 해제하였습니다.pending/1일 만료 Lifecycle 설정이 필요합니다.✅ 체크리스트
.env.example등) 변경이 필요한 경우 작성 또는 수정했나요?📎 관련 이슈(선택)