Skip to content

[Feat/#216] 엑셀 분석 실패 시 ErrorNotifier로 에러 알림 전파 - #217

Merged
tnals0924 merged 1 commit into
mainfrom
feat/#216-import-job-error-notify
Jul 16, 2026
Merged

[Feat/#216] 엑셀 분석 실패 시 ErrorNotifier로 에러 알림 전파#217
tnals0924 merged 1 commit into
mainfrom
feat/#216-import-job-error-notify

Conversation

@tnals0924

Copy link
Copy Markdown
Contributor

#️⃣연관된 이슈

📝작업 내용

  • ErrorNotificationDispatcherapi:core-apicore/monitoring으로 이동
    • HTTP 의존이 없는 순수 발송 로직(코루틴 fire-and-forget)이라 ErrorNotifier/ErrorContext가 있는 core/monitoring이 자연스러운 위치
    • 워커(ImportJobProcessor)는 core에 있어 기존 위치(api:core-api)로는 접근 불가했음
  • 잡 실패용 편의 메서드 dispatchJob(throwable, jobId) 추가 — HTTP 전용 필드는 null, jobId는 requestBodyjobId=... 형태로 담아 전달
  • ImportJobProcessor 엑셀 분석 실패 catch 블록에서 dispatchJob 호출 → Discord/Sentry로 알림 전파

스크린샷 (선택)

💬리뷰 요구사항(선택)

  • 알림은 importJobFinisher.fail() 성공 여부와 무관하게 무조건 발송됩니다 (예외가 실제 발생했으므로). 실패 확정 시에만 알림이 필요하다면 의견 주세요.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

엑셀 상품 분석 작업 실패 시 Discord/Sentry 알림이 전파되도록 모니터링 및 import job 워커 로직을 변경했습니다.

  • ErrorNotificationDispatcherapi:core-api에서 core/monitoring으로 이동하고, jobId를 포함해 알림을 발송하는 dispatchJob 메서드를 추가했습니다.
  • ImportJobProcessor의 엑셀 분석 실패 처리에 알림 발송을 연계했습니다.
  • GlobalExceptionHandler의 디스패처 참조 경로를 갱신했습니다.

Walkthrough

Changes

오류 알림 전파

Layer / File(s) Summary
오류 알림 디스패처 API 변경
core/src/main/kotlin/kr/dongchimi/core/monitoring/ErrorNotificationDispatcher.kt, api/core-api/src/main/kotlin/kr/dongchimi/api/core/common/exception/GlobalExceptionHandler.kt
ErrorNotificationDispatcher의 패키지를 이동하고, jobIdrequestBody에 담아 기존 디스패치 경로로 위임하는 dispatchJob을 추가했다.
Import job 실패 처리 연동
core/src/main/kotlin/kr/dongchimi/core/product/importjob/worker/ImportJobProcessor.kt
ImportJobProcessor가 디스패처를 주입받으며, 분석 실패 시 예외와 jobId로 알림을 발송한다.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: imddoy

Sequence Diagram(s)

sequenceDiagram
  participant ImportJobProcessor
  participant ErrorNotificationDispatcher
  participant Discord
  participant Sentry
  ImportJobProcessor->>ErrorNotificationDispatcher: dispatchJob(exception, jobId)
  ErrorNotificationDispatcher->>ErrorNotificationDispatcher: ErrorContext 생성 후 dispatch 위임
  ErrorNotificationDispatcher->>Discord: 오류 알림 발송
  ErrorNotificationDispatcher->>Sentry: 오류 알림 발송
Loading
🚥 Pre-merge checks | ✅ 7
✅ Passed checks (7 passed)
Check name Status Explanation
Title check ✅ Passed 제목이 이슈 형식([Feat/#216])을 따르고 엑셀 분석 실패 시 에러 알림 전파라는 변경 사항과도 잘 맞습니다.
Description check ✅ Passed 연관된 이슈, 작업 내용, 리뷰 요구사항이 템플릿에 맞게 포함되어 있어 설명이 대부분 완성되었습니다.
Linked Issues check ✅ Passed #216의 핵심 요구사항인 디스패처 이동, dispatchJob 추가, ImportJobProcessor에서의 알림 발송이 모두 반영되었습니다.
Out of Scope Changes check ✅ Passed 제공된 요약 기준으로는 이슈 범위를 벗어난 별도 변경이 보이지 않습니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
마이그레이션-엔티티 쌍 확인 ✅ Passed 변경된 파일은 예외 처리/알림 디스패처/워커뿐이며 JPA Entity 추가·필드 변경이 없어 Flyway 마이그레이션 변경 대상이 아닙니다.
레이어 의존성 방향 확인 ✅ Passed 변경된 클래스는 @Component/@RestControllerAdvice이며 서비스 클래스의 Repository 직접 주입 추가는 없습니다. ImportJobProcessor의 Repository 주입은 Processor 계층입니다.

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.

Caution

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

⚠️ Outside diff range comments (1)
core/src/main/kotlin/kr/dongchimi/core/product/importjob/worker/ImportJobProcessor.kt (1)

80-92: 🩺 Stability & Availability | 🔴 Critical | ⚡ Quick win

코루틴 취소 시 발생하는 CancellationException 예외 처리 추가

현재 코루틴 환경에서 Exception을 포괄적으로 잡고 있어 CancellationException도 함께 잡히게 됩니다. 이 경우 코루틴의 정상적인 취소 흐름(예: 애플리케이션 종료, 부모 코루틴 취소)이 깨지게 되며, 특히 이번 PR에서 추가된 dispatchJob 호출로 인해 정상적인 코루틴 취소가 엑셀 분석 실패 에러 알람으로 오발송되는 치명적인 부작용이 발생합니다.

As per coding guidelines, 인접 코드 개선이나 리팩토링을 임의로 하지 않아야 하지만, 새로 추가된 알림 로직의 오작동(False Alarm) 및 불필요한 스팸 발송을 막기 위해 CancellationException은 무시하고 다시 던지도록 예외 처리를 추가하는 것이 필수적입니다.

🐛 제안하는 예외 처리 수정안
-        } catch (e: Exception) {
+        } catch (e: Exception) {
+            if (e is CancellationException) throw e
             logger.error(e) { "엑셀 분석 실패: jobId=${job.jobId}" }
             if (importJobFinisher.fail(job.jobId, ImportJobErrorCode.ANALYSIS_FAILED.name)) {
                 importJobEventChannel.publish(
🤖 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
`@core/src/main/kotlin/kr/dongchimi/core/product/importjob/worker/ImportJobProcessor.kt`
around lines 80 - 92, Update the exception handling around the Excel analysis in
ImportJobProcessor so CancellationException is caught separately, rethrown
immediately, and does not invoke fail, publish, or dispatchJob. Keep the
existing Exception handling for actual analysis failures unchanged.

Source: Coding guidelines

🤖 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.

Outside diff comments:
In
`@core/src/main/kotlin/kr/dongchimi/core/product/importjob/worker/ImportJobProcessor.kt`:
- Around line 80-92: Update the exception handling around the Excel analysis in
ImportJobProcessor so CancellationException is caught separately, rethrown
immediately, and does not invoke fail, publish, or dispatchJob. Keep the
existing Exception handling for actual analysis failures unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7608a5a1-bc3e-4995-8028-73ec48221b43

📥 Commits

Reviewing files that changed from the base of the PR and between dc85c5c and 1698594.

📒 Files selected for processing (3)
  • api/core-api/src/main/kotlin/kr/dongchimi/api/core/common/exception/GlobalExceptionHandler.kt
  • core/src/main/kotlin/kr/dongchimi/core/monitoring/ErrorNotificationDispatcher.kt
  • core/src/main/kotlin/kr/dongchimi/core/product/importjob/worker/ImportJobProcessor.kt

@tnals0924
tnals0924 merged commit 1f6d4ca into main Jul 16, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

엑셀 분석 실패 시 ErrorNotifier로 에러 알림 전파

1 participant