Skip to content

fix(analytics): truncate gain history on char boundaries#2324

Open
fengjikui wants to merge 1 commit into
rtk-ai:developfrom
fengjikui:fix/cjk-history-truncation
Open

fix(analytics): truncate gain history on char boundaries#2324
fengjikui wants to merge 1 commit into
rtk-ai:developfrom
fengjikui:fix/cjk-history-truncation

Conversation

@fengjikui

Copy link
Copy Markdown

Fixes #2318.

Summary

rtk gain --history truncated long command strings with a fixed byte slice (&cmd[..22]). When a command contained CJK filenames, byte 22 could land inside a multi-byte UTF-8 character and panic.

This reuses the existing character-count-based core::utils::truncate helper for gain history command display and adds a regression test with the CJK filename shape from the issue.

Validation

  • cargo fmt --check
  • cargo test analytics::gain::tests::truncate_history_command_handles_cjk_filenames
  • cargo test analytics::gain
  • cargo clippy --all-targets -- -D warnings
  • cargo test -> 2073 passed, 7 ignored
  • git diff --check

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.

rtk gain --history panics on non-ASCII (CJK) filenames in command history

1 participant