Conversation
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughAdds an event-driven member-deletion flow: a MemberDeletedEventPayload type is introduced and published by MemberDeleteService via the outbox; a consumer listener consumes the mathrank-member-removed event and calls a new SolverDeleteService to remove any Solver records for the deleted member. Changes
Sequence Diagram(s)sequenceDiagram
actor Client
participant MemberDeleteService
participant Outbox as TransactionalOutboxPublisher
participant Broker as Event Broker
participant Listener as SolvedRankEventMonolithListener
participant SolverDeleteService
Client->>MemberDeleteService: Delete member
activate MemberDeleteService
MemberDeleteService->>MemberDeleteService: Expire tokens
MemberDeleteService->>Outbox: Publish "mathrank-member-removed"\n(MemberDeletedEventPayload)
deactivate MemberDeleteService
activate Outbox
Outbox->>Broker: Emit event
deactivate Outbox
Broker->>Listener: Deliver "mathrank-member-removed"
activate Listener
Listener->>SolverDeleteService: delete(memberId)
activate SolverDeleteService
SolverDeleteService->>SolverDeleteService: findByMemberId(memberId)
alt Solver found
SolverDeleteService->>SolverDeleteService: delete solver\nlog deletion
else Solver not found
SolverDeleteService->>SolverDeleteService: log info (no-op)
end
deactivate SolverDeleteService
deactivate Listener
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 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 |
Summary of ChangesHello @huhdy32, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 PR은 사용자가 삭제될 때 랭킹 시스템에서도 해당 사용자의 랭킹 정보가 함께 삭제되도록 구현하여 데이터의 결과적 일관성을 보장합니다. 이를 위해 회원 삭제 시 이벤트를 발행하고, 랭킹 서비스에서 해당 이벤트를 수신하여 관련 랭킹 데이터를 처리하는 이벤트 기반 방식을 도입했습니다. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
이번 PR은 사용자 삭제 시 이벤트 기반으로 랭킹 정보를 함께 삭제하도록 구현하여 서비스 간의 정합성을 맞추는 좋은 변경입니다. 코드 리뷰 결과, 몇 가지 개선점을 발견했습니다. 첫째, 이벤트 페이로드 객체가 중복으로 정의되어 있어 이를 공통 모듈로 통합하는 것이 필요합니다. 둘째, 이벤트 소비자의 멱등성을 보장하여 반복적인 이벤트 처리에도 시스템이 안정적으로 동작하도록 개선할 필요가 있습니다. 셋째, 이벤트 페이로드에 사용되지 않는 필드가 포함되어 있어 제거를 고려해볼 수 있습니다. 마지막으로, 트랜잭션 내에서 외부 시스템 호출 순서를 조정하여 데이터 정합성을 더 견고하게 만들 수 있습니다. 자세한 내용은 각 코드 라인에 남긴 코멘트를 참고해주세요.
...thrank-auth-domain/src/main/java/kr/co/mathrank/domain/auth/service/MemberDeleteService.java
Show resolved
Hide resolved
...thrank-rank-domain/src/main/java/kr/co/mathrank/domain/rank/service/SolverDeleteService.java
Outdated
Show resolved
Hide resolved
...ank-rank-consumer-monolith/src/main/java/kr/co/mathrank/app/consumer/rank/EventPayloads.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Actionable comments posted: 3
♻️ Duplicate comments (1)
app/consumer/mathrank-rank-consumer-monolith/src/main/java/kr/co/mathrank/app/consumer/rank/EventPayloads.java (1)
33-37: LGTM - This is the shared event payload definition.This record correctly defines the payload structure for member deletion events. The code duplication with the inner record in
MemberDeleteService.javahas been flagged in the review of that file.
🧹 Nitpick comments (1)
domain/mathrank-rank-domain/src/main/java/kr/co/mathrank/domain/rank/service/SolverDeleteService.java (1)
23-23: Remove unnecessary @Valid annotation on Long parameter.The
@Validannotation is used to trigger validation on bean properties. SinceLongis a simple wrapper type with no nested constraints,@Validhas no effect here. Keep@NotNullbut remove@Validfor clarity.- public void delete(@NotNull @Valid final Long memberId) { + public void delete(@NotNull final Long memberId) {
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
app/consumer/mathrank-rank-consumer-monolith/src/main/java/kr/co/mathrank/app/consumer/rank/EventPayloads.java(1 hunks)app/consumer/mathrank-rank-consumer-monolith/src/main/java/kr/co/mathrank/app/consumer/rank/SolvedRankEventMonolithListener.java(3 hunks)domain/mathrank-auth-domain/src/main/java/kr/co/mathrank/domain/auth/service/MemberDeleteService.java(4 hunks)domain/mathrank-rank-domain/src/main/java/kr/co/mathrank/domain/rank/service/SolverDeleteService.java(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
domain/mathrank-rank-domain/src/main/java/kr/co/mathrank/domain/rank/service/SolverDeleteService.java (1)
domain/mathrank-rank-domain/src/main/java/kr/co/mathrank/domain/rank/exception/CannotFoundSolverException.java (1)
CannotFoundSolverException(3-7)
⏰ 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: test
🔇 Additional comments (1)
domain/mathrank-auth-domain/src/main/java/kr/co/mathrank/domain/auth/service/MemberDeleteService.java (1)
42-42: Event publishing looks good for eventual consistency.The outbox-based event publishing after token expiration ensures atomicity. If the event fails to publish, the entire transaction will roll back, maintaining consistency.
...monolith/src/main/java/kr/co/mathrank/app/consumer/rank/SolvedRankEventMonolithListener.java
Show resolved
Hide resolved
...thrank-auth-domain/src/main/java/kr/co/mathrank/domain/auth/service/MemberDeleteService.java
Show resolved
Hide resolved
...thrank-rank-domain/src/main/java/kr/co/mathrank/domain/rank/service/SolverDeleteService.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
domain/mathrank-rank-domain/src/main/java/kr/co/mathrank/domain/rank/service/SolverDeleteService.java (1)
21-21: Consider removing unnecessary@Validannotation.The
@Validannotation is typically used for complex objects with nested validation constraints. For a simpleLongparameter,@NotNullis sufficient. The@Validannotation adds unnecessary overhead without providing additional validation.Apply this diff if you'd like to simplify:
- public void delete(@NotNull @Valid final Long memberId) { + public void delete(@NotNull final Long memberId) {
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
domain/mathrank-rank-domain/src/main/java/kr/co/mathrank/domain/rank/service/SolverDeleteService.java(1 hunks)
⏰ 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: test
🔇 Additional comments (2)
domain/mathrank-rank-domain/src/main/java/kr/co/mathrank/domain/rank/service/SolverDeleteService.java (2)
20-29: LGTM! Idempotent implementation correctly addresses event-driven concerns.The current implementation properly handles the idempotency requirement for event-driven architectures. Using
ifPresentOrElseensures that if the same deletion event is processed multiple times (due to at-least-once delivery guarantees), the operation succeeds silently without throwing exceptions. This prevents poison messages in the message queue.
22-22: The original review comment is incorrect and should be disregarded.The current code correctly uses
findByMemberId(memberId). The Solver entity hasidas its primary key (auto-generated), andmemberIdas a separate unique field. UsingfindById(memberId)would be wrong because it would attempt to usememberIdas the primary key, causing lookups to fail. ThefindByMemberIdmethod is explicitly defined inSolverRepositoryand is the appropriate way to look up solvers by member ID.Likely an incorrect or invalid review comment.
Summary by CodeRabbit