Skip to content

[Feat] 비동기 분석 Worker에 Curated Corpus Context 전달 - #235

Merged
whc9999 merged 2 commits into
devfrom
feat/async-analysis-curated-corpus-rag
Jul 30, 2026
Merged

[Feat] 비동기 분석 Worker에 Curated Corpus Context 전달#235
whc9999 merged 2 commits into
devfrom
feat/async-analysis-curated-corpus-rag

Conversation

@whc9999

@whc9999 whc9999 commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

✨ 어떤 이유로 PR를 하셨나요?

  • feature 병합
  • 버그 수정(아래에 issue #를 남겨주세요)
  • 코드 개선
  • 코드 수정
  • 배포
  • 기타(아래에 자세한 내용 기입해주세요)

📋 세부 내용 - 왜 해당 PR이 필요한지 작업 내용을 자세하게 설명해주세요

📸 작업 화면 스크린샷

⚠️ PR하기 전에 확인해주세요

  • 로컬테스트를 진행하셨나요?
  • 머지할 브랜치를 확인하셨나요?
  • 관련 label을 선택하셨나요?

🚨 관련 이슈 번호 [ ]

Summary by CodeRabbit

  • 새로운 기능

    • 분석 결과에 참고된 채용 공고와 질문의 출처 정보가 함께 제공됩니다.
    • 각 참고 자료의 식별자, 분류, 제목, 내용 및 순위가 표시됩니다.
    • 참고 자료가 없을 때도 빈 목록으로 안정적으로 응답합니다.
  • 개선 사항

    • 참고 자료의 내용이 변경되면 분석 결과 식별 정보도 갱신됩니다.
    • 참고 자료 검색에 실패해도 분석 요청이 중단되지 않고 계속 처리됩니다.
    • 분석 입력 검증과 처리 흐름이 개선되었습니다.

@whc9999 whc9999 self-assigned this Jul 30, 2026
@whc9999 whc9999 added the ✨ feat New feature or request label Jul 30, 2026
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

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

Next review available in: 45 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

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

Plan: Pro Plus

Run ID: a3643256-edf2-4139-a311-28276eab5efb

📥 Commits

Reviewing files that changed from the base of the PR and between fb19627 and 0477976.

📒 Files selected for processing (6)
  • src/main/java/com/jobdri/jobdri_api/domain/analysis/service/core/AnalysisService.java
  • src/main/java/com/jobdri/jobdri_api/domain/corpus/service/CorpusRetrievalService.java
  • src/test/java/com/jobdri/jobdri_api/domain/analysis/dto/worker/AnalysisWorkerContextResponseTest.java
  • src/test/java/com/jobdri/jobdri_api/domain/analysis/dto/worker/CorpusReferenceContextTest.java
  • src/test/java/com/jobdri/jobdri_api/domain/analysis/service/async/AnalysisWorkerBridgeServiceTest.java
  • src/test/java/com/jobdri/jobdri_api/domain/analysis/service/core/AnalysisInputFingerprintProviderTest.java
📝 Walkthrough

Walkthrough

분석 retrieval 결과를 CorpusReferenceContext 목록으로 변환해 워커 응답에 포함하고, 동일한 구조를 입력 fingerprint에 반영한다. 분석 준비 흐름은 retrieval 실패 시 빈 context로 폴백하며, 관련 직렬화·변환·fingerprint 테스트가 추가됐다.

Changes

Curated corpus analysis flow

Layer / File(s) Summary
Corpus reference 계약과 변환
src/main/java/com/jobdri/jobdri_api/domain/analysis/dto/worker/..., src/test/java/com/jobdri/jobdri_api/domain/analysis/dto/worker/*
CorpusReferenceContext가 잡포스팅·질문 참조를 corpusId, category, 제목, 본문, rank로 변환하며, 워커 응답은 목록을 불변 형태로 정규화한다.
분석 retrieval 준비 흐름
src/main/java/com/jobdri/jobdri_api/domain/analysis/service/core/AnalysisService.java, src/test/java/com/jobdri/jobdri_api/domain/analysis/service/core/AnalysisServiceTest.java
분석 실행 준비에서 답변 검증과 retrieval context 구성을 분리하고, curated corpus retrieval 실패 시 빈 RetrievalContext로 폴백한다.
입력 fingerprint 갱신
src/main/java/com/jobdri/jobdri_api/domain/analysis/service/core/AnalysisInputFingerprintProvider.java, src/test/java/com/jobdri/jobdri_api/domain/analysis/service/core/AnalysisInputFingerprintProviderTest.java
fingerprint 입력을 corpusReferences 배열 기반으로 변경하고 버전 상수를 v3으로 갱신했으며, corpus 내용과 distance 변화에 대한 검증을 추가한다.
워커 컨텍스트 연결
src/main/java/com/jobdri/jobdri_api/domain/analysis/service/async/AnalysisWorkerBridgeService.java, src/test/java/com/jobdri/jobdri_api/domain/analysis/service/async/AnalysisWorkerBridgeServiceTest.java
payload의 retrieval context를 CorpusReferenceContext로 변환해 워커 응답에 전달하고, corpus ID와 직렬화 결과를 검증한다.

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

Sequence Diagram(s)

sequenceDiagram
  participant AnalysisService
  participant CorpusRetrievalService
  participant AnalysisWorkerBridgeService
  participant CorpusReferenceContext
  participant AnalysisWorker
  AnalysisService->>CorpusRetrievalService: retrieveForAnalysis(...)
  CorpusRetrievalService-->>AnalysisService: RetrievalContext
  AnalysisService->>AnalysisWorkerBridgeService: AnalysisExecutionPayload 전달
  AnalysisWorkerBridgeService->>CorpusReferenceContext: from(retrievalContext)
  CorpusReferenceContext-->>AnalysisWorkerBridgeService: corpusReferences
  AnalysisWorkerBridgeService->>AnalysisWorker: AnalysisWorkerContextResponse 전달
Loading

Possibly related PRs

  • JobDri-Developer/BackEnd#215: inputFingerprint 저장 및 재사용 흐름이 이번 fingerprint 생성 구조와 직접 연결된다.
  • JobDri-Developer/BackEnd#230: 워커 컨텍스트와 fingerprint 연결부를 수정하며, 이번 변경은 여기에 curated corpus 참조를 확장한다.

Suggested labels: ♻️ refactor

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning 템플릿의 주요 섹션은 있으나 세부 내용, 작업 화면 스크린샷, 관련 이슈 번호가 비어 있어 설명이 부족합니다. 세부 변경 이유와 작업 내용을 채우고, 필요하면 스크린샷과 관련 이슈 번호를 추가해 주세요.
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 (3 passed)
Check name Status Explanation
Title check ✅ Passed 제목이 비동기 분석 Worker에 Curated Corpus Context를 전달하는 핵심 변경을 정확히 요약합니다.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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 feat/async-analysis-curated-corpus-rag

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
src/test/java/com/jobdri/jobdri_api/domain/analysis/dto/worker/AnalysisWorkerContextResponseTest.java (1)

65-87: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

기존 worker snapshot의 역직렬화 호환성을 추가로 검증하세요.

현재 테스트는 새 Java 생성자와 직렬화만 확인하며, corpusReferences가 없는 기존 snapshot JSON을 새 코드가 읽는지는 검증하지 않습니다. rolling deploy나 retry 중 기존 snapshot을 읽을 수 있으므로, 누락된 필드가 빈 목록으로 정규화되고 similarJobPostings가 유지되는 테스트를 추가하세요.

As per path instructions, src/test/**/*.java에서는 비동기 재시도·실패 복구 경로의 회귀 위험을 확인해야 합니다.

🤖 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/jobdri/jobdri_api/domain/analysis/dto/worker/AnalysisWorkerContextResponseTest.java`
around lines 65 - 87, 기존 생성자 테스트에 추가하여, corpusReferences 필드가 없는 기존 worker
snapshot JSON을 objectMapper로 AnalysisWorkerContextResponse에 역직렬화하는 검증을 작성하세요.
역직렬화 후 corpusReferences가 빈 목록으로 정규화되고 기존 similarJobPostings 값이 그대로 유지되는지 확인하며,
oldConstructorDefaultsSimilarJobPostingsToEmptyList와
AnalysisWorkerContextResponse를 기준으로 관련 테스트를 확장하세요.

Source: Path instructions

src/test/java/com/jobdri/jobdri_api/domain/analysis/service/async/AnalysisWorkerBridgeServiceTest.java (1)

169-192: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

curated corpus context의 snapshot 재사용 경로를 테스트하세요.

현재 변경된 테스트는 최초 getContext의 성공 응답만 확인합니다. 이후 재호출에서 snapshot의 동일한 corpusReferences를 반환하는지, 완료 시에도 동일 입력으로 finalize하는지 검증하지 않아 context 재조회·retry 회귀를 놓칠 수 있습니다.

As per path instructions, src/test/**/*.java에서는 비동기 재시도와 멱등성 같은 경로를 충분히 검증해야 합니다.

🤖 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/jobdri/jobdri_api/domain/analysis/service/async/AnalysisWorkerBridgeServiceTest.java`
around lines 169 - 192, Extend the getContext test to invoke the context
retrieval again and verify the snapshot’s identical corpusReferences are reused
on the retry. Also exercise completion/finalization and verify it receives the
same original context input, covering the curated corpus snapshot’s idempotent
reuse path and avoiding assertions limited to the initial successful response.

Source: Path instructions

src/main/java/com/jobdri/jobdri_api/domain/analysis/service/core/AnalysisService.java (1)

180-217: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

답변 존재 여부 검증 로직이 두 곳에서 다른 방식으로 중복됩니다.

새로 추가된 validateAnsweredQuestions(209-216, isEmpty() 체크)와 기존 validateAnalysisRequest(116-129, anyMatch 체크)가 동일한 "답변 1개 이상 필요" 규칙을 서로 다른 구현으로 검증하고 있습니다. 한쪽만 수정되면 두 경로의 검증 기준이 어긋날 위험이 있습니다.

♻️ 공통 헬퍼로 통합 제안
     public void validateAnalysisRequest(User user, Long mockApplyId) {
         MockApply mockApply = getOwnedMockApply(user, mockApplyId);
         List<Question> questions = questionRepository.findAllByMockApplyIdOrderByIdAsc(mockApply.getId());
-        boolean hasAnsweredQuestion = questions.stream()
-                .anyMatch(question -> StringUtils.hasText(question.getAnswer()));
-
-        if (!hasAnsweredQuestion) {
-            throw new GeneralException(
-                    GeneralErrorCode.INVALID_PARAMETER,
-                    "분석할 자소서 답변이 1개 이상 필요합니다."
-            );
-        }
+        List<Question> answeredQuestions = questions.stream()
+                .filter(question -> StringUtils.hasText(question.getAnswer()))
+                .toList();
+        validateAnsweredQuestions(answeredQuestions);
     }
🤖 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/jobdri/jobdri_api/domain/analysis/service/core/AnalysisService.java`
around lines 180 - 217, 통합 분석 요청 흐름의 validateAnalysisRequest와
prepareAnalysisExecution에서 중복된 답변 존재 검증을 하나의 공통 헬퍼로 통합하세요. 기존의 “답변이 1개 이상 필요” 예외
메시지와 오류 코드를 유지하고, 두 경로가 동일한 검증 기준을 사용하도록 validateAnsweredQuestions 또는 적절한 공통
메서드를 재사용하세요.
🤖 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/jobdri/jobdri_api/domain/analysis/service/core/AnalysisService.java`:
- Around line 141-157: 분석 준비 흐름에서 retrieveAnalysisReferences 호출을 read-only 트랜잭션
내부에서 실행하지 않도록 분리하세요. prepareAnalysisExecution과
CorpusRetrievalService.retrieveForAnalysis를 조정해 코퍼스 검색이
Propagation.NOT_SUPPORTED로 트랜잭션 없이 수행되게 하고, 질문 검증과 나머지 분석 실행 데이터 흐름은 기존 동작을
유지하세요.

In
`@src/test/java/com/jobdri/jobdri_api/domain/analysis/dto/worker/AnalysisWorkerContextResponseTest.java`:
- Around line 59-62: Update AnalysisWorkerContextResponseTest’s corpusReferences
assertions to validate the complete worker JSON contract: assert the expected
category, title, content, and rank values for the first reference, while
retaining the corpusId assertion and checks that distance and embedding are
absent. Cover the new array’s serialized values precisely so missing or
incorrectly serialized fields fail the test.

In
`@src/test/java/com/jobdri/jobdri_api/domain/analysis/dto/worker/CorpusReferenceContextTest.java`:
- Around line 15-40: 보강된 CorpusReferenceContext 변환 테스트에서 핵심 필드와 경계 조건을 정확히
검증하세요. convertsExistingRetrievalContext는 title, category, rank, 그리고 라벨·줄바꿈을 포함한
전체 content를 contains가 아닌 정확한 문자열 비교로 확인하도록 수정하세요. CorpusReferenceContext.from 및
관련 변환 경로에 대해 blank 입력, charLimit == null, null 리스트가 각각 기대된 계약대로 처리되는 회귀 테스트를
추가하세요.

In
`@src/test/java/com/jobdri/jobdri_api/domain/analysis/service/core/AnalysisInputFingerprintProviderTest.java`:
- Around line 55-76: Add tests alongside
fingerprintChangesWhenCorpusContentChanges and fingerprintIgnoresCorpusDistance
that construct RetrievalContext with non-empty questionReferences, verifying
changed question-reference content changes the fingerprint while changed
question-reference distance does not. Update or add a helper near
corpusReference to create payloads containing question references, keeping the
existing job-posting assertions unchanged.

---

Outside diff comments:
In
`@src/main/java/com/jobdri/jobdri_api/domain/analysis/service/core/AnalysisService.java`:
- Around line 180-217: 통합 분석 요청 흐름의 validateAnalysisRequest와
prepareAnalysisExecution에서 중복된 답변 존재 검증을 하나의 공통 헬퍼로 통합하세요. 기존의 “답변이 1개 이상 필요” 예외
메시지와 오류 코드를 유지하고, 두 경로가 동일한 검증 기준을 사용하도록 validateAnsweredQuestions 또는 적절한 공통
메서드를 재사용하세요.

In
`@src/test/java/com/jobdri/jobdri_api/domain/analysis/dto/worker/AnalysisWorkerContextResponseTest.java`:
- Around line 65-87: 기존 생성자 테스트에 추가하여, corpusReferences 필드가 없는 기존 worker
snapshot JSON을 objectMapper로 AnalysisWorkerContextResponse에 역직렬화하는 검증을 작성하세요.
역직렬화 후 corpusReferences가 빈 목록으로 정규화되고 기존 similarJobPostings 값이 그대로 유지되는지 확인하며,
oldConstructorDefaultsSimilarJobPostingsToEmptyList와
AnalysisWorkerContextResponse를 기준으로 관련 테스트를 확장하세요.

In
`@src/test/java/com/jobdri/jobdri_api/domain/analysis/service/async/AnalysisWorkerBridgeServiceTest.java`:
- Around line 169-192: Extend the getContext test to invoke the context
retrieval again and verify the snapshot’s identical corpusReferences are reused
on the retry. Also exercise completion/finalization and verify it receives the
same original context input, covering the curated corpus snapshot’s idempotent
reuse path and avoiding assertions limited to the initial successful response.
🪄 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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 60938d6b-3bb0-476b-8d90-fb70b24c9b81

📥 Commits

Reviewing files that changed from the base of the PR and between 56aa660 and fb19627.

📒 Files selected for processing (10)
  • src/main/java/com/jobdri/jobdri_api/domain/analysis/dto/worker/AnalysisWorkerContextResponse.java
  • src/main/java/com/jobdri/jobdri_api/domain/analysis/dto/worker/CorpusReferenceContext.java
  • src/main/java/com/jobdri/jobdri_api/domain/analysis/service/async/AnalysisWorkerBridgeService.java
  • src/main/java/com/jobdri/jobdri_api/domain/analysis/service/core/AnalysisInputFingerprintProvider.java
  • src/main/java/com/jobdri/jobdri_api/domain/analysis/service/core/AnalysisService.java
  • src/test/java/com/jobdri/jobdri_api/domain/analysis/dto/worker/AnalysisWorkerContextResponseTest.java
  • src/test/java/com/jobdri/jobdri_api/domain/analysis/dto/worker/CorpusReferenceContextTest.java
  • src/test/java/com/jobdri/jobdri_api/domain/analysis/service/async/AnalysisWorkerBridgeServiceTest.java
  • src/test/java/com/jobdri/jobdri_api/domain/analysis/service/core/AnalysisInputFingerprintProviderTest.java
  • src/test/java/com/jobdri/jobdri_api/domain/analysis/service/core/AnalysisServiceTest.java

@whc9999
whc9999 merged commit 7fc57b0 into dev Jul 30, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ feat New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant