-
Notifications
You must be signed in to change notification settings - Fork 0
[YS-534] feat: 공고 키워드 자동완성 일일 사용량 제한 로직 비활성화 #164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Walkthrough일일 사용량 제한 검증 기능이 비활성화되었습니다. 실제 코드에서는 해당 검증 메서드 호출이 주석 처리되었고, 테스트 코드에서는 일일 사용량 초과 예외를 확인하는 테스트가 주석 처리되었습니다. 그 외의 로직 변경은 없습니다. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~7 minutes Poem
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. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
application/src/main/kotlin/com/dobby/usecase/experiment/ExtractExperimentPostKeywordsUseCase.kt (2)
21-21: 사용하지 않는 코드 정리 고려일일 사용량 제한이 영구적으로 비활성화될 예정이라면, 사용하지 않는 상수(
DAILY_USAGE_LIMIT)와 검증 메서드(validateDailyUsageLimit)를 제거하는 것을 고려해보세요. 임시 비활성화라면 현재 상태를 유지하는 것이 적절합니다.영구 제거 시 다음 코드를 삭제할 수 있습니다:
- companion object { - private const val DAILY_USAGE_LIMIT = 2 - } - private fun validateDailyUsageLimit(memberId: String) { - val today = TimeProvider.currentDateTime().toLocalDate() - val startOfDay = today.atStartOfDay() - val endOfDay = today.plusDays(1).atStartOfDay() - - val todayUsageCount = experimentPostKeywordsGateway.countByMemberIdAndCreatedAtBetween( - memberId = memberId, - start = startOfDay, - end = endOfDay - ) - - if (todayUsageCount >= DAILY_USAGE_LIMIT) { - throw ExperimentPostKeywordsDailyLimitExceededException - } - }Also applies to: 48-62
3-3: 사용하지 않는 import 정리
ExperimentPostKeywordsDailyLimitExceededExceptionimport가 더 이상 사용되지 않습니다. 영구 비활성화라면 제거를 고려해보세요.-import com.dobby.exception.ExperimentPostKeywordsDailyLimitExceededExceptionapplication/src/test/kotlin/com/dobby/usecase/experiment/ExtractExperimentPostKeywordsUseCaseTest.kt (1)
55-61: 사용하지 않는 목 설정 정리남아있는 테스트에서
countByMemberIdAndCreatedAtBetween메서드에 대한 목 설정이 더 이상 필요하지 않습니다. 일일 사용량 검증이 비활성화되었으므로 해당 목 설정을 제거할 수 있습니다.- every { - experimentPostKeywordsLogGateway.countByMemberIdAndCreatedAtBetween( - memberId = memberId, - start = currentDateTime.toLocalDate().atStartOfDay(), - end = currentDateTime.toLocalDate().plusDays(1).atStartOfDay() - ) - } returns 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
application/src/main/kotlin/com/dobby/usecase/experiment/ExtractExperimentPostKeywordsUseCase.kt(1 hunks)application/src/test/kotlin/com/dobby/usecase/experiment/ExtractExperimentPostKeywordsUseCaseTest.kt(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: Ji-soo708
PR: YAPP-Github/Gradmeet-BE#154
File: application/src/main/kotlin/com/dobby/usecase/experiment/ExtractExperimentPostKeywordsUseCase.kt:33-46
Timestamp: 2025-07-27T12:26:47.814Z
Learning: Gradmeet-BE 프로젝트에서 하루 최대 2회 사용 제한이 있는 기능의 경우, unique constraint나 낙관적 락 대신 DB 조회 기반 검증 방식을 선호한다. 분산 락은 나중에 최적화가 필요할 때 고려한다.
Learnt from: Ji-soo708
PR: YAPP-Github/Gradmeet-BE#140
File: domain/src/main/kotlin/com/dobby/gateway/auth/GoogleAuthGateway.kt:7-7
Timestamp: 2025-06-04T09:02:40.657Z
Learning: Ji-soo708의 팀은 로컬 ktlint 기준과 GitHub ktlint 체크 기준이 다를 때, 기존 코드베이스와의 일관성을 위해 로컬 기준을 우선시한다.
Learnt from: Ji-soo708
PR: YAPP-Github/Gradmeet-BE#154
File: infrastructure/src/main/kotlin/com/dobby/mapper/ExperimentPostKeywordsLogMapper.kt:15-22
Timestamp: 2025-07-27T12:37:15.372Z
Learning: Ji-soo708의 팀에서는 JSON 역직렬화 시 예외를 catch하여 래핑하기보다는, 예외를 자연스럽게 상위로 전파시켜 원본 컨텍스트를 보존하고 후속 조치를 용이하게 하는 것을 선호한다.
📚 Learning: ai가 텍스트에서 키워드를 추출하는 과정에서 enum 변환 실패(illegalargumentexception)는 정상적인 상황에 가깝다. 따라서 experimentpostkeywo...
Learnt from: Ji-soo708
PR: YAPP-Github/Gradmeet-BE#150
File: infrastructure/src/main/kotlin/com/dobby/external/prompt/ExperimentPostKeywordMapper.kt:52-58
Timestamp: 2025-07-17T08:06:16.021Z
Learning: AI가 텍스트에서 키워드를 추출하는 과정에서 enum 변환 실패(IllegalArgumentException)는 정상적인 상황에 가깝다. 따라서 ExperimentPostKeywordMapper에서 TimeSlot, MatchType 등의 enum 변환 실패 시 로깅을 추가하지 않는 것이 적절하다.
Applied to files:
application/src/test/kotlin/com/dobby/usecase/experiment/ExtractExperimentPostKeywordsUseCaseTest.kt
⏰ 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). (2)
- GitHub Check: Check Code Quality
- GitHub Check: build
🔇 Additional comments (2)
application/src/main/kotlin/com/dobby/usecase/experiment/ExtractExperimentPostKeywordsUseCase.kt (1)
35-35: 일일 사용량 제한 비활성화 확인됨프론트엔드 요청에 따라 일일 사용량 제한 로직이 정상적으로 비활성화되었습니다. 주석 처리 방식은 향후 재활성화 가능성을 고려한 적절한 접근법입니다.
application/src/test/kotlin/com/dobby/usecase/experiment/ExtractExperimentPostKeywordsUseCaseTest.kt (1)
72-97: 테스트 비활성화 일관성 확인됨구현부 변경사항과 일치하게 일일 사용량 초과 테스트가 적절히 주석 처리되었습니다. 기능 비활성화에 따른 테스트 수정이 올바르게 반영되었습니다.
영구 비활성화라면 주석 처리된 테스트 코드 제거를 고려해보세요:
-// given("일일 사용 한도에 도달한 사용자가") { -// val memberId = "exceeded_member_456" -// val inputText = "실험 참여자 모집" -// val input = ExtractExperimentPostKeywordsUseCase.Input(memberId, inputText) -// -// val mockMember = mockk<Member>() -// val currentDateTime = LocalDateTime.of(2025, 1, 27, 15, 30, 0) -// -// every { TimeProvider.currentDateTime() } returns currentDateTime -// every { memberGateway.getById(memberId) } returns mockMember -// every { -// experimentPostKeywordsLogGateway.countByMemberIdAndCreatedAtBetween( -// memberId = memberId, -// start = currentDateTime.toLocalDate().atStartOfDay(), -// end = currentDateTime.toLocalDate().plusDays(1).atStartOfDay() -// ) -// } returns 2 -// -// `when`("키워드 추출을 요청하면") { -// then("DailyLimitExceededException 예외가 발생해야 한다") { -// shouldThrow<ExperimentPostKeywordsDailyLimitExceededException> { -// extractExperimentPostKeywordsUseCase.execute(input) -// } -// } -// } -// }
* feat: disable daily usage limit check * test: temporarily remove tests for keyword autocomplete usage limit
* feat: disable daily usage limit check * test: temporarily remove tests for keyword autocomplete usage limit
💡 작업 내용
✅ 셀프 체크리스트
🙋🏻 확인해주세요
🔗 Jira 티켓
https://yappsocks.atlassian.net/browse/YS-534
Summary by CodeRabbit
버그 수정
테스트