feat: PR/이슈 코멘트 알림에 본문 포함#3
Conversation
100 rune 길이 제한으로 잘라서 두 번째 블록으로 첨부. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
개요
변경사항이슈 댓글 본문 잘라내기
🎯 2 (Simple) | ⏱️ ~10분
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
ChannelTalk 메시지 포맷이 <link>, <b> 등 ANTLR 태그를 인식하기 때문에, 코멘트에 우연히 포함된 <, >, &, " 가 raw로 들어가면 파싱이 깨질 수 있어 EscapedString 으로 한 번 거쳐서 전달. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
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
📒 Files selected for processing (1)
internal/event/callback/issue.go
| func truncateRunes(s string, max int) string { | ||
| runes := []rune(s) | ||
| if len(runes) <= max { | ||
| return s | ||
| } | ||
| return string(runes[:max]) + "..." | ||
| } |
There was a problem hiding this comment.
잘림 결과가 설정 길이(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.
| 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.
Summary
...으로 truncate) -> 200자 해도 될 것 같기도 하구요100자는 이런느낌
200자는 이런느낌
300자는 이런느낌
Test plan
...으로 잘리는지 확인🤖 Generated with Claude Code
Summary by CodeRabbit
릴리스 노트