Skip to content

feat: PR/이슈 코멘트 알림에 본문 포함#3

Merged
dohyun-ko merged 2 commits into
mainfrom
dohyun-ko/pr-comment-notify-body
May 15, 2026
Merged

feat: PR/이슈 코멘트 알림에 본문 포함#3
dohyun-ko merged 2 commits into
mainfrom
dohyun-ko/pr-comment-notify-body

Conversation

@dohyun-ko
Copy link
Copy Markdown
Member

@dohyun-ko dohyun-ko commented May 14, 2026

Summary

  • PR/이슈 코멘트 알림 시 코멘트 본문을 두 번째 텍스트 블록으로 포함
  • 본문이 길어질 수 있어 100 rune 길이 제한 (초과 시 ... 으로 truncate) -> 200자 해도 될 것 같기도 하구요
  • 본문이 비어있는 경우엔 블록을 추가하지 않음

100자는 이런느낌

Channel Talk 2026-05-14 14 12 11

200자는 이런느낌

Channel Talk 2026-05-14 14 11 59

300자는 이런느낌

Google Chrome 2026-05-14 14 12 18

Test plan

  • PR 코멘트 작성 시 알림에 본문이 함께 표시되는지 확인
  • 100자 초과 코멘트가 ... 으로 잘리는지 확인
  • 한글이 rune 단위로 안전하게 잘리는지 확인
  • 이슈 코멘트에서도 동일하게 동작하는지 확인

🤖 Generated with Claude Code

Summary by CodeRabbit

릴리스 노트

  • Bug Fixes
    • GitHub 이슈 댓글이 포함된 메시지의 형식을 개선했습니다. 이제 댓글 본문이 최대 길이로 제한되며 안전하게 처리됩니다. 댓글 본문이 없거나 너무 길면 자동으로 제외됩니다.

Review Change Stack

100 rune 길이 제한으로 잘라서 두 번째 블록으로 첨부.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@channeltalk
Copy link
Copy Markdown

channeltalk Bot commented May 14, 2026

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 14, 2026

개요

internal/event/callback/issue.go에서 GitHub 이슈 댓글 이벤트를 처리할 때 댓글 본문을 루네 단위로 안전하게 잘라내는 기능이 추가되었습니다. 새로운 truncateRunes 헬퍼와 commentBodyMaxRunes 상수가 도입되고, IssueCommentCreated.buildMessage에서 제목과 함께 잘린 댓글 본문을 메시지 블록으로 조립합니다.

변경사항

이슈 댓글 본문 잘라내기

계층 / 파일 요약
글자 수 제한과 잘라내기 헬퍼
internal/event/callback/issue.go
commentBodyMaxRunes 상수와 truncateRunes unexported 함수를 도입하여 문자열을 루네 단위로 자르고, 자른 경우 말줄임표를 추가합니다.
메시지 블록 조립
internal/event/callback/issue.go
IssueCommentCreated.buildMessage를 업데이트하여 제목 블록 다음에 이스케이프되고 루네 단위로 자른 댓글 본문을 선택적 텍스트 블록으로 추가합니다. 자른 후 본문이 비어 있으면 본문 블록은 추가되지 않습니다.

🎯 2 (Simple) | ⏱️ ~10분

작은 댓글도 자르는 우리 토끼 🐰
루네마다 정성스레 세어
말줄임표로 인사하고 💬
메시지를 예쁘게 담아
GitHub에 날려 보내요 ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 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 (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 풀 리퀘스트 제목은 변경사항의 핵심인 'PR/이슈 코멘트 알림에 본문 포함'을 명확하게 반영하고 있습니다.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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 dohyun-ko/pr-comment-notify-body

Comment @coderabbitai help to get the list of available commands and usage tips.

ChannelTalk 메시지 포맷이 <link>, <b> 등 ANTLR 태그를 인식하기 때문에,
코멘트에 우연히 포함된 <, >, &, " 가 raw로 들어가면 파싱이 깨질 수 있어
EscapedString 으로 한 번 거쳐서 전달.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dohyun-ko dohyun-ko marked this pull request as ready for review May 14, 2026 05:14
@dohyun-ko dohyun-ko requested review from Dylan-KW and gwolves May 14, 2026 05:16
Copy link
Copy Markdown

@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 current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/event/callback/issue.go`:
- Around line 24-30: The truncateRunes function currently appends "..." after
taking max runes, which can produce strings longer than max; update
truncateRunes to account for the suffix length by measuring suffixRunes :=
len([]rune("...")) and when len(runes) > max return
string(runes[:max-suffixRunes]) + "..." so the total rune count <= max; also
handle the edge case where max <= suffixRunes by returning string(runes[:max])
(i.e., no room for the full suffix) so you never exceed the requested max.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 99975d81-2d2d-462d-a135-0e1afea9c324

📥 Commits

Reviewing files that changed from the base of the PR and between 7ac4bc9 and fa6e95a.

📒 Files selected for processing (1)
  • internal/event/callback/issue.go

Comment on lines +24 to +30
func truncateRunes(s string, max int) string {
runes := []rune(s)
if len(runes) <= max {
return s
}
return string(runes[:max]) + "..."
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

잘림 결과가 설정 길이(100 rune)를 초과할 수 있습니다.

현재 구현은 max rune를 남긴 뒤 "..."를 붙여, 잘린 경우 결과가 최대 max+3 rune가 됩니다. “100 rune 제한”을 엄밀히 지키려면 suffix 길이를 포함해 자르는 방식으로 바꾸는 게 맞습니다.

수정 예시
 func truncateRunes(s string, max int) string {
+	if max <= 0 {
+		return ""
+	}
 	runes := []rune(s)
 	if len(runes) <= max {
 		return s
 	}
-	return string(runes[:max]) + "..."
+	const suffix = "..."
+	suffixRunes := len([]rune(suffix))
+	if max <= suffixRunes {
+		return string(runes[:max])
+	}
+	return string(runes[:max-suffixRunes]) + suffix
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
func truncateRunes(s string, max int) string {
runes := []rune(s)
if len(runes) <= max {
return s
}
return string(runes[:max]) + "..."
}
func truncateRunes(s string, max int) string {
if max <= 0 {
return ""
}
runes := []rune(s)
if len(runes) <= max {
return s
}
const suffix = "..."
suffixRunes := len([]rune(suffix))
if max <= suffixRunes {
return string(runes[:max])
}
return string(runes[:max-suffixRunes]) + suffix
}
🤖 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 `@internal/event/callback/issue.go` around lines 24 - 30, The truncateRunes
function currently appends "..." after taking max runes, which can produce
strings longer than max; update truncateRunes to account for the suffix length
by measuring suffixRunes := len([]rune("...")) and when len(runes) > max return
string(runes[:max-suffixRunes]) + "..." so the total rune count <= max; also
handle the edge case where max <= suffixRunes by returning string(runes[:max])
(i.e., no room for the full suffix) so you never exceed the requested max.

@dohyun-ko dohyun-ko requested a review from huGgW May 14, 2026 07:36
@dohyun-ko dohyun-ko merged commit ae0d086 into main May 15, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants