Skip to content

fix(activity): truncate repo names rune-safely in repo chart#1473

Merged
Soph merged 1 commit into
entireio:mainfrom
Mohit-Katyal:fix/repo-chart-utf8-truncation
Jun 19, 2026
Merged

fix(activity): truncate repo names rune-safely in repo chart#1473
Soph merged 1 commit into
entireio:mainfrom
Mohit-Katyal:fix/repo-chart-utf8-truncation

Conversation

@Mohit-Katyal

Copy link
Copy Markdown
Contributor

Overview

renderRepoChart (the entire activity repo chart) shortened long repo names
with a byte slice — name[:maxNameLen-1] + "…". For repo names containing
multi-byte UTF-8 (accents, non-Latin scripts, emoji), that can split a rune
mid-byte and emit invalid UTF-8 to the terminal.

This reuses the file's existing rune-aware padOrTruncate helper — the same one
the commit-list path already relies on — which also removes the duplicated
truncate-and-pad logic.

Test

Adds TestRenderRepoChart_UnicodeNameSafeTruncation, mirroring the existing
TestRenderCommitList_UnicodeMessageSafeTruncation: it renders a long,
multi-byte repo name and asserts the output is valid UTF-8 and still truncated.
The test fails on the previous byte-slicing code and passes with this change.

Low risk — rendering-only change in the activity dashboard; no auth, API,
or on-disk behavior touched.

renderRepoChart shortened long repo names with a byte slice
(name[:maxNameLen-1] + ellipsis), which can split a multi-byte UTF-8
rune and emit invalid UTF-8 to the terminal. Reuse the existing
rune-aware padOrTruncate helper (consistent with the commit-list
path) and add a regression test mirroring
TestRenderCommitList_UnicodeMessageSafeTruncation.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Mohit-Katyal Mohit-Katyal requested a review from a team as a code owner June 18, 2026 23:43
@Soph Soph merged commit 45305b1 into entireio:main Jun 19, 2026
9 checks passed
@Soph

Soph commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

Thanks! 🫶

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants