Skip to content

fix(email): keep trailing combining marks and variation selectors - #6373

Open
adhyaay-karnwal wants to merge 1 commit into
macro-inc:mainfrom
adhyaay-karnwal:fix/email-trailing-unicode-modifiers
Open

adhyaay-karnwal wants to merge 1 commit into
macro-inc:mainfrom
adhyaay-karnwal:fix/email-trailing-unicode-modifiers

Conversation

@adhyaay-karnwal

@adhyaay-karnwal adhyaay-karnwal commented Sep 13, 2026

Copy link
Copy Markdown

Fixes #5705.

remove_trailing_special_chars treated the combining-mark ranges and variation selectors as invisible, then truncated everything after the last character outside those ranges. A trailing decomposed accent (e + U+0301) lost its accent, and an emoji variation selector could be stripped.

The trailing-noise predicate is now limited to whitespace and formatting controls (zero-width spaces/joiners, BOM, NBSP, word joiner, and the existing general-punctuation format ranges). Combining marks and variation selectors are preserved.

U+034F COMBINING GRAPHEME JOINER stays in the noise set: it is a joiner/format control, not a meaning-bearing accent, which matches the issue's request to keep joiner cleanup intact.


Note

Low Risk
Narrow change to subject/snippet trailing cleanup with added regression tests; improves display correctness without touching auth or data paths.

Overview
Fixes incorrect truncation of email subjects/snippets that end with decomposed accents or emoji variation selectors.

is_invisible_char in clean_subject_snippet.rs no longer treats combining diacritical marks or variation selectors as trailing noise, so remove_trailing_special_chars stops before those characters instead of stripping them. Zero-width spaces, BOM, NBSP, word joiner, U+034F grapheme joiner, and the existing general-punctuation format ranges are still removed from the end.

New unit tests cover preserved café/naïve-style trailing marks, emoji with U+FE0F, and format controls still stripped after a combining mark.

Reviewed by Cursor Bugbot for commit cc63e46. Bugbot is set up for automated code reviews on this repo. Configure here.

Subject and snippet cleanup treated Unicode combining marks and
variation selectors as invisible, so a decomposed accent or an emoji
presentation selector at the end of a string was stripped. Restrict
the trailing-noise set to whitespace and format controls. Combining
Grapheme Joiner stays in that set with the other joiners.
@coderabbitai

coderabbitai Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 18fd6b51-b439-423a-955d-41c4beac4b91

📥 Commits

Reviewing files that changed from the base of the PR and between e00d041 and cc63e46.

📒 Files selected for processing (1)
  • services/email_service/src/util/process_pre_insert/clean_message/clean_subject_snippet.rs

Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.


📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Preserved combining marks and variation selectors at the end of email subject snippets.
    • Continued removing trailing zero-width and formatting control characters for cleaner message display.

Walkthrough

The change updates is_invisible_char so remove_trailing_special_chars preserves trailing combining marks and variation selectors. Tests cover decomposed accented characters, emoji variation selectors, and trailing zero-width or format controls after combining marks.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to cc63e

The change preserves trailing combining marks and variation selectors while continuing to remove the intended trailing formatting noise.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title uses the conventional commits format with the valid fix(email): prefix. It clearly describes the change and is 65 characters long, which is under the 72-character limit.
Description check ✅ Passed The description directly explains the subject and snippet cleanup change, the preserved Unicode characters, the retained formatting controls, and the regression tests.
Linked Issues check ✅ Passed The changes satisfy the coding requirements in #5705. is_invisible_char no longer classifies combining-mark ranges or U+FE00–U+FE0F variation selectors as trailing noise. The existing cleanup remain…
Out of Scope Changes check ✅ Passed The reviewed changes are limited to the email subject and snippet trailing-cleanup predicate and focused regression tests. These changes directly support #5705. No unrelated implementation or test cha…
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

fix(email): preserve trailing Unicode modifiers during cleanup

1 participant