Skip to content

feat: Slack AI 응답 관련 개선#393

Merged
JanooGwan merged 3 commits intodevelopfrom
feature/cam-207
Mar 16, 2026
Merged

feat: Slack AI 응답 관련 개선#393
JanooGwan merged 3 commits intodevelopfrom
feature/cam-207

Conversation

@JanooGwan
Copy link
Contributor

🔍 개요

  • Claude AI가 응답에서 *text* (단일 별표) 형식으로 강조 표현을 사용하는 경우, Slack에서 볼드 처리가 되지 않는 문제를 개선합니다.
  • 기존에는 **text** (이중 별표)만 Slack 볼드(*text*)로 변환하고 있었으나, 단일 별표도 동일하게 처리합니다.

🚀 주요 변경 내용

  • SlackAIServiceMARKDOWN_ITALIC_PATTERN 추가 ((?<!\*)\*(?!\*)(.+?)(?<!\*)\*(?!\*))
  • convertMarkdownToSlack 메서드에서 **text** 변환 후 *text* 순서로 처리
    • double 별표를 먼저 변환해 single 패턴에 잘못 매칭되는 것을 방지

💬 참고 사항

  • 관련 이슈: CAM-208
  • 변환 순서(double → single)가 핵심 — 순서가 바뀌면 **text***가 single 패턴에 잘못 매칭될 수 있음
  • 기존 MARKDOWN_BOLD_PATTERNPattern.DOTALL 특성과 동일하게 적용됨

✅ Checklist (완료 조건)

  • 코드 스타일 가이드 준수
  • 테스트 코드 포함됨
  • Reviewers / Assignees / Labels 지정 완료
  • 보안 및 민감 정보 검증 (API 키, 환경 변수, 개인정보 등)

@linear
Copy link

linear bot commented Mar 16, 2026

@coderabbitai
Copy link

coderabbitai bot commented Mar 16, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

ClaudeClient의 시스템 프롬프트에서 이모지 권장 및 응답 길이 제한을 제거하고 응답은 질문에만 하도록 변경했습니다. SlackAIService에 마크다운 이탤릭 정규식 패턴을 추가하고 convertMarkdownToSlack에서 볼드 변환 후 이탤릭 변환을 적용했습니다.

Changes

Cohort / File(s) Summary
Claude 클라이언트 프롬프트 조정
src/main/java/gg/agit/konect/infrastructure/claude/client/ClaudeClient.java
시스템 프롬프트에서 이모지 사용 권장 및 2–3문장 응답 제한을 제거하고, '질문에만 답변'하도록 안내 문구를 변경함.
Slack 마크다운 이탤릭 포매팅
src/main/java/gg/agit/konect/infrastructure/slack/ai/SlackAIService.java
MARKDOWN_ITALIC_PATTERN 추가 및 convertMarkdownToSlack에서 기존 볼드 변환 결과에 대해 이탤릭 변환을 추가 적용하도록 변경함.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

버그

Poem

🐰 프롬프트를 살짝 고치고, 패턴 하나 더 넣었네,
답은 묻는 것만 쏙, 이모지 없이도 찰떡이네.
슬랙엔 굵게·기울임, 텍스트가 춤추고,
코드 한 줄에 기분 좋아진다, 깡총깡총! 🥕✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
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 (2 passed)
Check name Status Explanation
Title check ✅ Passed PR 제목이 주요 변경사항인 Slack AI 응답 개선을 명확하게 설명하고 있습니다.
Description check ✅ Passed PR 설명이 변경사항의 구체적인 내용, 배경, 그리고 변환 순서의 중요성을 충분히 설명하고 있습니다.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/cam-207
📝 Coding Plan
  • Generate coding plan for human review comments

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.

@JanooGwan JanooGwan requested a review from Copilot March 16, 2026 07:04
@JanooGwan JanooGwan self-assigned this Mar 16, 2026
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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/main/java/gg/agit/konect/infrastructure/slack/ai/SlackAIService.java`:
- Around line 180-181: The single-asterisk replace at MARKDOWN_ITALIC_PATTERN is
a no-op for already-unescaped "*text*" and doesn't handle escaped forms like
"\*text\*"; update convertMarkdownToSlack to first unescape escaped asterisks
(replace "\\*([\\s\\S]+?)\\*" -> "*$1*"), then apply MARKDOWN_BOLD_PATTERN
replacement to produce "**$1**", then apply MARKDOWN_ITALIC_PATTERN to produce
"*$1*" (ensuring the regexes match unescaped forms only and order is bold ->
italic), and add unit tests for convertMarkdownToSlack covering "*text*",
"**text**", and "\*text\*" inputs to assert expected Slack-formatted outputs.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: d3705ba9-bf48-4cf8-9c1e-3de7f2176d11

📥 Commits

Reviewing files that changed from the base of the PR and between 75b3543 and f496f7b.

📒 Files selected for processing (2)
  • src/main/java/gg/agit/konect/infrastructure/claude/client/ClaudeClient.java
  • src/main/java/gg/agit/konect/infrastructure/slack/ai/SlackAIService.java
📜 Review details
🧰 Additional context used
📓 Path-based instructions (2)
src/main/java/**/*.java

⚙️ CodeRabbit configuration file

src/main/java/**/*.java: 아래 원칙으로 리뷰 코멘트를 작성한다.

  • 코멘트는 반드시 한국어로 작성한다.
  • 반드시 수정이 필요한 항목만 코멘트로 남기고, 단순 취향 차이는 지적하지 않는다.
  • 각 코멘트 첫 줄에 심각도를 [LEVEL: high|medium|low] 형식으로 반드시 표기한다.
  • 심각도 기준: high=운영 장애 가능, medium=품질 저하, low=개선 권고.
  • 각 코멘트는 "문제 -> 영향 -> 제안" 순서로 3문장 이내로 간결하게 작성한다.
  • 가능하면 재현 조건 및 실패 시나리오도 포함한다.
  • 제안은 현재 코드베이스(Spring Boot + JPA + Flyway) 패턴과 일치해야 한다.
  • 보안, 트랜잭션 경계, 예외 처리, N+1, 성능 회귀 가능성을 우선 점검한다.
  • 가독성: 변수/메서드 이름이 의도를 바로 드러내는지, 중첩과 메서드 길이가 과도하지 않은지 점검한다.
  • 단순화: 불필요한 추상화, 중복 로직, 과한 방어 코드가 있으면 더 단순한 대안을 제시한다.
  • 확장성: 새 요구사항 추가 시 변경 범위가 최소화되는 구조인지(하드코딩 분기/값 여부 포함) 점검한다.

Files:

  • src/main/java/gg/agit/konect/infrastructure/slack/ai/SlackAIService.java
  • src/main/java/gg/agit/konect/infrastructure/claude/client/ClaudeClient.java
**/*

⚙️ CodeRabbit configuration file

**/*: 공통 리뷰 톤 가이드:

  • 모든 코멘트는 첫 줄에 [LEVEL: ...] 태그를 포함한다.
  • 과장된 표현 없이 사실 기반으로 작성한다.
  • 한 코멘트에는 하나의 이슈만 다룬다.
  • 코드 예시가 필요하면 최소 수정 예시를 제시한다.
  • 가독성/단순화/확장성 이슈를 발견하면 우선순위를 높여 코멘트한다.

Files:

  • src/main/java/gg/agit/konect/infrastructure/slack/ai/SlackAIService.java
  • src/main/java/gg/agit/konect/infrastructure/claude/client/ClaudeClient.java
🧠 Learnings (1)
📚 Learning: 2026-02-16T09:45:12.135Z
Learnt from: CR
Repo: BCSDLab/KONECT_BACK_END PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-02-16T09:45:12.135Z
Learning: Always respond in Korean

Applied to files:

  • src/main/java/gg/agit/konect/infrastructure/claude/client/ClaudeClient.java

Comment on lines +180 to +181
String result = MARKDOWN_BOLD_PATTERN.matcher(text).replaceAll("*$1*");
return MARKDOWN_ITALIC_PATTERN.matcher(result).replaceAll("*$1*");
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

[LEVEL: medium]
문제: Line 181의 단일 별표 변환은 *text*를 다시 *text*로 치환하는 no-op이라 실제 변환 동작이 없습니다.
영향: CAM-208 재현 케이스에서 입력/출력이 동일해 Slack 렌더링 문제가 그대로 남을 수 있습니다.
제안: 실제 실패 입력(예: 이스케이프된 \*text\* 등)을 기준으로 변환 규칙을 수정하고, convertMarkdownToSlack*text*/**text**/\*text\* 케이스 단위 테스트를 추가해 기대 결과를 고정해 주세요.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/java/gg/agit/konect/infrastructure/slack/ai/SlackAIService.java`
around lines 180 - 181, The single-asterisk replace at MARKDOWN_ITALIC_PATTERN
is a no-op for already-unescaped "*text*" and doesn't handle escaped forms like
"\*text\*"; update convertMarkdownToSlack to first unescape escaped asterisks
(replace "\\*([\\s\\S]+?)\\*" -> "*$1*"), then apply MARKDOWN_BOLD_PATTERN
replacement to produce "**$1**", then apply MARKDOWN_ITALIC_PATTERN to produce
"*$1*" (ensuring the regexes match unescaped forms only and order is bold ->
italic), and add unit tests for convertMarkdownToSlack covering "*text*",
"**text**", and "\*text\*" inputs to assert expected Slack-formatted outputs.

@JanooGwan JanooGwan added 리팩토링 리팩터링을 위한 이슈입니다. labels Mar 16, 2026
@JanooGwan JanooGwan changed the title feat: Slack AI 응답 단일 별표(*text*) 볼드 처리 추가 feat: Slack AI 응답 관련 개선 Mar 16, 2026
@JanooGwan JanooGwan added the 기능 새로운 기능을 개발합니다. label Mar 16, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Slack에서 Claude AI 응답의 마크다운 강조 표기(*text*, **text**)가 의도대로 볼드로 렌더링되도록 변환 로직을 확장하는 PR입니다.

Changes:

  • SlackAIService에 단일 별표(*text*) 매칭 패턴을 추가하고, 변환 순서를 ** → * 다음 * → *로 적용
  • ClaudeClient의 SYSTEM_PROMPT 응답 규칙 문구 일부를 수정

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/main/java/gg/agit/konect/infrastructure/slack/ai/SlackAIService.java Slack용 마크다운 변환에서 단일 별표 강조 처리 추가
src/main/java/gg/agit/konect/infrastructure/claude/client/ClaudeClient.java Claude 시스템 프롬프트의 응답 규칙 문구 조정

private static final Pattern MARKDOWN_BOLD_PATTERN =
Pattern.compile("\\*\\*(.+?)\\*\\*", Pattern.DOTALL);
private static final Pattern MARKDOWN_ITALIC_PATTERN =
Pattern.compile("(?<!\\*)\\*(?!\\*)(.+?)(?<!\\*)\\*(?!\\*)", Pattern.DOTALL);
Comment on lines 58 to 63
## 응답 규칙
- 반드시 한국어로 응답
- 이모지를 적절히 사용하여 친근하게
- 간결하게 2-3문장으로 답변
- 답변은 질문한 것에 대해서만 할 것
- 모르는 테이블이 있으면 먼저 탐색 후 답변
- 예측/미래 추론 질문은 현재까지의 데이터만 제공하고 예측은 어렵다고 안내
- 데이터베이스에 정말 없는 정보만 정중히 거절
@JanooGwan JanooGwan merged commit efb1cda into develop Mar 16, 2026
2 of 3 checks passed
@JanooGwan JanooGwan deleted the feature/cam-207 branch March 16, 2026 07:16
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.

2 participants