[Feat] get_document_detail + get_indexing_status 도구 구현 - #114
Conversation
get_document_detail은 PermissionQueryService로 권한 확인 후 DocumentRepository.findById()로 title/status/currentVersionNo/updatedAt을 직접 조회한다. 딱 맞는 기존 DTO가 없어 DocumentDetailResponse를 새로 추가했다. get_indexing_status는 DocumentQueryService.getDocumentStatus()를 수정 없이 그대로 재사용한다 (내부에서 권한체크까지 포함). 두 도구 모두 documentId를 필수로 두고 version_id 단독 조회는 지원하지 않는다. 새 서비스 클래스 없이 search_documents와 동일하게 DocGridMcpTools에 직접 구현했다.
정상 케이스 2개, documentId 누락, 권한없음, 문서없음, 미인증 케이스를 검증한다. 테스트용 ObjectMapper에 JavaTimeModule을 등록해 LocalDateTime 직렬화 실패를 해결한다.
새 서비스 미도입/A담당자 파일 미수정/version_id 범위 제외 결정 근거, DTO 위치 판단 근거(SearchResultItem·McpAccessTokenResponse 선례), 실제 curl 검증 결과, 테스트 중 발견한 두 가지(커넥션 풀 고갈, ObjectMapper 모듈 누락)를 기록한다.
|
Warning Review limit reached
Next review available in: 52 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 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough
Changes문서 조회 도구
Estimated code review effort: 2 (Simple) | ~15 minutes Sequence Diagram(s)sequenceDiagram
participant MCPClient
participant DocGridMcpTools
participant PermissionQueryService
participant DocumentRepository
participant DocumentQueryService
MCPClient->>DocGridMcpTools: getDocumentDetail(documentId)
DocGridMcpTools->>PermissionQueryService: canReadDocument(userId, documentId)
DocGridMcpTools->>DocumentRepository: findById(documentId)
DocumentRepository-->>DocGridMcpTools: Document
DocGridMcpTools-->>MCPClient: DocumentDetailResponse JSON
MCPClient->>DocGridMcpTools: getIndexingStatus(documentId)
DocGridMcpTools->>DocumentQueryService: getDocumentStatus(userId, documentId)
DocumentQueryService-->>DocGridMcpTools: DocumentStatusResponse
DocGridMcpTools-->>MCPClient: DocumentStatusResponse JSON
Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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: 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 `@docs/design/kangcheolung-`#113-document-detail-indexing-status-tools.md:
- Line 1: Replace every private sequence label in
docs/design/kangcheolung-#113-document-detail-indexing-status-tools.md with the
specified issue number or descriptive name: line 1 F-MCP-03/04 with `#113` or the
tool names; line 9 Issue 1 with `#93`; line 24 Issue 3 with search_documents or an
actual issue number; lines 32-34 F-MCP-04 with versionId 단독 조회; line 151 Issue 6
with Claude Desktop 연동 검증; lines 169-170 F-MCP-08/09 with Rate Limiting 및 출력 정제;
and line 174 replace both Issue 6 and F-MCP-08/09 with actual issue numbers or
descriptive names.
In
`@src/main/java/com/opensource/docgrid/domain/mcp/dto/response/DocumentDetailResponse.java`:
- Around line 9-16: DocumentDetailResponse 레코드에 레코드 수준 주석을 추가하여 MCP 응답 계약을 정의하고
Document 엔티티를 직접 노출하지 않는 경계임을 설명하십시오. 주석에는 레코드의 역할, 책임, 그리고 노출 범위를 명확히 포함하고 기존
필드와 어노테이션은 변경하지 마십시오.
In
`@src/test/java/com/opensource/docgrid/domain/mcp/tool/DocGridMcpToolsTest.java`:
- Around line 156-160: 성공 응답을 검증하는 DocGridMcpToolsTest의 해당 assertion에 필수 필드인
documentId와 updatedAt 검증을 추가하십시오. 기존 title, currentVersionNo, status 검증은 유지하고,
실제 테스트 픽스처의 기대값과 응답 JSON 필드명을 사용해 매핑 또는 이름 변경이 감지되도록 하십시오.
🪄 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: a7a279c9-1481-4038-954c-e54c953459e3
📒 Files selected for processing (4)
docs/design/kangcheolung-#113-document-detail-indexing-status-tools.mdsrc/main/java/com/opensource/docgrid/domain/mcp/dto/response/DocumentDetailResponse.javasrc/main/java/com/opensource/docgrid/domain/mcp/tool/DocGridMcpTools.javasrc/test/java/com/opensource/docgrid/domain/mcp/tool/DocGridMcpToolsTest.java
| @@ -0,0 +1,174 @@ | |||
| # #113 get_document_detail + get_indexing_status 도구 구현 (F-MCP-03/04) | |||
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
비공개 순번 레이블을 실제 이슈 번호 또는 설명적 이름으로 바꾸십시오.
문서가 Issue 1, Issue 3, Issue 6, F-MCP-03/04 같은 내부 순번을 노출합니다.
docs/design/kangcheolung-#113-document-detail-indexing-status-tools.md#L1-L1:F-MCP-03/04를#113또는 도구 이름으로 교체하십시오.docs/design/kangcheolung-#113-document-detail-indexing-status-tools.md#L9-L9:Issue 1을 실제 이슈 번호#93으로 교체하십시오.docs/design/kangcheolung-#113-document-detail-indexing-status-tools.md#L24-L24:Issue 3을search_documents또는 실제 이슈 번호로 교체하십시오.docs/design/kangcheolung-#113-document-detail-indexing-status-tools.md#L32-L34:F-MCP-04를versionId 단독 조회같은 설명적 이름으로 교체하십시오.docs/design/kangcheolung-#113-document-detail-indexing-status-tools.md#L151-L151:Issue 6을Claude Desktop 연동 검증같은 설명적 이름으로 교체하십시오.docs/design/kangcheolung-#113-document-detail-indexing-status-tools.md#L169-L170:F-MCP-08/09를Rate Limiting 및 출력 정제로 교체하십시오.docs/design/kangcheolung-#113-document-detail-indexing-status-tools.md#L174-L174:Issue 6과F-MCP-08/09를 실제 이슈 번호 또는 설명적 이름으로 교체하십시오.
As per coding guidelines, "Never expose private numbered PR sequence labels in GitHub issues, pull request titles or bodies, committed documents, code, or comments; use the actual issue number or a descriptive feature or test name instead."
📍 Affects 1 file
docs/design/kangcheolung-#113-document-detail-indexing-status-tools.md#L1-L1(this comment)docs/design/kangcheolung-#113-document-detail-indexing-status-tools.md#L9-L9docs/design/kangcheolung-#113-document-detail-indexing-status-tools.md#L24-L24docs/design/kangcheolung-#113-document-detail-indexing-status-tools.md#L32-L34docs/design/kangcheolung-#113-document-detail-indexing-status-tools.md#L151-L151docs/design/kangcheolung-#113-document-detail-indexing-status-tools.md#L169-L170docs/design/kangcheolung-#113-document-detail-indexing-status-tools.md#L174-L174
🤖 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 `@docs/design/kangcheolung-`#113-document-detail-indexing-status-tools.md at
line 1, Replace every private sequence label in
docs/design/kangcheolung-#113-document-detail-indexing-status-tools.md with the
specified issue number or descriptive name: line 1 F-MCP-03/04 with `#113` or the
tool names; line 9 Issue 1 with `#93`; line 24 Issue 3 with search_documents or an
actual issue number; lines 32-34 F-MCP-04 with versionId 단독 조회; line 151 Issue 6
with Claude Desktop 연동 검증; lines 169-170 F-MCP-08/09 with Rate Limiting 및 출력 정제;
and line 174 replace both Issue 6 and F-MCP-08/09 with actual issue numbers or
descriptive names.
Source: Coding guidelines
| public record DocumentDetailResponse( | ||
| @Schema(description = "문서 ID") Long documentId, | ||
| @Schema(description = "문서 제목") String title, | ||
| @Schema(description = "현재 버전 번호 - 아직 확정된 버전이 없으면 null", nullable = true) Integer currentVersionNo, | ||
| @Schema(description = "문서 상태") DocumentStatus status, | ||
| @Schema(description = "마지막 수정 시각") LocalDateTime updatedAt | ||
| ) { | ||
| } |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
레코드 수준 주석을 추가하십시오.
이 레코드는 MCP 응답 계약을 정의하고 Document 엔티티의 직접 노출을 막는 경계입니다. 역할과 책임을 설명하는 클래스 수준 주석을 추가하십시오.
수정 예시
+/**
+ * MCP 도구가 문서 상세 조회 결과를 반환할 때 사용하는 응답 DTO다.
+ * Document 엔티티를 MCP 응답 계약으로 직접 노출하지 않는다.
+ */
public record DocumentDetailResponse(As per coding guidelines, "Every newly created class, interface, or record must have a class-level comment explaining its role, responsibility, and boundary."
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| public record DocumentDetailResponse( | |
| @Schema(description = "문서 ID") Long documentId, | |
| @Schema(description = "문서 제목") String title, | |
| @Schema(description = "현재 버전 번호 - 아직 확정된 버전이 없으면 null", nullable = true) Integer currentVersionNo, | |
| @Schema(description = "문서 상태") DocumentStatus status, | |
| @Schema(description = "마지막 수정 시각") LocalDateTime updatedAt | |
| ) { | |
| } | |
| /** | |
| * MCP 도구가 문서 상세 조회 결과를 반환할 때 사용하는 응답 DTO다. | |
| * Document 엔티티를 MCP 응답 계약으로 직접 노출하지 않는다. | |
| */ | |
| public record DocumentDetailResponse( | |
| `@Schema`(description = "문서 ID") Long documentId, | |
| `@Schema`(description = "문서 제목") String title, | |
| `@Schema`(description = "현재 버전 번호 - 아직 확정된 버전이 없으면 null", nullable = true) Integer currentVersionNo, | |
| `@Schema`(description = "문서 상태") DocumentStatus status, | |
| `@Schema`(description = "마지막 수정 시각") LocalDateTime updatedAt | |
| ) { | |
| } |
🤖 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/opensource/docgrid/domain/mcp/dto/response/DocumentDetailResponse.java`
around lines 9 - 16, DocumentDetailResponse 레코드에 레코드 수준 주석을 추가하여 MCP 응답 계약을 정의하고
Document 엔티티를 직접 노출하지 않는 경계임을 설명하십시오. 주석에는 레코드의 역할, 책임, 그리고 노출 범위를 명확히 포함하고 기존
필드와 어노테이션은 변경하지 마십시오.
Source: Coding guidelines
getDocumentDetail_returnsJson_whenValid에 documentId/updatedAt 검증을 추가했다. 이 과정에서 테스트용 ObjectMapper가 LocalDateTime을 ISO 문자열이 아닌 숫자 배열로 직렬화하고 있던 것을 발견 - JavaTimeModule의 WRITE_DATES_AS_TIMESTAMPS 기본값이 실제 앱의 Spring Boot Jackson 자동 설정과 달랐다. disable(WRITE_DATES_AS_TIMESTAMPS)로 실제 앱과 동일하게 맞췄다. 설계 문서에서 번호 없이 쓰인 "Issue 3", "Issue 6" 참조를 실제 이슈 번호 또는 "아직 미생성" 명시로 정정한다.
배경
Issue 1(#93)에서 등록만 해둔 빈 핸들러 3개 중 나머지 2개(
get_document_detail,get_indexing_status)를 실제 로직으로 채운다.get_document_detail은 문서 메타데이터(제목/현재버전/상태/수정시각),get_indexing_status는 인덱싱 파이프라인 진행 상황(PENDING/PROCESSING/INDEXED/FAILED)을 조회한다.착수 전 확정한 설계 결정
search_documents)에서 세운 "완성된 서비스는 위임, MCP 어댑터 전용 글루 코드는DocGridMcpTools에 직접"이라는 패턴을 일관되게 유지했다.DocumentQueryService,Document엔티티 등)은 수정하지 않는다.get_indexing_status는DocumentQueryService.getDocumentStatus()를 그대로 재사용하고,get_document_detail에 필요한 title/updatedAt은Document엔티티 필드를DocumentRepository로 직접 읽어 해결했다.version_id단독 조회는 범위에서 제외한다. 명세서 원안(F-MCP-04)에 있었으나, 지원하려면 A담당자 쪽 신규 로직이 필요한데 실사용 가치가 낮다고 판단해documentId를 필수 파라미터로 뒀다.변경 사항
DocGridMcpTools.getDocumentDetail(): 권한체크 →DocumentRepository.findById()→ title/status/currentVersionNo/updatedAt을 JSON으로 반환DocGridMcpTools.getIndexingStatus():documentId필수 검증 →DocumentQueryService.getDocumentStatus()그대로 호출DocumentDetailResponse추가 — 기존document도메인 DTO 중 정확히 맞는 게 없어 신설. 위치는domain/mcp/dto/response(엔티티 소속이 아니라 사용 도메인 기준 —SearchResultItem,McpAccessTokenResponse선례와 일관)검증 중 발견한 것 (둘 다 앱 버그 아님)
ObjectMapper에JavaTimeModule이 없어LocalDateTime직렬화가 실패 — 실제 앱의 Spring 관리ObjectMapper는 문제없었음(curl로 확인), 테스트 코드만 수정검증
tools/call전체 플로우를 curl로 검증./gradlew test: 661개 테스트 전체 통과 (develop 최신화로 반영된 팀원 작업 [Feat] 최종 실패 인덱싱 Job 수동 재처리 지원 추가 구현 #108 포함), 실패 0개문서
docs/design/kangcheolung-#113-document-detail-indexing-status-tools.mdCloses #113
Summary by CodeRabbit
새 기능
문서화
테스트