Conversation
📝 WalkthroughWalkthroughThis PR implements an AI match-report analysis feature enabling users to compare themselves against another user. The implementation flows from domain port definition through data loading, external AI integration, use case orchestration, and REST exposure, with comprehensive test coverage at the loader and use case levels. ChangesAI Match Report Analysis Feature
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Possibly related PRs
Suggested reviewers
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 docstrings
🧪 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: 1
🤖 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/com/project/bangjjack/domain/user/external/aimatch/AiMatchReportClient.java`:
- Around line 110-131: callMatchReport performs a blocking external call on
aiMatchRestClient so you must enforce the configured timeout bounds from
AiMatchApiProperties to avoid occupying request threads: ensure
AiMatchClientConfig.buildClient(...) actually applies AiMatchApiProperties
connect/read timeouts to the underlying client used by
aiMatchRestClient/aiMatchBatchRestClient, and wrap the blocking call in
callMatchReport with a timeout guard (e.g. execute the blocking
aiMatchRestClient.post() call on a bounded executor or use
CompletableFuture.orTimeout/completeOnTimeout with the read timeout value) so
the thread is released when the configured timeout elapses; reference
AiMatchClientConfig.buildClient, AiMatchApiProperties, aiMatchRestClient, and
callMatchReport when making changes.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 3f13f373-60f7-4a47-ac92-2b0c76675078
📒 Files selected for processing (9)
src/main/java/com/project/bangjjack/domain/user/application/loader/MatchReportDataLoader.javasrc/main/java/com/project/bangjjack/domain/user/application/usecase/MatchReportUseCase.javasrc/main/java/com/project/bangjjack/domain/user/domain/port/matchreport/MatchReportPort.javasrc/main/java/com/project/bangjjack/domain/user/external/aimatch/AiMatchReportClient.javasrc/main/java/com/project/bangjjack/domain/user/presentation/MatchReportController.javasrc/main/java/com/project/bangjjack/domain/user/presentation/response/UserResponseCode.javasrc/main/java/com/project/bangjjack/global/config/security/SecurityConfig.javasrc/test/java/com/project/bangjjack/domain/user/application/loader/MatchReportDataLoaderTest.javasrc/test/java/com/project/bangjjack/domain/user/application/usecase/MatchReportUseCaseTest.java
| private AiMatchResponse callMatchReport(AiMatchRequest request) { | ||
| try { | ||
| AiMatchResponse response = aiMatchRestClient.post() | ||
| .uri(MATCH_REPORT_PATH) | ||
| .contentType(MediaType.APPLICATION_JSON) | ||
| .body(request) | ||
| .retrieve() | ||
| .body(AiMatchResponse.class); | ||
|
|
||
| if (response == null) { | ||
| log.warn("AI match-report API returned null body"); | ||
| throw new AiServiceUnavailableException(); | ||
| } | ||
| return response; | ||
| } catch (HttpStatusCodeException e) { | ||
| log.error("AI match-report API failed: status={}", e.getStatusCode()); | ||
| throw new AiServiceUnavailableException(); | ||
| } catch (RestClientException e) { | ||
| log.error("AI match-report API call failed", e); | ||
| throw new AiServiceUnavailableException(); | ||
| } | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Locate the aiMatchRestClient bean definition and check for timeout configuration.
rg -nP -C5 'aiMatchRestClient' --type=java -g '!**/external/aimatch/AiMatchReportClient.java'
rg -nP -C3 '(setConnectTimeout|setReadTimeout|ClientHttpRequestFactory|requestFactory|ConnectTimeout|ReadTimeout)' --type=javaRepository: Bangjjack/Bangjjack-Backend
Length of output: 7698
🏁 Script executed:
#!/bin/bash
# Find where AiMatchReportClient is defined/injected and what RestClient bean it uses.
rg -n "class AiMatchReportClient|AiMatchReportClient\(" src/main/java -S
rg -n "aiMatchRestClient" src/main/java/com/project/bangjjack/domain/user/external/aimatch -S || true
rg -n "AiMatchClientConfig|buildClient\\(|connectTimeout\\(|readTimeout\\(" src/main/java/com/project/bangjjack/domain -SRepository: Bangjjack/Bangjjack-Backend
Length of output: 1698
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Show AiMatchReportClient constructor and injection annotations (if any)
sed -n '1,140p' src/main/java/com/project/bangjjack/domain/user/external/aimatch/AiMatchReportClient.java
# Show bean definitions and buildClient implementation in AiMatchClientConfig
sed -n '1,220p' src/main/java/com/project/bangjjack/domain/post/external/aimatch/AiMatchClientConfig.javaRepository: Bangjjack/Bangjjack-Backend
Length of output: 8500
🏁 Script executed:
#!/bin/bash
set -euo pipefail
rg -n "aiMatchTaskExecutor|taskExecutor|`@Async`\\b" src/main/java/com/project/bangjjack/domain/user/external/aimatch -S || true
rg -n "aiMatchTaskExecutor|taskExecutor|`@Async`\\b" src/main/java/com/project/bangjjack/domain/post/external/aimatch -S || trueRepository: Bangjjack/Bangjjack-Backend
Length of output: 369
AiMatchReportClient already uses a RestClient with connect/read timeouts configured.
AiMatchClientConfig.buildClient(...)setsSimpleClientHttpRequestFactory#setConnectTimeoutand#setReadTimeoutfromAiMatchApiProperties, and bothaiMatchRestClientandaiMatchBatchRestClientare built via this method.- The external call is still blocking on the request thread, so ensure the configured timeout values are appropriate to bound thread occupancy.
🧰 Tools
🪛 PMD (7.24.0)
[Low] 128-128: InvalidLogMessageFormat (Error Prone): Too many arguments, expected 0 argument but found 1
(InvalidLogMessageFormat (Error Prone))
🤖 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/main/java/com/project/bangjjack/domain/user/external/aimatch/AiMatchReportClient.java`
around lines 110 - 131, callMatchReport performs a blocking external call on
aiMatchRestClient so you must enforce the configured timeout bounds from
AiMatchApiProperties to avoid occupying request threads: ensure
AiMatchClientConfig.buildClient(...) actually applies AiMatchApiProperties
connect/read timeouts to the underlying client used by
aiMatchRestClient/aiMatchBatchRestClient, and wrap the blocking call in
callMatchReport with a timeout guard (e.g. execute the blocking
aiMatchRestClient.post() call on a bounded executor or use
CompletableFuture.orTimeout/completeOnTimeout with the read timeout value) so
the thread is released when the configured timeout elapses; reference
AiMatchClientConfig.buildClient, AiMatchApiProperties, aiMatchRestClient, and
callMatchReport when making changes.
🔗 관련 이슈
✅ PR 유형
어떤 변경 사항이 있었나요?
✏️ 작업 내용
AI 매칭 리포트 분석 기능을 구현합니다.
💡 추가 사항
Summary by CodeRabbit
Release Notes
New Features
Chores