Skip to content

Conversation

@bbbang105
Copy link
Member

@bbbang105 bbbang105 commented Dec 21, 2025

✅ PR 유형

어떤 변경 사항이 있었나요?

  • 새로운 기능 추가
  • 버그 수정
  • 코드에 영향을 주지 않는 변경사항(오타 수정, 탭 사이즈 변경, 변수명 변경)
  • 코드 리팩토링
  • 주석 추가 및 수정
  • 문서 수정
  • 빌드 부분 혹은 패키지 매니저 수정
  • 파일 혹은 폴더명 수정
  • 파일 혹은 폴더 삭제

🚀 작업 내용

이번 PR에서 작업한 내용을 구체적으로 설명해주세요. (이미지 첨부 가능)

  • 클로드 코드가 참조하는 문서를 추가하였습니다. (클로드 md 등)
  • 온보딩 시에 간헐적으로 post 호출이 빠르게 들어와 500에러가 발생하는 경우가 있었습니다. DB 단에서 막혔기에 서비스 사용을 못 하게 된 것은 아니지만, 애플리케이션 로직에서 한 번 더 방어하는 것이 좋겠다는 생각이 들어 로직을 추가하였습니다.

📝️ 관련 이슈

본인이 작업한 내용이 어떤 Issue와 관련이 있는지 작성해주세요.


💬 기타 사항 or 추가 코멘트

남기고 싶은 말, 참고 블로그 등이 있다면 기록해주세요.

Summary by CodeRabbit

릴리스 노트

  • 새 기능

    • 사용자 중복 가입 방지 기능 추가. 기존 사용자로 등록되어 있으면 409 Conflict 상태와 USER-007 오류 코드 반환.
  • 버그 수정

    • 데이터베이스 고유 제약 조건 위반 문제 해결.
  • 문서

    • 프로젝트 개요 및 개발 가이드 문서 추가.

✏️ Tip: You can customize this high-level summary in your review settings.

@bbbang105 bbbang105 self-assigned this Dec 21, 2025
@bbbang105 bbbang105 added 📄 docs 문서 추가 및 수정 🚀 feat 새로운 기능 추가 / 일부 코드 추가 / 일부 코드 수정 (리팩토링과 구분) / 디자인 요소 수정 labels Dec 21, 2025
@coderabbitai
Copy link

coderabbitai bot commented Dec 21, 2025

Walkthrough

온보딩 중복 방지 기능을 추가하여 providerId로 기존 사용자를 검증하고, 중복 발견 시 409 Conflict 상태를 반환합니다. UserService, UserRepository, UserErrorStatus에 새로운 메서드와 에러 상태를 도입하고 관련 문서를 작성했습니다.

Changes

Cohort / File(s) Summary
에러 처리 인프라
src/main/java/side/onetime/exception/status/UserErrorStatus.java
_ALREADY_REGISTERED_USER 열거형 상수 추가 (HTTP 409, USER-007)
데이터 접근 계층
src/main/java/side/onetime/repository/UserRepository.java
existsByProviderId(String providerId) 메서드 추가
비즈니스 로직 계층
src/main/java/side/onetime/service/UserService.java
onboardUser() 메서드에 providerId 중복 검증 로직 추가
프로젝트 문서
.claude/docs/features/onboarding-duplicate-prevention.md, CLAUDE.md
온보딩 중복 방지 워크플로우 및 프로젝트 가이드 문서 작성

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • 특별 주의 영역:
    • UserService.onboardUser()의 예외 처리 흐름이 기존 동작과 호환되는지 확인
    • existsByProviderId() 메서드의 쿼리 구현이 성능상 최적인지 검토
    • 동시성 환경에서 race condition 가능성 검토 (문서에서 언급)

Poem

🐰 새로운 사용자가 두 번 올 때면,
우리 저장소가 미리 알아채네!
providerId로 쏘옥 확인하고,
409로 친절히 인사하지요,
중복은 막고 데이터는 깨끗하게! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed PR 제목은 온보딩 시 중복 가입 방어 로직 추가라는 주요 변경사항을 명확하고 간결하게 요약하고 있으며, 실제 코드 변경과 완벽하게 일치합니다.
Description check ✅ Passed PR 설명이 요구되는 모든 주요 섹션을 포함하고 있으며, PR 유형(새로운 기능 추가, 문서 수정)을 명확히 선택하고, 작업 내용을 구체적으로 설명하고, 관련 이슈를 명시했습니다.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/#304

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
CLAUDE.md (1)

90-90: 마크다운 서식 개선 제안 (선택사항)

Line 90의 @Transactional 텍스트가 강조 구문으로 인식되고 있습니다. 의도한 서식이 맞다면 무시하셔도 됩니다.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 429a7fb and 7439483.

📒 Files selected for processing (5)
  • .claude/docs/features/onboarding-duplicate-prevention.md (1 hunks)
  • CLAUDE.md (1 hunks)
  • src/main/java/side/onetime/exception/status/UserErrorStatus.java (1 hunks)
  • src/main/java/side/onetime/repository/UserRepository.java (1 hunks)
  • src/main/java/side/onetime/service/UserService.java (1 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
CLAUDE.md

90-90: Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build and Push to ECR
🔇 Additional comments (3)
src/main/java/side/onetime/exception/status/UserErrorStatus.java (1)

18-18: LGTM! 적절한 에러 코드 추가입니다.

중복 가입 시나리오에 대해 409 Conflict 상태 코드를 사용한 것은 RESTful 표준에 부합합니다. 에러 메시지도 명확하고 일관된 형식을 따르고 있습니다.

src/main/java/side/onetime/repository/UserRepository.java (1)

18-18: LGTM! Spring Data JPA 네이밍 컨벤션을 따르고 있습니다.

existsByProviderId 메서드는 Spring Data JPA가 자동으로 구현해주며, 중복 체크를 위한 효율적인 EXISTS 쿼리를 생성합니다. 이미 존재하는 findByProviderId 메서드를 통해 providerId 필드가 유효함을 확인할 수 있습니다.

src/main/java/side/onetime/service/UserService.java (1)

44-48: 중복 가입 방어 로직이 잘 구현되었습니다.

애플리케이션 레벨에서 대부분의 중복 요청을 방어하고 명확한 에러 메시지(409 Conflict)를 반환하는 것은 좋은 접근입니다. provider_id 컬럼에 unique 제약이 실제로 존재하며(@Column(unique = true)), check-then-act 패턴의 race condition은 DB unique constraint가 최종 방어선 역할을 하므로 이 저빈도 작업에서는 허용 가능한 트레이드오프입니다.

Copy link
Member

@anxi01 anxi01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@bbbang105 bbbang105 merged commit b6b90b8 into develop Dec 21, 2025
4 checks passed
@bbbang105 bbbang105 deleted the feature/#304 branch December 21, 2025 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📄 docs 문서 추가 및 수정 🚀 feat 새로운 기능 추가 / 일부 코드 추가 / 일부 코드 수정 (리팩토링과 구분) / 디자인 요소 수정 😵‍💫 sangho 상호 PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feat]: 온보딩 API 중복 호출 방지를 위한 방어 로직을 추가한다

3 participants