Conversation
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 3 minutes and 12 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, 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 have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough
Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/test/java/gg/agit/konect/integration/domain/chat/ChatApiTest.java`:
- Around line 988-989: The test is unstable because it re-fetches a room ID via
chatRoomRepository.findGroupRoomsByMemberUserId(...).stream().findFirst(), which
can pick the wrong room; instead capture and reuse the created room ID returned
in the room-creation response (e.g., response.getChatRoomId() or
createdRoom.getChatRoomId()) wherever roomId is later computed; replace usages
that call findGroupRoomsByMemberUserId (including the other occurrences
referenced) to use the saved response chatRoomId for assertions and subsequent
calls.
- Around line 991-1005: The test currently only asserts membership/ownership;
also assert the created room's type is ChatType.GROUP to prevent false positives
when GROUP vs CLUB_GROUP are mixed; locate ChatApiTest near the existing roomId
usage, load the ChatRoom (e.g., via
chatRoomRepository.findById(roomId).orElseThrow()) and add an assertion that its
type equals ChatType.GROUP (reference ChatType.GROUP and the ChatApiTest test
method to place the check).
- Around line 1294-1343: Add a new test in ChatApiTest that mirrors the other
"kicked member" tests to verify a kicked user cannot read the room details:
after removing the member with performDelete("/chats/rooms/" + groupRoom.getId()
+ "/members/" + memberUser.getId()) and confirming NoContent,
mockLoginUser(memberUser.getId()) and call performGet("/chats/rooms/" +
groupRoom.getId()) (or the existing room detail endpoint) and assert
status().isForbidden() and
jsonPath("$.code").value("FORBIDDEN_CHAT_ROOM_ACCESS"); name the test similarly
(e.g., kickedMemberCannotViewRoom or kickedMemberCannotGetRoomDetails) so it
sits with kickedMemberCannotUpdateRoomName and kickedMemberCannotSendMessage.
🪄 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: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: c773ae2e-8de2-4343-b1e6-fc27827d8e3b
📒 Files selected for processing (1)
src/test/java/gg/agit/konect/integration/domain/chat/ChatApiTest.java
📜 Review details
🧰 Additional context used
📓 Path-based instructions (1)
**/*
⚙️ CodeRabbit configuration file
**/*: 공통 리뷰 톤 가이드:
- 모든 코멘트는 첫 줄에
[LEVEL: ...]태그를 포함한다.- 과장된 표현 없이 사실 기반으로 작성한다.
- 한 코멘트에는 하나의 이슈만 다룬다.
- 코드 예시가 필요하면 최소 수정 예시를 제시한다.
- 가독성/단순화/확장성 이슈를 발견하면 우선순위를 높여 코멘트한다.
Files:
src/test/java/gg/agit/konect/integration/domain/chat/ChatApiTest.java
src/test/java/gg/agit/konect/integration/domain/chat/ChatApiTest.java
Outdated
Show resolved
Hide resolved
| @Test | ||
| @DisplayName("강퇴된 멤버는 채팅방 이름을 수정할 수 없다") | ||
| void kickedMemberCannotUpdateRoomName() throws Exception { | ||
| // given | ||
| mockLoginUser(ownerUser.getId()); | ||
| performDelete("/chats/rooms/" + groupRoom.getId() + "/members/" + memberUser.getId()) | ||
| .andExpect(status().isNoContent()); | ||
|
|
||
| // when & then | ||
| mockLoginUser(memberUser.getId()); | ||
| performPatch( | ||
| "/chats/rooms/" + groupRoom.getId() + "/name", | ||
| new ChatRoomNameUpdateRequest("강퇴 후 이름") | ||
| ) | ||
| .andExpect(status().isForbidden()) | ||
| .andExpect(jsonPath("$.code").value("FORBIDDEN_CHAT_ROOM_ACCESS")); | ||
| } | ||
|
|
||
| @Test | ||
| @DisplayName("강퇴된 멤버는 메시지를 보낼 수 없다") | ||
| void kickedMemberCannotSendMessage() throws Exception { | ||
| // given | ||
| mockLoginUser(ownerUser.getId()); | ||
| performDelete("/chats/rooms/" + groupRoom.getId() + "/members/" + memberUser.getId()) | ||
| .andExpect(status().isNoContent()); | ||
|
|
||
| // when & then | ||
| mockLoginUser(memberUser.getId()); | ||
| performPost( | ||
| "/chats/rooms/" + groupRoom.getId() + "/messages", | ||
| new ChatMessageSendRequest("강퇴 후 메시지") | ||
| ) | ||
| .andExpect(status().isForbidden()) | ||
| .andExpect(jsonPath("$.code").value("FORBIDDEN_CHAT_ROOM_ACCESS")); | ||
| } | ||
|
|
||
| @Test | ||
| @DisplayName("강퇴된 멤버의 방 목록에서 해당 방이 제거된다") | ||
| void kickedMemberRoomRemovedFromList() throws Exception { | ||
| // given | ||
| mockLoginUser(ownerUser.getId()); | ||
| performDelete("/chats/rooms/" + groupRoom.getId() + "/members/" + memberUser.getId()) | ||
| .andExpect(status().isNoContent()); | ||
|
|
||
| // when & then | ||
| mockLoginUser(memberUser.getId()); | ||
| performGet("/chats/rooms") | ||
| .andExpect(status().isOk()) | ||
| .andExpect(jsonPath("$.rooms[?(@.roomId==" + groupRoom.getId() + ")]").doesNotExist()); | ||
| } |
There was a problem hiding this comment.
[LEVEL: high] 강퇴 후 메시지 조회 차단 케이스가 빠져 있습니다.
현재는 강퇴 후 PATCH, POST, 목록 제거만 확인합니다. GET /chats/rooms/{chatRoomId}가 계속 열려 있으면 강퇴된 사용자가 대화 이력을 읽을 수 있는데, 이 스위트는 그 회귀를 잡지 못합니다. 같은 흐름으로 FORBIDDEN_CHAT_ROOM_ACCESS까지 고정해 두는 편이 좋습니다.
최소 수정 예시
+ `@Test`
+ `@DisplayName`("강퇴된 멤버는 메시지를 조회할 수 없다")
+ void kickedMemberCannotGetMessages() throws Exception {
+ mockLoginUser(ownerUser.getId());
+ performDelete("/chats/rooms/" + groupRoom.getId() + "/members/" + memberUser.getId())
+ .andExpect(status().isNoContent());
+
+ mockLoginUser(memberUser.getId());
+ performGet("/chats/rooms/" + groupRoom.getId() + "?page=1&limit=20")
+ .andExpect(status().isForbidden())
+ .andExpect(jsonPath("$.code").value("FORBIDDEN_CHAT_ROOM_ACCESS"));
+ }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/test/java/gg/agit/konect/integration/domain/chat/ChatApiTest.java` around
lines 1294 - 1343, Add a new test in ChatApiTest that mirrors the other "kicked
member" tests to verify a kicked user cannot read the room details: after
removing the member with performDelete("/chats/rooms/" + groupRoom.getId() +
"/members/" + memberUser.getId()) and confirming NoContent,
mockLoginUser(memberUser.getId()) and call performGet("/chats/rooms/" +
groupRoom.getId()) (or the existing room detail endpoint) and assert
status().isForbidden() and
jsonPath("$.code").value("FORBIDDEN_CHAT_ROOM_ACCESS"); name the test similarly
(e.g., kickedMemberCannotViewRoom or kickedMemberCannotGetRoomDetails) so it
sits with kickedMemberCannotUpdateRoomName and kickedMemberCannotSendMessage.
🔍 개요
🚀 주요 변경 내용
💬 참고 사항
✅ Checklist (완료 조건)