[FEAT] 서재 캐싱 오류 해결 & 내 정보 조회 응답 변경#278
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ 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: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
WalkthroughCursorResponse를 Java record로 전환하고, 라이브러리 캐시 무효화 이벤트 계약을 Set 기반으로 단순화하며, 인증 응답을 UserInfo로 축소하고 관련 컨트롤러/서비스/Redis 무효화 로직과 테스트를 일괄 갱신합니다. ChangesLibrary Service & User Authentication Refactoring
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 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: 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/main/java/app/nook/library/controller/LibraryController.java`:
- Line 73: The controller validation change to `@Min`(1) for the cursor breaks
compatibility and is inconsistent with other controllers and the
BookSearchFacade logic; revert the LibraryController `@RequestParam` annotation
back to `@Min`(0) to match FocusController and BookSearchController, and ensure
BookSearchFacade still treats cursor==0 as “new search” (or add an explicit
conversion from null to 0 in the controller before calling the facade) so
behavior and validations remain consistent across LibraryController,
FocusController, BookSearchController and the BookSearchFacade.
In `@src/main/java/app/nook/redis/service/RedisCacheService.java`:
- Around line 15-19: evictLibraryMonthlyCaches currently always uses
YearMonth.now(), which leaves stale ZSETs for past months when items with
historical focus data are deleted; change the method signature and callers to
accept a collection of affected YearMonth values (or compute the affected
YearMonths before deletion and pass them in the event payload) and then call
redisZSETService.evictMonthlyBooks/evictMonthlyFocusTime/evictMonthlyHourlyFocus
for each YearMonth in that collection instead of only YearMonth.now(); update
any event producers to include the list of impacted YearMonth entries or add a
pre-delete computation step to derive them so all relevant monthly ZSETs are
evicted.
🪄 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
Run ID: 196b5fc6-dc79-4254-8c19-05b055c3606e
📒 Files selected for processing (24)
src/docs/asciidoc/user.adocsrc/main/java/app/nook/global/config/CacheConfig.javasrc/main/java/app/nook/global/dto/CursorResponse.javasrc/main/java/app/nook/library/controller/LibraryController.javasrc/main/java/app/nook/library/dto/LibraryViewDto.javasrc/main/java/app/nook/library/event/LibraryCacheInvalidateEvent.javasrc/main/java/app/nook/library/event/LibraryCacheInvalidationListener.javasrc/main/java/app/nook/library/service/LibraryCommandService.javasrc/main/java/app/nook/library/service/LibraryQueryService.javasrc/main/java/app/nook/redis/service/RedisCacheService.javasrc/main/java/app/nook/user/controller/AuthController.javasrc/main/java/app/nook/user/dto/UserDTO.javasrc/main/java/app/nook/user/oauth/OAuthService.javasrc/main/java/app/nook/user/repository/UserRepository.javasrc/main/java/app/nook/user/service/CustomUserDetailService.javasrc/main/java/app/nook/user/service/UserService.javasrc/test/java/app/nook/controller/library/LibraryControllerTest.javasrc/test/java/app/nook/controller/user/AuthControllerTest.javasrc/test/java/app/nook/focus/service/FocusQueryServiceTest.javasrc/test/java/app/nook/library/service/LibraryCachingIntegrationTest.javasrc/test/java/app/nook/library/service/LibraryServiceTest.javasrc/test/java/app/nook/record/service/RecordQueryServiceTest.javasrc/test/java/app/nook/user/oauth/OAuthServiceTest.javasrc/test/java/app/nook/user/repository/UserRepositoryTest.java
💤 Files with no reviewable changes (2)
- src/main/java/app/nook/user/service/CustomUserDetailService.java
- src/main/java/app/nook/global/config/CacheConfig.java
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/test/java/app/nook/controller/library/LibraryControllerTest.java (1)
313-336: ⚡ Quick win
cursor=0성공 케이스와 별개로 음수 커서 실패 테스트도 유지해 주세요.
@Min(0)검증 분기는 그대로 살아 있는데, 이번 교체로cursor=-1이 400으로 막히는지 확인하는 테스트가 빠졌습니다.cursor=0정상화 테스트는 유지하되, 음수 입력 검증 케이스를 하나 추가해 두는 편이 안전합니다.➕ 테스트 보강 예시
+ `@Test` + `@WithCustomUser` + void 서재_상태별_책_조회_실패_cursor_음수() throws Exception { + mockMvc.perform( + get("/api/v1/library/status") + .param("status", "READING") + .param("cursor", "-1") + .param("size", "20") + .header(AUTH_HEADER, AUTH_TOKEN) + ) + .andExpect(status().isBadRequest()); + + verifyNoInteractions(libraryCommandService, libraryQueryService); + }🤖 Prompt for 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. In `@src/test/java/app/nook/controller/library/LibraryControllerTest.java` around lines 313 - 336, Keep the existing success test 서재_상태별_책_조회_성공_cursor_0은_첫조회로_처리() as-is, and add a new test that exercises the validation branch for negative cursors: perform a GET to "/api/v1/library/status" with param("cursor","-1") (and suitable status/size/header), expect status().isBadRequest(), and verify libraryQueryService.getBooksByStatus is not invoked; this ensures the `@Min`(0) validation is covered and negative cursor inputs return 400.
🤖 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.
Nitpick comments:
In `@src/test/java/app/nook/controller/library/LibraryControllerTest.java`:
- Around line 313-336: Keep the existing success test
서재_상태별_책_조회_성공_cursor_0은_첫조회로_처리() as-is, and add a new test that exercises the
validation branch for negative cursors: perform a GET to
"/api/v1/library/status" with param("cursor","-1") (and suitable
status/size/header), expect status().isBadRequest(), and verify
libraryQueryService.getBooksByStatus is not invoked; this ensures the `@Min`(0)
validation is covered and negative cursor inputs return 400.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 35251ed5-4136-49e0-84fc-2908b3115432
📒 Files selected for processing (7)
src/main/java/app/nook/library/controller/LibraryController.javasrc/main/java/app/nook/library/event/LibraryCacheInvalidateEvent.javasrc/main/java/app/nook/library/event/LibraryCacheInvalidationListener.javasrc/main/java/app/nook/library/service/LibraryCommandService.javasrc/main/java/app/nook/redis/service/RedisCacheService.javasrc/test/java/app/nook/controller/library/LibraryControllerTest.javasrc/test/java/app/nook/library/service/LibraryCachingIntegrationTest.java
|
|
📄 작업 내용 요약
📎 Issue 번호
✅ 작업 목록
📝 기타 참고사항
Summary by CodeRabbit
문서 업데이트
개선사항