[BE-07] alerting application UseCase (Raise/Receive/Process/SelfCheck)

작업 내용 (설계 의도)

변경 사항

alerting 도메인 오케스트레이션 UseCase와 Command를 작성한다. 근거 TDD: ../TDD.md §DTO 흐름·§시스템 역할 경계. UseCase는 AlertDomainService만 호출(Repository/Gateway 직접 주입 금지), execute() 10줄 이내, @Transactional UseCase에.

  • application/alerting/usecase/ReceiveGrafanaAlertUseCase.kt — Grafana webhook Command → AlertSignal 매핑 → AlertDomainService.raise.
  • application/alerting/usecase/RaiseAlertUseCase.kt — 내부 raise(③⑧) Command → AlertDomainService.raise.
  • application/alerting/usecase/ProcessAlertUseCase.ktexecute(alertId)AlertDomainService.process.
  • application/alerting/usecase/SendSelfCheckUseCase.ktAlertDomainService.selfCheck.
  • application/alerting/dto/*RaiseAlertCommand(endpoint/source/severity/env/contextHint), GrafanaWebhookCommand, 결과 DTO.
  • source/severity/env 문자열은 경계에서 enum으로 파싱(String 비교 금지).

의존

  • BE-01 (AlertDomainService, VO/enum)

다이어그램

클래스 의존

flowchart LR
    RU["ReceiveGrafanaAlertUseCase"] --> DS["AlertDomainService"]
    RA["RaiseAlertUseCase"] --> DS
    PU["ProcessAlertUseCase"] --> DS
    SC["SendSelfCheckUseCase"] --> DS

테스트 케이스

  • ReceiveGrafanaAlertUseCase가 webhook Command를 AlertSignal로 변환해 raise를 호출한다(DomainService 모킹).
  • RaiseAlertUseCase가 source=oversell Command를 정확히 전달한다.
  • ProcessAlertUseCase가 alertId로 process를 위임한다.
  • 알 수 없는 source/severity 문자열은 파싱 단계에서 거부된다(예외).
  • SendSelfCheckUseCase가 selfCheck를 호출한다.