refactor: SYSTEM 메시지 페이로드 저장 계약 정리#138
Conversation
SYSTEM 메시지에서 content·metadata.nickname·metadata.profileImageUrl을 BSON·JSON 키 자체로 남기지 않고, 표시 책임을 클라이언트로 일원화하는 refactor 설계안을 docs/superpowers/specs/에 작성한다.
|
Warning Review limit reached
More reviews will be available in 45 minutes and 24 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 Walkthrough검토 개요SYSTEM 메시지에서 display용 필드( 변경 사항SYSTEM 메시지 페이로드 정리
시퀀스 다이어그램sequenceDiagram
participant Event as 멤버 이벤트
participant Listener as 리스너
participant MessageService as MessageService
participant SystemMessageService as SystemMessageService
participant ChatMessage as ChatMessage
participant Repository as MongoDB
participant Response as API응답
Event->>Listener: 이벤트발행(roomId, userId)
Listener->>MessageService: sendMember*SystemMessage(roomId, userId)
MessageService->>SystemMessageService: sendMember*SystemMessage(roomId, userId)
SystemMessageService->>SystemMessageService: 메타데이터구성<br/>{eventType, userId}
SystemMessageService->>ChatMessage: system(roomId, metadata)<br/>content=null
ChatMessage->>Repository: 저장(content없음)
Response->>Response: `@JsonInclude`(NON_NULL)<br/>content제외
Response-->>Client: {messageType,metadata}<br/>(content미포함)
Client->>Client: metadata.eventType+userId<br/>로방멤버조회
Client-->>Client: 문구조립<br/>(닉네임/프로필포함)
검증 노력🎯 3 (Moderate) | ⏱️ ~25 분 제안 레이블
공개
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@src/test/java/com/howaboutus/backend/messages/controller/MessageControllerTest.java`:
- Line 130: In MessageControllerTest replace the non-deterministic Instant.now()
usage with a fixed instant to avoid flaky tests and Sonar warnings; either
substitute Instant.now() with a constant Instant.parse("YYYY-MM-DDTHH:MM:SSZ")
(e.g. Instant.parse("2020-01-01T00:00:00Z")) in the test, or introduce a fixed
Clock via Clock.fixed(...) and inject/provide it to the code under test
(referencing MessageControllerTest and the test method using Instant.now()) so
all time-dependent assertions use the deterministic fixed time.
In
`@src/test/java/com/howaboutus/backend/messages/document/SystemMessagePayloadIntegrationTest.java`:
- Around line 67-70: The tests in SystemMessagePayloadIntegrationTest currently
only assert presence of keys for MEMBER_LEFT and MEMBER_KICKED but do not verify
the actual metadata.userId value; update the assertions in the test methods
where Document metadata = raw.get("metadata", Document.class) (the MEMBER_LEFT
block around the existing
assertThat(metadata.getString("eventType")).isEqualTo("MEMBER_LEFT") and the
analogous MEMBER_KICKED block) to also assert that metadata.getString("userId")
equals the expected user id for each case so the tests fail on incorrect userId
regressions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 33e3aa28-df38-4efc-9297-61dfa187d0d5
📒 Files selected for processing (27)
docs/ai/decisions/20260607-1636-system-message-metadata-rendering.mddocs/ai/decisions/20260608-1553-system-message-payload-cleanup.mddocs/ai/erd.mddocs/ai/features.mddocs/superpowers/plans/2026-06-08-mongo-message-payload.mddocs/superpowers/specs/2026-06-08-mongo-message-payload-design.mdsrc/main/java/com/howaboutus/backend/messages/controller/dto/MessageResponse.javasrc/main/java/com/howaboutus/backend/messages/document/ChatMessage.javasrc/main/java/com/howaboutus/backend/messages/listener/HostDelegatedMessageListener.javasrc/main/java/com/howaboutus/backend/messages/listener/MemberApprovedMessageListener.javasrc/main/java/com/howaboutus/backend/messages/listener/MemberKickedMessageListener.javasrc/main/java/com/howaboutus/backend/messages/listener/MemberLeftMessageListener.javasrc/main/java/com/howaboutus/backend/messages/service/MessageService.javasrc/main/java/com/howaboutus/backend/messages/service/SystemMessageService.javasrc/main/java/com/howaboutus/backend/realtime/service/dto/MessagePayload.javasrc/main/java/com/howaboutus/backend/realtime/service/dto/RoomMemberPayload.javasrc/test/java/com/howaboutus/backend/ai/service/AiSummaryServiceTest.javasrc/test/java/com/howaboutus/backend/messages/controller/MessageControllerTest.javasrc/test/java/com/howaboutus/backend/messages/document/SystemMessagePayloadIntegrationTest.javasrc/test/java/com/howaboutus/backend/messages/listener/HostDelegatedMessageListenerTest.javasrc/test/java/com/howaboutus/backend/messages/listener/MemberApprovedMessageListenerTest.javasrc/test/java/com/howaboutus/backend/messages/listener/MemberKickedMessageListenerTest.javasrc/test/java/com/howaboutus/backend/messages/listener/MemberLeftMessageListenerTest.javasrc/test/java/com/howaboutus/backend/messages/service/MessageServiceTest.javasrc/test/java/com/howaboutus/backend/messages/service/SystemMessageServiceTest.javasrc/test/java/com/howaboutus/backend/realtime/service/RoomMemberBroadcasterTest.javasrc/test/java/com/howaboutus/backend/realtime/service/RoomMessageBroadcasterTest.java
|



변경 내용
변경 이유
테스트
./gradlew build/review-code-against-docs스킬로 검증체크리스트
하네스 변경 체크리스트
Summary by CodeRabbit
Release Notes