Skip to content

fix: Slack 상세 보기 링크 렌더링 방식 개선 완료#28

Merged
move-hoon merged 1 commit into
mainfrom
bug/#27
May 13, 2026
Merged

fix: Slack 상세 보기 링크 렌더링 방식 개선 완료#28
move-hoon merged 1 commit into
mainfrom
bug/#27

Conversation

@move-hoon

@move-hoon move-hoon commented May 13, 2026

Copy link
Copy Markdown
Member

Related issue 🛠

Work Description ✏️

  • Slack 상세 보기 링크 렌더링 방식 개선: Slack 알림에서 Sentry 상세 보기 링크를 button/actions 블록 대신 mrkdwn 링크 텍스트로 전송하도록 수정했습니다.
  • 테스트 더미 데이터 정리: 실제 Sentry 이벤트 URL처럼 보이는 값을 사용하지 않고, sentry.example.com 기반 더미 URL과 더미 issue/event id를 사용하도록 테스트 데이터를 정리했습니다.
  • 테스트 보강: WireMock으로 Slack Webhook 요청 payload를 검증하여 actions/button 블록이 포함되지 않고, section 블록의 mrkdwn 링크로 상세 보기가 전송되는지 확인했습니다.

Trouble Shooting ⚽️

  • Slack 버튼 렌더링 호환성 문제 해결: 기존에는 상세 보기 링크가 Slack 버튼 요소로 전송되어 일부 수신 환경에서 기대한 링크 형태로 보이지 않을 수 있었습니다. 이를 알림 본문 내 mrkdwn 링크로 전환하여 상세 보기 링크가 더 안정적으로 노출되도록 개선했습니다.
  • 테스트 데이터 신뢰성 개선: 테스트 코드에 실제 Sentry 이벤트 URL처럼 보이는 값이 포함되어 있어 더미 데이터인지 명확하지 않았습니다. 테스트 목적이 드러나도록 example 도메인과 더미 식별자를 사용해 실제 운영 이벤트와 혼동되지 않도록 정리했습니다.

@move-hoon move-hoon self-assigned this May 13, 2026
@coderabbitai

coderabbitai Bot commented May 13, 2026

Copy link
Copy Markdown

Review Change Stack

개요

Slack 알림 메시지의 상세 보기 링크를 버튼 블록 형식에서 마크다운 하이퍼링크 형식으로 변경하여 모든 환경에서 일관되게 렌더링되도록 개선했습니다.

변경 사항

Slack 링크 렌더링 개선

레이어 / 파일 요약
Issue link block 구현 및 테스트
src/main/java/org/sopt/makers/service/SlackNotificationService.java, src/test/java/org/sopt/makers/service/SlackNotificationServiceTest.java
SlackNotificationService의 블록 타입 임포트를 정리하고 buildActionsBlock 호출을 새로운 buildIssueLinkBlock 메서드로 대체합니다. 이 메서드는 Sentry URL이 있으면 <webUrl|상세 보기> 마크다운 형식으로, 없으면 기본 텍스트로 SectionBlock을 생성합니다. WireMock을 사용한 JUnit 5 테스트 클래스에서 Slack 웹훅 엔드포인트를 모의하여 최종 페이로드에서 actions/button 블록이 제거되었으며 마크다운 링크 형식이 올바르게 렌더링되는지 검증합니다.

예상 코드 리뷰 노력

🎯 2 (Simple) | ⏱️ ~12분

제안 레이블

fix, 3️⃣ patch, size/M

시인의 한 마디

🐰 버튼에서 링크로 변신하니,
마크다운 형식 반짝반짝,
모든 환경을 정복했네!
테스트는 든든하고
마침내 완성이라네! 🎯

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.27% 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 제목이 PR의 주요 변경사항을 명확하게 설명하고 있습니다. Slack 알림의 링크 렌더링 방식 개선이라는 핵심 변경을 잘 요약하고 있습니다.
Linked Issues check ✅ Passed 모든 목표가 충족되었습니다. 버튼 블록을 제거하고 mrkdwn 링크 형식으로 변경했으며, 더미 URL 기반 테스트를 추가하고 단위 테스트가 통과했습니다 [#27].
Out of Scope Changes check ✅ Passed 모든 변경사항이 이슈 #27의 목표와 관련되어 있습니다. 추가적인 범위 외 변경사항은 없습니다.
Description check ✅ Passed PR 설명이 제공된 템플릿 구조를 따르며 필수 섹션(관련 이슈, 작업 내용, 트러블슈팅)을 모두 포함하고 있습니다.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bug/#27

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

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

🧹 Nitpick comments (1)
src/test/java/org/sopt/makers/service/SlackNotificationServiceTest.java (1)

52-73: ⚡ Quick win

webUrl 누락 분기(null/blank)도 테스트로 고정해 주세요.

현재는 URL 존재 케이스만 검증하고 있어, Line 150-152 fallback 경로 회귀를 잡기 어렵습니다. null/blank 입력 시 마지막 블록 텍스트가 상세 보기(링크 아님)로 내려가는지 테스트를 1개 추가하는 것을 권장합니다.

예시 테스트 추가
+	`@Test`
+	`@DisplayName`("Sentry URL이 없으면 상세 보기 텍스트만 전송한다")
+	void sendNotification_shouldRenderIssueLinkFallbackTextWhenWebUrlMissing() throws Exception {
+		SentryEventDetail eventDetail = new SentryEventDetail(
+			"0000000000",
+			"   ",
+			"Unexpected server error: ",
+			"2026-05-13T17:58:41.158000Z",
+			"error",
+			"Exception: Sentry test exception"
+		);
+
+		slackNotificationService.sendNotification("beat", "be", "dev", eventDetail, slackWebhookUrl());
+
+		JsonNode blocks = extractBlocksFromSlackRequest();
+		JsonNode issueLinkBlock = blocks.get(blocks.size() - 1);
+		assertThat(issueLinkBlock.path("text").path("text").asText()).isEqualTo("상세 보기");
+	}
🤖 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/org/sopt/makers/service/SlackNotificationServiceTest.java`
around lines 52 - 73, Add a new unit test alongside
sendNotification_shouldRenderIssueLinkAsMarkdownText that covers the webUrl
missing branch: create an eventDetail via sentryEventDetail() but set its webUrl
to null and another test for blank (or a parameterized test) and call
slackNotificationService.sendNotification(...). Then extract blocks with
extractBlocksFromSlackRequest() and assert there is no "actions" block and that
the final block's text is exactly "상세 보기" (no link markup), referencing the
existing test helpers (sentryEventDetail, slackNotificationService,
extractBlocksFromSlackRequest) to verify the fallback behavior when webUrl is
null/blank.
🤖 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.

Nitpick comments:
In `@src/test/java/org/sopt/makers/service/SlackNotificationServiceTest.java`:
- Around line 52-73: Add a new unit test alongside
sendNotification_shouldRenderIssueLinkAsMarkdownText that covers the webUrl
missing branch: create an eventDetail via sentryEventDetail() but set its webUrl
to null and another test for blank (or a parameterized test) and call
slackNotificationService.sendNotification(...). Then extract blocks with
extractBlocksFromSlackRequest() and assert there is no "actions" block and that
the final block's text is exactly "상세 보기" (no link markup), referencing the
existing test helpers (sentryEventDetail, slackNotificationService,
extractBlocksFromSlackRequest) to verify the fallback behavior when webUrl is
null/blank.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a2167603-ff0e-4f06-beb5-774dc49a3e92

📥 Commits

Reviewing files that changed from the base of the PR and between d3d4918 and 23a1c79.

📒 Files selected for processing (2)
  • src/main/java/org/sopt/makers/service/SlackNotificationService.java
  • src/test/java/org/sopt/makers/service/SlackNotificationServiceTest.java

@move-hoon move-hoon merged commit cc1a1af into main May 13, 2026
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.

fix: Slack 상세 보기 링크 렌더링 방식 개선

1 participant