Skip to content

Conversation

@move-hoon
Copy link
Member

Related issue 🛠

Work Description ✏️

  • 날짜 파싱 안정성 강화: Sentry 웹훅의 datetime 필드가 null이거나 비표준 형식이어서 파싱에 실패할 경우, 알림 전송이 중단되지 않고 원문(rawValue)이나 "Unknown Date"로 처리되도록 개선했습니다.
  • 리팩토링: formatDateTime 메서드 내 삼항 연산자를 제거하고, null 체크에 Early Return 패턴을 적용하여 코드 가독성을 높였습니다.

Trouble Shooting ⚽️

  • 잠재적 장애 요인 해결: 기존에는 날짜 파싱 중 DateTimeException이 발생하면 알림 전송 트랜잭션 전체가 롤백/실패 처리되어, 정작 중요한 에러 정보를 받아보지 못할 위험이 있었습니다. 이를 Fallback 로직으로 감싸 해결했습니다.

@move-hoon move-hoon self-assigned this Dec 31, 2025
@move-hoon move-hoon linked an issue Dec 31, 2025 that may be closed by this pull request
2 tasks
@coderabbitai
Copy link

coderabbitai bot commented Dec 31, 2025

Summary by CodeRabbit

릴리스 노트

  • 버그 수정
    • Discord 및 Slack 알림 서비스의 날짜 처리 안정성을 개선했습니다.
    • 날짜 정보가 누락되거나 형식이 올바르지 않은 경우 예외 상황을 더 안전하게 처리합니다.

✏️ Tip: You can customize this high-level summary in your review settings.

요약

Slack 및 Discord 알림 서비스에서 ISO 형식 날짜 파싱 로직에 Null 안전성과 예외 처리를 추가했습니다. 파싱 실패 시 경고를 기록하고 원본 값 또는 "Unknown Date"를 반환하여 알림 전송이 중단되지 않도록 개선했습니다.

변경사항

분류 / 파일(들) 변경 요약
날짜 파싱 안정성 개선
src/main/java/org/sopt/makers/service/SlackNotificationService.java, src/main/java/org/sopt/makers/service/DiscordNotificationService.java
Null 입력 처리 추가: null인 경우 "Unknown Date" 반환. DateTimeException 발생 시 try-catch로 캡처하여 경고 로그 기록 후 원본 isoDatetime 반환. 파싱 실패 시에도 알림 전송 프로세스 계속 진행 보장.

예상 코드 리뷰 소요 시간

🎯 2 (Simple) | ⏱️ ~10분

시 (시로부터)

🐰 날짜가 깨져도 괜찮아,

Null이라 해도 문제없지!

예외 처리로 튼튼하게,

알림은 언제나 도착해야지~ 🚀

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed 제목이 명확하게 Pull Request의 주요 변경사항인 날짜 파싱 로직 안정성 개선을 정확히 설명하고 있습니다.
Description check ✅ Passed PR 설명이 관련 이슈, 작업 내용, 트러블 슈팅 섹션을 모두 포함하여 템플릿 요구사항을 충족하고 있습니다.
Linked Issues check ✅ Passed Pull Request는 이슈 #25의 모든 목표를 충족합니다: SlackNotificationService와 DiscordNotificationService 모두에 예외 처리와 Fallback 로직이 추가되었으며, null 체크와 DateTimeException 처리로 안정성이 개선되었습니다.
Out of Scope Changes check ✅ Passed 모든 코드 변경사항이 이슈 #25의 범위 내에 있으며, 날짜 파싱 안정성 개선과 코드 가독성 개선에만 집중되어 있습니다.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings

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 and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
src/main/java/org/sopt/makers/service/SlackNotificationService.java (1)

54-58: 도달 불가능한 예외 처리 블록을 정리하는 것을 고려하세요.

formatDateTime 메서드가 이제 DateTimeException을 내부에서 처리하므로, 이 catch 블록은 날짜 파싱 오류로 인해 실행될 수 없습니다. buildSlackMessage 내에 다른 날짜/시간 연산이 없다면, 이 예외 처리는 도달 불가능한 코드입니다.

🔎 선택적 리팩토링 제안
-	private SlackMessage createSlackMessage(String team, String type, String stage,
-		SentryEventDetail sentryEventDetail) throws SentryCheckedException {
-		try {
-			return buildSlackMessage(team, type, stage, sentryEventDetail);
-		} catch (DateTimeException e) {
-			log.error("Slack 메시지 생성 실패: team={}, type={}, stage={}, id={}, error={}", team, type, stage,
-				sentryEventDetail.issueId(), e.getMessage(), e);
-			throw MessageBuildException.from(ErrorMessage.SLACK_MESSAGE_BUILD_FAILED);
-		}
-	}
+	private SlackMessage createSlackMessage(String team, String type, String stage,
+		SentryEventDetail sentryEventDetail) {
+		return buildSlackMessage(team, type, stage, sentryEventDetail);
+	}

또는 향후 다른 날짜 연산을 위한 방어적 코드로 유지하려는 의도라면, 주석으로 명시하는 것이 좋습니다.

src/main/java/org/sopt/makers/service/DiscordNotificationService.java (1)

51-55: 도달 불가능한 예외 처리 블록을 정리하는 것을 고려하세요.

formatDateTime 메서드가 이제 DateTimeException을 내부에서 처리하므로, 이 catch 블록은 날짜 파싱 오류로 인해 실행될 수 없습니다. buildDiscordMessage 내에 다른 날짜/시간 연산이 없다면, 이 예외 처리는 도달 불가능한 코드입니다.

🔎 선택적 리팩토링 제안
-	private DiscordMessage createDiscordMessage(String team, String type, String stage,
-		SentryEventDetail sentryEventDetail) throws SentryCheckedException {
-		try {
-			return buildDiscordMessage(team, type, stage, sentryEventDetail);
-		} catch (DateTimeException e) {
-			log.error("Discord 메시지 생성 실패: team={}, type={}, stage={}, id={}, error={}", team, type, stage,
-				sentryEventDetail.issueId(), e.getMessage(), e);
-			throw MessageBuildException.from(ErrorMessage.DISCORD_MESSAGE_BUILD_FAILED);
-		}
-	}
+	private DiscordMessage createDiscordMessage(String team, String type, String stage,
+		SentryEventDetail sentryEventDetail) {
+		return buildDiscordMessage(team, type, stage, sentryEventDetail);
+	}

또는 향후 다른 날짜 연산을 위한 방어적 코드로 유지하려는 의도라면, 주석으로 명시하는 것이 좋습니다.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e01be0b and 42343aa.

📒 Files selected for processing (2)
  • src/main/java/org/sopt/makers/service/DiscordNotificationService.java
  • src/main/java/org/sopt/makers/service/SlackNotificationService.java
🔇 Additional comments (2)
src/main/java/org/sopt/makers/service/SlackNotificationService.java (1)

158-171: 날짜 파싱 안정성 개선이 잘 구현되었습니다.

null 체크와 예외 처리 로직이 정확하게 구현되어 있으며, PR 목표를 완벽하게 충족합니다:

  • Early return 패턴으로 가독성 향상
  • DateTimeException 발생 시 원본 값을 반환하여 정보 손실 방지
  • 적절한 로그 레벨(warn)로 디버깅 가능성 확보
  • 알림 전송 트랜잭션 중단 방지
src/main/java/org/sopt/makers/service/DiscordNotificationService.java (1)

183-196: SlackNotificationService와 일관된 안정성 개선이 잘 구현되었습니다.

두 알림 서비스 간 동일한 오류 처리 패턴을 적용하여 유지보수성이 향상되었습니다. 구현이 정확하며 PR 목표를 충족합니다.

@move-hoon move-hoon merged commit d3d4918 into main Dec 31, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore: 날짜 파싱 로직 안정성 개선

2 participants