fix(feed): 서포터 중복 수락 방지 및 accumulateFunding null 안전성 보완#84
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough
ChangesFeed Item Acceptance Limit
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested reviewers
Poem
✨ 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 |
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
ca5tlechan
left a comment
There was a problem hiding this comment.
❌ Changes Requested — Blocking 1건
✅ 좋은 점
accumulateFunding()null 안전성 —fundedAmount/confirmedPartnerCountnull 체크 정상 적용 ✅- 비관적 락 획득 후
canAcceptMore()체크 순서 올바름 ✅
🔴 Blocking — canAcceptMore() maxParticipants 무시, 1 하드코딩
FeedItem에 maxParticipants 필드가 존재하지만 canAcceptMore()는 이를 무시하고 confirmed < 1로 고정합니다.
maxParticipants=3으로 생성된 피드는 1명이 수락된 순간 canAcceptMore() = false가 되어, 나머지 2개 슬롯을 채울 수 없습니다.
수정안:
public boolean canAcceptMore() {
int confirmed = this.confirmedPartnerCount != null ? this.confirmedPartnerCount : 0;
int max = this.maxParticipants != null ? this.maxParticipants : 1;
return confirmed < max;
}만약 제품 정책상 서포터는 항상 1명으로 고정이라면, 이를 명시적으로 상수화하고 maxParticipants 필드와의 관계를 주석으로 설명해 주세요.
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
리뷰 반영 (ca5tlechan)정책 확인: 서포터는 OFFER/REQUEST 모두 1명으로 고정하는 것이 현재 서비스 정책입니다. 변경 내용:
private static final int MAX_SUPPORTERS_PER_FEED = 1;
public boolean canAcceptMore() {
int confirmed = this.confirmedPartnerCount != null ? this.confirmedPartnerCount : 0;
return confirmed < MAX_SUPPORTERS_PER_FEED;
} |
ca5tlechan
left a comment
There was a problem hiding this comment.
✅ Approve — Blocking 수정 확인
✅ 수정 확인
MAX_SUPPORTERS_PER_FEED = 1상수 추출 — 매직 넘버 제거 ✅- Javadoc 명시 —
maxParticipants는 프론트 UI 표시용, 수락 상한 판단에는MAX_SUPPORTERS_PER_FEED사용함을 명확히 구분 ✅ accumulateFunding()null 안전성 유지 ✅- 비관적 락 획득 후
canAcceptMore()체크 순서 올바름 ✅
- MAX_SUPPORTERS_PER_FEED = 1 상수 추출 - 주석에 maxParticipants 필드(UI 표시용)와의 관계 명시 → maxParticipants는 모집 정원 안내용이며 수락 상한 판단에 미사용 - ca5tlechan 리뷰 반영 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fc54412 to
fd785a0
Compare
관련 이슈
Closes #89
문제
OFFER/REQUEST 피드에서 작성자가 이미 서포터를 수락했음에도 두 번째 서포터를 수락할 수 있었고, 이 경우
accumulateFunding에서Integer필드가 DB에서 null로 로딩돼 500 NPE 발생.변경 내용
FeedItem.javacanAcceptMore()추가:confirmedPartnerCount >= 1이면false→ OFFER/REQUEST 모두 서포터 1명 상한accumulateFunding()null 안전 처리:@Builder.Default가 Hibernate 리플렉션 로딩 시 미적용되는 문제 보완FeedItemService.javaacceptApplication()에서 작성자 확인 직후canAcceptMore()체크 삽입IllegalStateException→ GlobalExceptionHandler가 400 반환 (기존 500 → 400)테스트 시나리오
이미 서포터 모집이 완료된 피드입니다.Summary by CodeRabbit