Skip to content

[FIX] 분석 결과별 summary와 리포트 총평 생성 개선 - #198

Merged
rkdehdrbs7885-oss merged 6 commits into
developfrom
fix/#197-analysis-summary
Aug 11, 2026
Merged

[FIX] 분석 결과별 summary와 리포트 총평 생성 개선#198
rkdehdrbs7885-oss merged 6 commits into
developfrom
fix/#197-analysis-summary

Conversation

@ownue

@ownue ownue commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

📍 개요

분석별 특성이 summary와 리포트 총평에 반영되도록 생성 방식을 개선

⛓️‍💥 관련 이슈


🛠️ 작업 내용

  • Gemini 구조화 응답으로 summary와 report 동시 생성
  • 응답 검증 실패 시 규칙 기반 결과로 fallback
  • 분석 세부 데이터를 활용하도록 리포트 프롬프트 개선
  • AI 설정 바인딩 테스트의 환경 변수 의존성 제거

🔥 리뷰 요청 사항

리뷰어가 중점적으로 확인해주었으면 하는 내용을 작성해주세요.

  • 구조화 응답 검증 및 fallback 처리 방식이 적절한지

✅ 체크리스트

  • 코드 컨벤션을 준수했습니다.
  • 불필요한 코드 및 import를 제거했습니다.
  • 예외 처리를 적용했습니다.
  • 테스트를 완료했습니다.
  • 관련 Issue를 연결했습니다.

📎 참고 사항

  • 전체 테스트 통과를 확인했습니다.

Summary by CodeRabbit

  • 새 기능

    • 분석 결과에 핵심 요약이 함께 제공됩니다.
    • 요약에 점수 균형과 격차, 박자 이탈·음계·화성 관련 정보가 반영됩니다.
    • 분석 보고서가 요약과 Markdown 본문을 포함하는 구조화된 형식으로 제공됩니다.
  • 개선 사항

    • AI 응답 실패나 형식 오류 발생 시 규칙 기반 요약과 보고서가 제공됩니다.
    • 요약은 단일 문장과 지정된 길이를 따르며, 보고서 형식 및 분량 검증이 강화되었습니다.
    • 분석 결과를 바탕으로 요약을 새로 생성하거나 교체할 수 있습니다.

@ownue ownue self-assigned this Aug 11, 2026
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@ownue, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 45 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a97dffc5-9fc9-4f2b-8796-e477d6ffcd8b

📥 Commits

Reviewing files that changed from the base of the PR and between 5184e89 and 8d018d7.

📒 Files selected for processing (1)
  • src/test/java/com/mr/domain/analysis/service/ReportGenerationServiceTest.java
📝 Walkthrough

Walkthrough

분석 결과 요약이 점수와 세부 분석 데이터를 반영하도록 변경되었습니다. Gemini는 summaryreport를 JSON으로 반환합니다. 응답 검증에 실패하면 규칙 기반 요약과 리포트를 생성합니다. 생성된 summary는 분석 리포트 모델에 저장됩니다.

Changes

분석 리포트 생성 흐름

Layer / File(s) Summary
규칙 기반 요약 생성
src/main/java/com/mr/domain/analysis/generator/AnalysisResultEnricher.java, src/test/java/com/mr/domain/analysis/generator/AnalysisResultEnricherTest.java
도메인 점수 차이와 박자 이탈, 스케일 외 음, 화성 규칙을 사용해 요약을 생성합니다. regenerateSummarywithSummary는 원본을 변경하지 않고 복사본을 반환합니다.
구조화된 Gemini 리포트 생성
src/main/java/com/mr/domain/analysis/service/ReportGenerationService.java, src/main/java/com/mr/global/client/gemini/GeminiClient.java, src/test/java/com/mr/domain/analysis/service/ReportGenerationServiceTest.java, src/test/java/com/mr/global/client/gemini/GeminiClientTest.java, src/test/java/com/mr/global/config/AiServerPropertiesBindingTest.java
Gemini 응답을 summaryreport JSON 필드로 처리합니다. 필수 텍스트, summary 형식, Markdown 구조와 리포트 길이를 검증합니다. 검증 또는 호출에 실패하면 규칙 기반 결과로 fallback합니다.
요약 저장 및 처리 순서
src/main/java/com/mr/domain/analysis/model/GeneratedAnalysisReport.java, src/main/java/com/mr/domain/analysis/service/AnalysisProcessingService.java, src/test/java/com/mr/domain/analysis/service/AnalysisProcessingServiceTest.java, src/test/java/com/mr/domain/analysis/service/AnalysisStateServiceTest.java
GeneratedAnalysisReportsummary를 추가합니다. AI 원본 결과로 리포트를 생성한 뒤 summary를 분석 결과에 반영합니다.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant AnalysisProcessingService
  participant ReportGenerationService
  participant GeminiClient
  participant AnalysisResultEnricher
  participant GeneratedAnalysisReport

  AnalysisProcessingService->>ReportGenerationService: 원본 분석 결과 전달
  ReportGenerationService->>GeminiClient: summary와 report JSON 요청
  GeminiClient-->>ReportGenerationService: 구조화된 Gemini 응답 반환
  ReportGenerationService->>AnalysisResultEnricher: 실패 시 원본 결과 보강
  AnalysisResultEnricher-->>ReportGenerationService: 규칙 기반 summary와 report 데이터 반환
  ReportGenerationService-->>AnalysisProcessingService: GeneratedAnalysisReport 반환
  AnalysisProcessingService->>GeneratedAnalysisReport: summary를 분석 결과에 반영
Loading

Possibly related PRs

  • Musereview/BE#84: AnalysisResultEnricher, ReportGenerationService, GeminiClient의 요약 및 리포트 생성 흐름을 함께 변경합니다.
  • Musereview/BE#44: GeneratedAnalysisReport와 분석 결과 summary 전파 흐름을 다룹니다.
  • Musereview/BE#36: ai.internal 기반 AI 서버 연동 및 응답 처리 구조와 연결됩니다.

Poem

점수의 결을 따라 summary가 피고
Gemini는 JSON 두 칸을 건네네
틀린 응답은 fallback 길을 걷고
report와 요약은 함께 저장되네
분석의 한 줄이 또렷해졌네 ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목이 분석별 summary와 리포트 총평 생성 개선이라는 주요 변경 사항을 정확하고 간결하게 설명합니다.
Linked Issues check ✅ Passed 구조화된 summary·report 생성, 상세 분석 데이터 활용, 검증, fallback 및 관련 테스트가 이슈 #197의 요구 사항을 충족합니다.
Out of Scope Changes check ✅ Passed 변경 사항은 이슈 #197의 생성 로직, fallback, 데이터 바인딩 테스트 및 관련 테스트 범위에 포함됩니다.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/#197-analysis-summary

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 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/mr/domain/analysis/generator/AnalysisResultEnricher.java`:
- Around line 49-60: 한 문장 요약 계약을 생성과 검증에 일관되게 적용하세요. AnalysisResultEnricher.java
49-60의 fallback 요약은 강점·보완점·근거 절을 연결하되 문장 종결을 하나만 포함하도록 수정하세요.
ReportGenerationService.java 147-152에서는 여러 문장 종결을 포함한 LLM summary를 거부하고 규칙 기반
fallback으로 전환하세요. AnalysisResultEnricherTest.java 21-26에는 fallback이 한 문장인지 검증하고,
ReportGenerationServiceTest.java 64-80에는 다문장 LLM summary가 fallback으로 전환되는 테스트를
추가하세요.

In `@src/main/java/com/mr/domain/analysis/service/ReportGenerationService.java`:
- Line 32: Update the MIN_REPORT_LENGTH constant in ReportGenerationService to
700 so validation matches the SYSTEM_PROMPT contract. Add a fallback test
covering the boundary values, including reports below 700 characters and exactly
700 characters.
- Around line 114-118: Update AnalysisResultEnricher with an explicit
forced-regeneration API, then change the fallback path in
ReportGenerationService so it generates the report summary from the original
analysisResult rather than reusing an existing summary returned by enrich. Add a
fallback test covering input analysis data that already contains a non-empty
summary and verify a newly generated rule-based summary is stored.
🪄 Autofix

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: CHILL

Plan: Pro Plus

Run ID: c8723433-519d-46c5-a8ee-cde9ea53f1ac

📥 Commits

Reviewing files that changed from the base of the PR and between 970d538 and dd66035.

📒 Files selected for processing (11)
  • src/main/java/com/mr/domain/analysis/generator/AnalysisResultEnricher.java
  • src/main/java/com/mr/domain/analysis/model/GeneratedAnalysisReport.java
  • src/main/java/com/mr/domain/analysis/service/AnalysisProcessingService.java
  • src/main/java/com/mr/domain/analysis/service/ReportGenerationService.java
  • src/main/java/com/mr/global/client/gemini/GeminiClient.java
  • src/test/java/com/mr/domain/analysis/generator/AnalysisResultEnricherTest.java
  • src/test/java/com/mr/domain/analysis/service/AnalysisProcessingServiceTest.java
  • src/test/java/com/mr/domain/analysis/service/AnalysisStateServiceTest.java
  • src/test/java/com/mr/domain/analysis/service/ReportGenerationServiceTest.java
  • src/test/java/com/mr/global/client/gemini/GeminiClientTest.java
  • src/test/java/com/mr/global/config/AiServerPropertiesBindingTest.java

Comment thread src/main/java/com/mr/domain/analysis/generator/AnalysisResultEnricher.java Outdated
Comment thread src/main/java/com/mr/domain/analysis/service/ReportGenerationService.java Outdated
Comment thread src/main/java/com/mr/domain/analysis/service/ReportGenerationService.java Outdated
ownue added 4 commits August 11, 2026 11:23
- Gemini 구조화 응답으로 summary와 report 동시 생성
- 분석 점수 및 세부 근거를 summary와 총평에 반영
- 응답 검증 실패 시 규칙 기반 생성으로 fallback
- LLM summary를 분석 결과와 함께 저장
- AI 설정 바인딩 테스트의 환경 변수 의존성 제거

@on1yoneprivate on1yoneprivate left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다~!

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/test/java/com/mr/domain/analysis/service/ReportGenerationServiceTest.java (1)

195-223: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

유효한 양 끝값도 테스트하세요.

현재 테스트는 699자와 1,501자만 거부하는지 검증합니다. 구현이 700자 또는 1,500자를 잘못 거부해도 이 테스트들은 통과합니다. 700자와 1,500자 보고서가 ReportGenerationType.LLM으로 생성되는 테스트를 추가하세요.

🤖 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/com/mr/domain/analysis/service/ReportGenerationServiceTest.java`
around lines 195 - 223, 현재 경계값만 거부되는지 검증하도록
`generate_fallsBackWhenGeminiReportIs699Characters` 및 인접 테스트에 700자와 1,500자 보고서
사례를 추가하세요. 각 사례에서 `service.generate(result)`의 결과가 `ReportGenerationType.LLM`인지
확인하고, 기존 699자·1,501자 폴백 검증은 유지하세요.
🤖 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/com/mr/domain/analysis/service/ReportGenerationServiceTest.java`:
- Around line 195-223: 현재 경계값만 거부되는지 검증하도록
`generate_fallsBackWhenGeminiReportIs699Characters` 및 인접 테스트에 700자와 1,500자 보고서
사례를 추가하세요. 각 사례에서 `service.generate(result)`의 결과가 `ReportGenerationType.LLM`인지
확인하고, 기존 699자·1,501자 폴백 검증은 유지하세요.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: abcbbe05-c728-454e-a5a3-9d57f9250f9b

📥 Commits

Reviewing files that changed from the base of the PR and between dd66035 and 5184e89.

📒 Files selected for processing (4)
  • src/main/java/com/mr/domain/analysis/generator/AnalysisResultEnricher.java
  • src/main/java/com/mr/domain/analysis/service/ReportGenerationService.java
  • src/test/java/com/mr/domain/analysis/generator/AnalysisResultEnricherTest.java
  • src/test/java/com/mr/domain/analysis/service/ReportGenerationServiceTest.java
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/test/java/com/mr/domain/analysis/generator/AnalysisResultEnricherTest.java
  • src/main/java/com/mr/domain/analysis/service/ReportGenerationService.java
  • src/main/java/com/mr/domain/analysis/generator/AnalysisResultEnricher.java

@rkdehdrbs7885-oss rkdehdrbs7885-oss left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다!

@rkdehdrbs7885-oss
rkdehdrbs7885-oss merged commit 8336a2b into develop Aug 11, 2026
2 checks passed
@on1yoneprivate
on1yoneprivate deleted the fix/#197-analysis-summary branch August 12, 2026 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 BugFix - 분석 결과별 summary 및 리포트 총평 생성 개선

3 participants