Skip to content

[Feat] 관리자 인덱싱 Job·Attempt·Event 조회 지원 추가 구현 - #121

Merged
Gimini-3 merged 7 commits into
developfrom
feature/119
Aug 8, 2026
Merged

[Feat] 관리자 인덱싱 Job·Attempt·Event 조회 지원 추가 구현#121
Gimini-3 merged 7 commits into
developfrom
feature/119

Conversation

@Gimini-3

@Gimini-3 Gimini-3 commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

작업 내용

  • 관리자 인덱싱 Job 목록·상세 조회 API를 추가했습니다.
  • 상태·문서·현재 소유 Worker 필터와 고정 Pagination 계약을 적용했습니다.
  • Job별 Attempt 이력과 Event 타임라인 조회를 추가했습니다.
  • Claim Token, 내부 오류 메시지, Event Metadata를 응답 계약에서 제외했습니다.
  • 기존 /admin/** ADMIN 권한 정책과 읽기 전용 Transaction을 유지했습니다.

API

  • GET /admin/indexing-jobs
  • GET /admin/indexing-jobs/{jobId}
  • GET /admin/indexing-jobs/{jobId}/attempts
  • GET /admin/indexing-jobs/{jobId}/events

검증

  • Query Service 6건
  • Converter 4건
  • Controller 17건
  • PostgreSQL 통합 5건
  • 전체 회귀 706건 통과, 실패·오류·Skip 0건

Closes #119

Summary by CodeRabbit

  • 새로운 기능

    • 관리자가 인덱싱 Job 목록과 상세 정보를 조회할 수 있습니다.
    • Job별 Attempt 실행 이력과 Event 타임라인을 확인할 수 있습니다.
    • 상태·문서·Worker 필터, 정렬 및 페이지네이션을 지원합니다.
    • 응답에 민감한 인증 토큰, 내부 오류 메시지 및 메타데이터가 노출되지 않습니다.
  • 문서

    • 관리자 인덱싱 조회 API 설계와 검증 결과 문서를 추가했습니다.

@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

관리자용 인덱싱 Job·Attempt·Event 조회 API를 추가했다. 필터, 고정 정렬, 페이지네이션, 권한 및 입력 검증을 적용했다. 응답 DTO에서 Claim Token, 내부 오류 메시지, Event Metadata를 제외했다. 단위, MVC, PostgreSQL 통합 테스트를 추가했다.

Changes

관리자 인덱싱 관측

Layer / File(s) Summary
조회 계약과 응답 모델
docs/design/..., src/main/java/.../dto/response/*, src/main/java/.../response/PageResponse.java
네 가지 조회 API와 페이지 응답 구조를 정의했다. Job, Attempt, Event 응답 DTO를 추가했다. 민감 필드를 응답에서 제외했다.
조회 서비스와 저장소
src/main/java/.../service/query/IndexingJobAdminQueryService.java, src/main/java/.../repository/*, src/main/java/.../worker/repository/*
필터와 고정 내림차순 정렬을 적용했다. Job, Attempt, Event를 페이지 단위로 조회한다. Job 상세와 이력 조회 전에 존재 여부를 확인한다.
DTO 변환과 관리자 엔드포인트
src/main/java/.../converter/IndexingJobAdminConverter.java, src/main/java/.../controller/IndexingJobAdminController.java
Entity를 공개 DTO로 변환한다. Job 목록·상세, Attempt, Event 조회 GET API를 추가했다. 관리자 권한과 입력값 검증을 적용했다.
조회 동작 검증
src/test/java/.../embedding/{controller,converter,integration,service/query}/*, docs/test-results/...
정상 응답, 권한, 오류, 정렬, 필터, 페이지 경계, 민감 정보 제외 및 PostgreSQL 통합 동작을 검증했다. 전체 706개 테스트와 통합 테스트 5개 결과를 기록했다.

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 응답
Loading

Possibly related PRs

  • DocGrid/backend#49: 동일한 관리자 컨트롤러와 Job·Event 저장소의 제어 및 조회 흐름과 직접 연결된다.
  • DocGrid/backend#64: 동일한 관리자 컨트롤러와 Attempt 저장소에서 생성·잠금 동작과 조회 페이지네이션을 다룬다.
  • DocGrid/backend#83: 동일한 관리자 인덱싱 Job·Attempt API를 기반으로 관측 엔드포인트를 확장한다.

Suggested labels: ✨ Feature

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.26% 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
Title check ✅ Passed 제목이 관리자 인덱싱 Job·Attempt·Event 조회 기능이라는 핵심 변경을 명확하고 간결하게 설명합니다.
Description check ✅ Passed 주요 변경, API, 검증 결과, 연결 이슈를 설명하며 템플릿의 핵심 요구사항을 대부분 충족합니다.
Linked Issues check ✅ Passed 네 개의 관리자 조회 API, 필터, 페이지네이션, 권한, 민감 정보 비노출, 읽기 전용 조회와 테스트 요구사항을 충족합니다 [#119].
Out of Scope Changes check ✅ Passed 설계 문서와 테스트 결과 문서를 포함한 모든 변경이 관리자 인덱싱 조회 기능과 검증 범위에 직접 관련됩니다.
✨ 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 feature/119

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.

@Gimini-3 Gimini-3 self-assigned this Aug 8, 2026
@Gimini-3
Gimini-3 merged commit 8143abb into develop Aug 8, 2026
1 check was pending

@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: 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줄입니다. 서비스 계층은 이미 commandquery로 분리되어 있습니다. 컨트롤러도 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 win

Attempt와 Event 조회의 404 케이스도 MVC 레벨에서 검증해 주세요.

현재 404 테스트는 상세 조회만 다룹니다. GET /{jobId}/attemptsGET /{jobId}/events도 Swagger에 404를 문서화하고 IndexingJobAdminQueryServiceEMBEDDING_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

📥 Commits

Reviewing files that changed from the base of the PR and between 558d983 and 829aefc.

📒 Files selected for processing (17)
  • docs/design/gimin-#119-admin-indexing-observability.md
  • docs/test-results/gimin-#119-admin-indexing-observability.md
  • src/main/java/com/opensource/docgrid/domain/embedding/controller/IndexingJobAdminController.java
  • src/main/java/com/opensource/docgrid/domain/embedding/converter/IndexingJobAdminConverter.java
  • src/main/java/com/opensource/docgrid/domain/embedding/dto/response/AdminIndexingEventResponse.java
  • src/main/java/com/opensource/docgrid/domain/embedding/dto/response/AdminIndexingJobAttemptResponse.java
  • src/main/java/com/opensource/docgrid/domain/embedding/dto/response/AdminIndexingJobResponse.java
  • src/main/java/com/opensource/docgrid/domain/embedding/repository/EmbeddingJobRepository.java
  • src/main/java/com/opensource/docgrid/domain/embedding/service/query/IndexingJobAdminQueryService.java
  • src/main/java/com/opensource/docgrid/domain/worker/repository/EmbeddingJobAttemptRepository.java
  • src/main/java/com/opensource/docgrid/domain/worker/repository/IndexingEventRepository.java
  • src/main/java/com/opensource/docgrid/global/common/response/PageResponse.java
  • src/test/java/com/opensource/docgrid/domain/embedding/controller/IndexingJobAdminControllerTest.java
  • src/test/java/com/opensource/docgrid/domain/embedding/controller/IndexingJobAdminQueryControllerTest.java
  • src/test/java/com/opensource/docgrid/domain/embedding/converter/IndexingJobAdminConverterTest.java
  • src/test/java/com/opensource/docgrid/domain/embedding/integration/IndexingJobAdminQueryIntegrationTest.java
  • src/test/java/com/opensource/docgrid/domain/embedding/service/query/IndexingJobAdminQueryServiceTest.java

Comment on lines +39 to +69
## 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로 안전하게 반환 | 통과 |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feat] 관리자 인덱싱 Job·Attempt·Event 조회 지원 추가 구현

1 participant