Skip to content

fix(core): Address UTF-8 character boundary issues in LineBreaker#3228

Merged
tusharmath merged 5 commits into
tailcallhq:mainfrom
iamchanii:fix/safe-handling-utf-8-string-in-line-breaker
Dec 26, 2024
Merged

fix(core): Address UTF-8 character boundary issues in LineBreaker#3228
tusharmath merged 5 commits into
tailcallhq:mainfrom
iamchanii:fix/safe-handling-utf-8-string-in-line-breaker

Conversation

@iamchanii

@iamchanii iamchanii commented Dec 24, 2024

Copy link
Copy Markdown
Contributor

Summary:
This PR integrates the unicode-segmentation crate to address issues related to UTF-8 character boundaries in the LineBreaker struct. The changes ensure that string documentation is formatted safely without encountering byte index errors. The code now correctly iterates over grapheme clusters, thus maintaining valid character boundaries during string manipulation.

Before the change, the added test case causes a panic.

Issue Reference(s):
N/A

Build & Testing:

  • I ran cargo test successfully.
  • I have run ./lint.sh --mode=fix to fix all linting issues raised by ./lint.sh --mode=check.

Checklist:

  • I have added relevant unit & integration tests.
  • I have updated the documentation accordingly.
  • I have performed a self-review of my code.
  • PR follows the naming convention of <type>(<optional scope>): <title>

@github-actions github-actions Bot added the type: fix Iterations on existing features or infrastructure. label Dec 24, 2024
@tusharmath

Copy link
Copy Markdown
Contributor

Thanks @iamchanii 🙌

@tusharmath tusharmath enabled auto-merge (squash) December 24, 2024 07:54
@tusharmath tusharmath disabled auto-merge December 24, 2024 21:35
@tusharmath tusharmath enabled auto-merge (squash) December 24, 2024 23:29
@codecov

codecov Bot commented Dec 26, 2024

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.32%. Comparing base (4cf48a1) to head (cc76682).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3228      +/-   ##
==========================================
+ Coverage   86.30%   86.32%   +0.01%     
==========================================
  Files         282      282              
  Lines       28761    28798      +37     
==========================================
+ Hits        24823    24860      +37     
  Misses       3938     3938              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tusharmath tusharmath merged commit e3a6026 into tailcallhq:main Dec 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: fix Iterations on existing features or infrastructure.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants