[Feat] 관리자 인덱싱 Job·Attempt·Event 조회 지원 추가 구현 - #121
Conversation
📝 WalkthroughWalkthrough관리자용 인덱싱 Job·Attempt·Event 조회 API를 추가했다. 필터, 고정 정렬, 페이지네이션, 권한 및 입력 검증을 적용했다. 응답 DTO에서 Claim Token, 내부 오류 메시지, Event Metadata를 제외했다. 단위, MVC, PostgreSQL 통합 테스트를 추가했다. Changes관리자 인덱싱 관측
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Admin
participant IndexingJobAdminController
participant IndexingJobAdminQueryService
participant Repository
Admin->>IndexingJobAdminController: 조회 요청
IndexingJobAdminController->>IndexingJobAdminQueryService: 필터와 페이지 정보 전달
IndexingJobAdminQueryService->>Repository: Job, Attempt 또는 Event 조회
Repository-->>IndexingJobAdminQueryService: 페이지 데이터 반환
IndexingJobAdminQueryService-->>IndexingJobAdminController: 공개 DTO PageResponse 반환
IndexingJobAdminController-->>Admin: JSON 응답
Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 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
🧹 Nitpick comments (2)
src/main/java/com/opensource/docgrid/domain/embedding/controller/IndexingJobAdminController.java (1)
86-225: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoff조회 엔드포인트를 별도 컨트롤러로 분리하는 방안을 고려해 주세요.
이 클래스는 이제 조회 4개와 명령 8개를 함께 담습니다. 파일 길이는 669줄입니다. 서비스 계층은 이미
command와query로 분리되어 있습니다. 컨트롤러도IndexingJobAdminQueryController로 분리하면 계층 간 경계가 일치합니다. 테스트도 이미 조회용으로 분리되어 있습니다. 지금 당장 동작 문제는 없으므로 후속 작업으로 진행해도 됩니다.🤖 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/embedding/controller/IndexingJobAdminController.java` around lines 86 - 225, Extract the four read-only endpoints getJobs, getJob, getAttempts, and getEvents from IndexingJobAdminController into a separate IndexingJobAdminQueryController, wiring them to indexingJobAdminQueryService and preserving their mappings, response types, validation, and OpenAPI annotations; leave the command endpoints in the original controller.src/test/java/com/opensource/docgrid/domain/embedding/controller/IndexingJobAdminQueryControllerTest.java (1)
163-172: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAttempt와 Event 조회의 404 케이스도 MVC 레벨에서 검증해 주세요.
현재 404 테스트는 상세 조회만 다룹니다.
GET /{jobId}/attempts와GET /{jobId}/events도 Swagger에 404를 문서화하고IndexingJobAdminQueryService가EMBEDDING_JOB_NOT_FOUND를 던집니다. 세 엔드포인트를 파라미터화 테스트로 묶으면 문서와 동작의 일치를 함께 고정할 수 있습니다.🤖 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/opensource/docgrid/domain/embedding/controller/IndexingJobAdminQueryControllerTest.java` around lines 163 - 172, Extend getJob_returnsNotFound_whenJobDoesNotExist in IndexingJobAdminQueryControllerTest into a parameterized MVC test covering the detail, attempts, and events endpoints. Configure IndexingJobAdminQueryService to throw EMBEDDING_JOB_NOT_FOUND for each request, then assert HTTP 404 and the EMBEDDING-JOB-001 response code so all Swagger-documented 404 cases are verified consistently.
🤖 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/test-results/gimin-`#119-admin-indexing-observability.md:
- Around line 39-69: Update the test-results document to add a Swagger manual
verification section covering all four administrator GET APIs. Record each
request, expected status code, pagination response, and confirmation that
sensitive fields are absent, alongside the existing automated and PostgreSQL
validation results.
---
Nitpick comments:
In
`@src/main/java/com/opensource/docgrid/domain/embedding/controller/IndexingJobAdminController.java`:
- Around line 86-225: Extract the four read-only endpoints getJobs, getJob,
getAttempts, and getEvents from IndexingJobAdminController into a separate
IndexingJobAdminQueryController, wiring them to indexingJobAdminQueryService and
preserving their mappings, response types, validation, and OpenAPI annotations;
leave the command endpoints in the original controller.
In
`@src/test/java/com/opensource/docgrid/domain/embedding/controller/IndexingJobAdminQueryControllerTest.java`:
- Around line 163-172: Extend getJob_returnsNotFound_whenJobDoesNotExist in
IndexingJobAdminQueryControllerTest into a parameterized MVC test covering the
detail, attempts, and events endpoints. Configure IndexingJobAdminQueryService
to throw EMBEDDING_JOB_NOT_FOUND for each request, then assert HTTP 404 and the
EMBEDDING-JOB-001 response code so all Swagger-documented 404 cases are verified
consistently.
🪄 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: 40163c10-d36a-412e-8e8f-7c41b6f41ddf
📒 Files selected for processing (17)
docs/design/gimin-#119-admin-indexing-observability.mddocs/test-results/gimin-#119-admin-indexing-observability.mdsrc/main/java/com/opensource/docgrid/domain/embedding/controller/IndexingJobAdminController.javasrc/main/java/com/opensource/docgrid/domain/embedding/converter/IndexingJobAdminConverter.javasrc/main/java/com/opensource/docgrid/domain/embedding/dto/response/AdminIndexingEventResponse.javasrc/main/java/com/opensource/docgrid/domain/embedding/dto/response/AdminIndexingJobAttemptResponse.javasrc/main/java/com/opensource/docgrid/domain/embedding/dto/response/AdminIndexingJobResponse.javasrc/main/java/com/opensource/docgrid/domain/embedding/repository/EmbeddingJobRepository.javasrc/main/java/com/opensource/docgrid/domain/embedding/service/query/IndexingJobAdminQueryService.javasrc/main/java/com/opensource/docgrid/domain/worker/repository/EmbeddingJobAttemptRepository.javasrc/main/java/com/opensource/docgrid/domain/worker/repository/IndexingEventRepository.javasrc/main/java/com/opensource/docgrid/global/common/response/PageResponse.javasrc/test/java/com/opensource/docgrid/domain/embedding/controller/IndexingJobAdminControllerTest.javasrc/test/java/com/opensource/docgrid/domain/embedding/controller/IndexingJobAdminQueryControllerTest.javasrc/test/java/com/opensource/docgrid/domain/embedding/converter/IndexingJobAdminConverterTest.javasrc/test/java/com/opensource/docgrid/domain/embedding/integration/IndexingJobAdminQueryIntegrationTest.javasrc/test/java/com/opensource/docgrid/domain/embedding/service/query/IndexingJobAdminQueryServiceTest.java
| ## 3. 단위 검증 | ||
|
|
||
| | Test Class | Test 수 | 검증 범위 | 결과 | | ||
| |---|---:|---|---| | ||
| | `IndexingJobAdminQueryServiceTest` | 6 | 필터·Pagination 전달, 상세 Not Found, Attempt·Event 조회 | 통과 | | ||
| | `IndexingJobAdminConverterTest` | 4 | Job·Attempt·Event 공개 DTO 변환, 민감 필드 계약 제외 | 통과 | | ||
| | `IndexingJobAdminQueryControllerTest` | 17 | 네 API, Validation, ADMIN 권한, 오류·JSON 응답 | 통과 | | ||
|
|
||
| ## 4. PostgreSQL 통합 검증 | ||
|
|
||
| 실행: | ||
|
|
||
| ```bash | ||
| DB_SSLMODE=disable \ | ||
| ./gradlew test \ | ||
| --tests 'com.opensource.docgrid.domain.embedding.integration.IndexingJobAdminQueryIntegrationTest' | ||
| ``` | ||
|
|
||
| 결과: | ||
|
|
||
| ```text | ||
| tests=5 failures=0 errors=0 skipped=0 | ||
| ``` | ||
|
|
||
| | 시나리오 | 확인 항목 | 결과 | | ||
| |---|---|---| | ||
| | Job 복합 필터 | 상태·문서·현재 소유 Worker 조건이 같은 한 건으로 수렴 | 통과 | | ||
| | Job 목록 정렬·Page | `created_at DESC, id DESC`, Page 경계와 전체 건수 보존 | 통과 | | ||
| | Attempt 이력 | `attempt_no DESC, id DESC`, 내부 Claim Token·오류 메시지 미노출 | 통과 | | ||
| | Event 타임라인 | `occurred_at DESC, id DESC`, Metadata JSON 미노출 | 통과 | | ||
| | 종료 Job 상세 | Worker와 Lease가 없는 종료 상태를 Null로 안전하게 반환 | 통과 | |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Swagger 수동 검증 결과를 추가하세요.
현재 문서는 자동 테스트 결과만 기록합니다. 네 개의 관리자 GET API에 대한 Swagger 요청, 상태 코드, Pagination 응답, 민감 필드 미노출 결과를 함께 기록하세요.
As per coding guidelines, docs/test-results/*.md must “combine Swagger manual-test results with automated-test results.”
🤖 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/test-results/gimin-`#119-admin-indexing-observability.md around lines 39
- 69, Update the test-results document to add a Swagger manual verification
section covering all four administrator GET APIs. Record each request, expected
status code, pagination response, and confirmation that sensitive fields are
absent, alongside the existing automated and PostgreSQL validation results.
Source: Coding guidelines
작업 내용
API
검증
Closes #119
Summary by CodeRabbit
새로운 기능
문서