mirror of
https://github.com/mikeyobrien/ralph-orchestrator.git
synced 2026-04-25 07:05:57 +03:00
[PR #73] [MERGED] fix(adapters): handle UTF-8 boundaries in truncate function #121
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ralph-orchestrator#121
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/mikeyobrien/ralph-orchestrator/pull/73
Author: @mikeyobrien
Created: 1/19/2026
Status: ✅ Merged
Merged: 1/19/2026
Merged by: @mikeyobrien
Base:
main← Head:fix/utf8-truncate-boundary📝 Commits (1)
d8dcbf9fix(adapters): handle UTF-8 boundaries in truncate function📊 Changes
1 file changed (+46 additions, -1 deletions)
View changed files
📝
crates/ralph-adapters/src/claude_stream.rs(+46 -1)📄 Description
Summary
truncate()when byte limit falls inside a multi-byte UTF-8 characterProblem
The
truncatefunction inclaude_stream.rswas using&s[..max_len]which panics ifmax_lenlands inside a multi-byte UTF-8 sequence. For example:Solution
Use
char_indices()to find the last valid UTF-8 boundary at or beforemax_len:Test plan
test_truncate_utf8_boundary- verifies truncation with arrow character (3-byte)test_truncate_utf8_emoji- verifies truncation with emoji (4-byte)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.