regression: combined emojis displayed as separate emojis and some flags displayed as a black flag - #41441
Conversation
…iple emojis Signed-off-by: Abhinav Kumar <abhinav@avitechlab.com>
|
Looks like this PR is ready to merge! 🎉 |
🦋 Changeset detectedLatest commit: f4333e2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
WalkthroughThe message parser grammar now recognizes emoji tag sequences and emoticon-based ZWJ components. Tests cover flag variants, adjacent sequences, and mixed text, while a changeset records a patch release for the rendering fixes. ChangesEmoji sequence parsing
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (2)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/message-parser/src/grammar.pegjs (1)
797-808: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRemove unreachable branches.
The explicitly listed
UnicodeEmojiEmoticon,UnicodeEmojiMiscellaneousSymbols, andUnicodeEmojiDingbatsalternatives are now completely subsumed by the preceding ZWJ sequence branch (which naturally matches a single component when the*quantifier matches zero times).Because PEG parsing checks alternatives in order, these subsumed branches will never be reached and can be safely removed to eliminate dead code and slightly optimize parsing performance.
♻️ Proposed refactor
UnicodeEmoji = UnicodeEmojiTagSequence / $( (UnicodeEmojiZwjComponent [\u200D])* UnicodeEmojiZwjComponent ) - / UnicodeEmojiEmoticon / UnicodeEmojiTransportAndMapSymbols / UnicodeEmojiMiscellaneousTechnical - / UnicodeEmojiMiscellaneousSymbols - / UnicodeEmojiDingbats / UnicodeEmojiFlags🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/message-parser/src/grammar.pegjs` around lines 797 - 808, Remove the unreachable UnicodeEmojiEmoticon, UnicodeEmojiMiscellaneousSymbols, and UnicodeEmojiDingbats alternatives from the emoji parsing rule. Keep the preceding UnicodeEmojiZwjComponent sequence and the remaining distinct alternatives unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@packages/message-parser/src/grammar.pegjs`:
- Around line 797-808: Remove the unreachable UnicodeEmojiEmoticon,
UnicodeEmojiMiscellaneousSymbols, and UnicodeEmojiDingbats alternatives from the
emoji parsing rule. Keep the preceding UnicodeEmojiZwjComponent sequence and the
remaining distinct alternatives unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a8b90f9f-6305-4603-8ce3-188afd846b47
📒 Files selected for processing (3)
.changeset/emoji-zwj-tag-sequences.mdpackages/message-parser/src/grammar.pegjspackages/message-parser/tests/emoji.test.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (5)
- GitHub Check: 📦 Build Packages
- GitHub Check: cubic · AI code reviewer
- GitHub Check: Hacktron Security Check
- GitHub Check: CodeQL-Build
- GitHub Check: CodeQL-Build
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation
Files:
packages/message-parser/tests/emoji.test.ts
🧠 Learnings (4)
📚 Learning: 2026-03-16T21:50:37.589Z
Learnt from: amitb0ra
Repo: RocketChat/Rocket.Chat PR: 39676
File: .changeset/migrate-users-register-openapi.md:3-3
Timestamp: 2026-03-16T21:50:37.589Z
Learning: For changes related to OpenAPI migrations in Rocket.Chat/OpenAPI, when removing endpoint types and validators from rocket.chat/rest-typings (e.g., UserRegisterParamsPOST, /v1/users.register) document this as a minor changeset (not breaking) per RocketChat/Rocket.Chat-Open-API#150 Rule 7. Note that the endpoint type is re-exposed via a module augmentation .d.ts in the consuming package (e.g., packages/web-ui-registration/src/users-register.d.ts). In reviews, ensure the changeset clearly states: this is a non-breaking change, the major version should not be bumped, and the changeset reflects a minor version bump. Do not treat this as a breaking change during OpenAPI migrations.
Applied to files:
.changeset/emoji-zwj-tag-sequences.md
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.
Applied to files:
packages/message-parser/tests/emoji.test.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.
Applied to files:
packages/message-parser/tests/emoji.test.ts
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.
Applied to files:
packages/message-parser/tests/emoji.test.ts
🔇 Additional comments (3)
packages/message-parser/src/grammar.pegjs (1)
814-820: LGTM!packages/message-parser/tests/emoji.test.ts (1)
91-115: LGTM!.changeset/emoji-zwj-tag-sequences.md (1)
1-6: LGTM!
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #41441 +/- ##
===========================================
- Coverage 68.56% 68.54% -0.02%
===========================================
Files 4124 4124
Lines 160128 160246 +118
Branches 29166 29183 +17
===========================================
+ Hits 109788 109841 +53
- Misses 45240 45295 +55
- Partials 5100 5110 +10
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Proposed changes (including videos or screenshots)
The message parser was splitting multi-codepoint emoji sequences into multiple emojis:
emojioneshipping its own assets for these flags and was exposed when it was removed (chore: remove emojione in favor of native emojis #39411).Changes in
packages/message-parser/src/grammar.pegjs:UnicodeEmojiTagSequencerule (Black Flag + tag characters + Cancel Tag), tried first so the standalone black flag cannot preempt it.No existing rule's character ranges were narrowed, so anything that matched before still matches — the only behavioral change is that sequences previously producing two tokens now produce one.
Issue(s)
CORE-2311
CORE-2416
Steps to test or reproduce
Further comments
CORE-2311 · CORE-2416
Summary by CodeRabbit