mirror of
https://github.com/mikeyobrien/ralph-orchestrator.git
synced 2026-04-25 07:05:57 +03:00
[PR #145] [MERGED] feat: fix invalid char breaking error #164
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ralph-orchestrator#164
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/145
Author: @surya-teja-222
Created: 2/1/2026
Status: ✅ Merged
Merged: 2/2/2026
Merged by: @mikeyobrien
Base:
main← Head:main📝 Commits (2)
7b13cbefeat: fix invalid char breaking error5476af2Merge branch 'main' into main📊 Changes
4 files changed (+80 additions, -7 deletions)
View changed files
📝
crates/ralph-core/src/event_loop/mod.rs(+5 -5)📝
crates/ralph-core/src/lib.rs(+1 -1)📝
crates/ralph-core/src/memory_store.rs(+6 -1)📝
crates/ralph-core/src/text.rs(+68 -0)📄 Description
This pull request improves UTF-8 safety when truncating strings throughout the codebase by introducing and using a new utility function,
floor_char_boundary. This function ensures that string truncation never splits multi-byte characters (such as emojis), which could otherwise cause panics or invalid strings. The function is now used in both the memory store and event loop modules, and is exported for use elsewhere. Comprehensive unit tests have also been added to verify its correctness.UTF-8 Safe String Truncation Improvements:
floor_char_boundaryintext.rsto safely find the nearest valid UTF-8 character boundary at or before a given byte index, preventing panics when slicing strings with multi-byte characters.truncate_to_budgetinmemory_store.rsto usefloor_char_boundarywhen truncating content, ensuring truncation only occurs at valid character boundaries.event_loop/mod.rsto usefloor_char_boundarywhen determining where to start slicing content, improving robustness for UTF-8 strings.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.