[FEAT] 유저가 임의로 웹훅 삭제 시, 트래킹을 끊는 로직 작성#73
Conversation
WalkthroughGitHub 웹훅 삭제 시 발생할 수 있는 예외를 처리하도록 서비스 로직이 개선되었으며, 404 오류에 대해 새로운 Changes
Sequence Diagram(s)sequenceDiagram
participant Service as GitHubService
participant Client as gitHubClient
participant Logger as slf4j
Service->>Client: deleteWebhook(token, webhook, repo)
alt 정상 삭제
Client-->>Service: 성공
else GithubNotFoundException 발생
Client-->>Service: 예외 발생
Service->>Logger: error("웹훅을 찾을 수 없음", 예외, repo)
Service-->>Service: 예외 무시하고 계속 진행
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested labels
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. ✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Test Results0 tests 0 ✅ 0s ⏱️ Results for commit 6d04d99. |
📝 Test Coverage Report
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
gss-client/gss-github-client/src/main/java/com/devoops/exception/GithubNotFoundException.java (1)
3-7: 직렬화 호환성을 위해 serialVersionUID 추가를 고려해주세요.RuntimeException을 상속하는 예외 클래스는 Serializable을 구현하므로, 직렬화 호환성을 위해 serialVersionUID를 명시적으로 선언하는 것이 좋습니다.
public class GithubNotFoundException extends RuntimeException { + private static final long serialVersionUID = 1L; + public GithubNotFoundException(String message) { super(message); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
gss-api-app/src/main/java/com/devoops/service/GitHubService.java(2 hunks)gss-api-app/src/test/java/com/devoops/service/facade/RepositoryFacadeServiceTest.java(3 hunks)gss-client/gss-github-client/src/main/java/com/devoops/client/GithubExchangeFilterFunction.java(2 hunks)gss-client/gss-github-client/src/main/java/com/devoops/exception/GithubNotFoundException.java(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: in this codebase, equals and hashcode methods (including lombok's @EqualsAndHashCode annotation) are...
Learnt from: coli-geonwoo
PR: mash-up-kr/GSS-Server#16
File: gss-domain/src/main/java/com/devoops/domain/entity/github/Question.java:6-12
Timestamp: 2025-06-09T14:20:16.095Z
Learning: In this codebase, equals and hashCode methods (including Lombok's @EqualsAndHashCode annotation) are prohibited by team coding convention and should not be suggested in code reviews.
Applied to files:
gss-api-app/src/test/java/com/devoops/service/facade/RepositoryFacadeServiceTest.java
🧬 Code Graph Analysis (1)
gss-client/gss-github-client/src/main/java/com/devoops/client/GithubExchangeFilterFunction.java (1)
gss-client/gss-github-client/src/main/java/com/devoops/exception/GithubNotFoundException.java (1)
GithubNotFoundException(3-7)
🔇 Additional comments (16)
gss-client/gss-github-client/src/main/java/com/devoops/client/GithubExchangeFilterFunction.java (4)
3-3: LGTM!새로운 GithubNotFoundException import가 올바르게 추가되었습니다.
30-32: GitHub 404 에러에 대한 특화된 예외 처리로 개선되었습니다.기존의 일반적인 GssException 대신 GithubNotFoundException을 사용하여 GitHub 리소스를 찾을 수 없는 경우를 더 명확하게 구분할 수 있게 되었습니다. 이는 상위 레이어에서 해당 예외를 적절히 처리할 수 있도록 도와줍니다.
3-3: 새로운 예외 클래스 import가 추가되었습니다.GithubNotFoundException을 사용하기 위한 import 구문이 적절히 추가되었습니다.
31-31: 404 오류에 대한 더 구체적인 예외 처리로 개선되었습니다.기존의 일반적인 GssException 대신 GithubNotFoundException을 사용하여 404 오류를 더 명확하게 처리할 수 있게 되었습니다. 이를 통해 서비스 레이어에서 GitHub 리소스를 찾을 수 없는 경우를 구분하여 처리할 수 있습니다.
gss-api-app/src/test/java/com/devoops/service/facade/RepositoryFacadeServiceTest.java (4)
7-7: LGTM!필요한 import 문들이 올바르게 추가되었습니다.
Also applies to: 20-20
84-101: 웹훅 삭제 실패 시나리오에 대한 테스트가 잘 구현되었습니다.이 테스트는 PR의 핵심 요구사항을 정확히 검증합니다:
- 웹훅 삭제 시 GithubNotFoundException이 발생해도
- 레포지토리의 트래킹 상태는 여전히 false로 설정되는지 확인
mocking과 assertion이 적절하게 구현되어 있고, 기존 테스트 패턴과 일관성을 유지하고 있습니다.
20-20: 새로운 예외 클래스에 대한 import가 추가되었습니다.테스트에서 GithubNotFoundException을 사용하기 위한 import 구문이 적절히 추가되었습니다.
84-101: 웹훅 삭제 실패 시나리오에 대한 테스트가 잘 작성되었습니다.GitHub에서 웹훅을 찾을 수 없는 상황에서도 레포지토리 트래킹을 정상적으로 비활성화할 수 있는지 검증하는 테스트가 적절히 구현되었습니다.
- 명확한 테스트 메서드명으로 테스트 의도가 잘 드러남
- 적절한 목킹을 통해 예외 상황을 재현
- 예상되는 동작(isTracking = false)을 정확히 검증
gss-api-app/src/main/java/com/devoops/service/GitHubService.java (7)
16-16: LGTM!필요한 import와 @slf4j 어노테이션이 올바르게 추가되었습니다.
Also applies to: 21-21, 26-26
96-98: 웹훅 삭제 로직이 안전하게 분리되었습니다.tryDeleteWebhook 메서드로 위험한 작업을 분리하여, 웹훅 삭제가 실패하더라도 데이터베이스에서는 여전히 웹훅 레코드가 삭제되도록 구현되었습니다.
100-111: isTracking 상태 갱신 로직 확인 필요
GitHubNotFoundException 처리(로그만 남기고 예외 전파하지 않음)는 PR 요구사항에 맞게 구현되었습니다. 다만, 웹훅 삭제 이후GithubRepository#isTracking필드를false로 설정하는 로직이 코드베이스에서 확인되지 않습니다. 삭제 처리 흐름에서 트래킹 중단이 정상적으로 수행되는지 아래 항목을 점검해주세요.
deleteRepository메서드 구현부에서isTracking = false또는setTracking(false)호출 여부- 별도의
updateRepository,stopTracking등 서비스 레이어 메서드 확인- JPA 엔티티 변경 혹은 CQRS 핸들러 등 데이터 변경 로직 내 상태 변경 누락 여부
16-16: 새로운 예외 클래스에 대한 import가 추가되었습니다.GithubNotFoundException을 처리하기 위한 import 구문이 적절히 추가되었습니다.
21-21: 로깅을 위한 Slf4j 설정이 추가되었습니다.웹훅 삭제 실패 시 로깅을 위해 @slf4j 어노테이션과 import가 적절히 추가되었습니다.
Also applies to: 26-26
96-96: 웹훅 삭제 로직이 안전한 방식으로 분리되었습니다.기존의 직접적인 웹훅 삭제 호출을 tryDeleteWebhook 메서드로 분리하여 예외 처리를 할 수 있도록 개선되었습니다.
100-111: 웹훅 삭제 실패에 대한 안전한 예외 처리가 구현되었습니다.GitHub에서 웹훅을 찾을 수 없는 경우에도 트래킹을 중단할 수 있도록 하는 핵심 로직이 잘 구현되었습니다.
- GithubNotFoundException을 명시적으로 캐치하여 예외 전파를 방지
- 디버깅을 위한 충분한 로그 정보 제공 (예외 정보 + 레포지토리 이름)
- 메서드명이 의도를 명확하게 표현 (tryDeleteWebhook)
이를 통해 사용자가 수동으로 웹훅을 삭제한 경우에도 시스템에서 정상적으로 트래킹을 종료할 수 있게 되었습니다.
gss-client/gss-github-client/src/main/java/com/devoops/exception/GithubNotFoundException.java (1)
3-6: 깔끔한 예외 클래스 구현입니다.GitHub 404 오류를 명확하게 표현하는 커스텀 예외 클래스가 적절하게 구현되었습니다. RuntimeException을 상속받아 언체크 예외로 설계한 것이 올바릅니다.
🚩 연관 JIRA 이슈
jira issue url:
유저가 임의로 웹훅을 삭제했다면 GithubNotFoundException이 발생하여 트래킹을 끊는 작업이 불가합니다.
이에 웹훅을 찾지 못하더라도 repo의 상태를 isTracking=false로 바꿀 수 있도록 수정합니다.
🔂 변경 내역
🗣️ 리뷰 요구사항 (선택)
Summary by CodeRabbit
버그 수정
테스트
신규 기능