regression: outgoing webhooks fail to match emoji trigger words - #41542
regression: outgoing webhooks fail to match emoji trigger words#41542abhinavkrin wants to merge 2 commits into
Conversation
Signed-off-by: Abhinav Kumar <abhinav@avitechlab.com>
|
Looks like this PR is not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
|
WalkthroughTrigger URL matching recognizes Unicode equivalents of configured shortname trigger words while preserving existing position rules and reporting the original configured trigger word. ChangesUnicode trigger-word matching
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (1)
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)
apps/meteor/server/lib/integrations/lib/triggerHandler.ts (1)
519-523: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAdd regression coverage for Unicode trigger variants.
Please cover shortcode and Unicode matches in both prefix and anywhere modes, and assert that
data.trigger_wordremains the original configured shortcode.🤖 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 `@apps/meteor/server/lib/integrations/lib/triggerHandler.ts` around lines 519 - 523, Add regression tests around the trigger matching logic in triggerHandler, covering shortcode and Unicode variants for both prefix mode and triggerWordAnywhere mode. Assert each match succeeds and that data.trigger_word retains the original configured shortcode rather than the matched Unicode variant.
🤖 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 `@apps/meteor/server/lib/integrations/lib/triggerHandler.ts`:
- Around line 519-523: Add regression tests around the trigger matching logic in
triggerHandler, covering shortcode and Unicode variants for both prefix mode and
triggerWordAnywhere mode. Assert each match succeeds and that data.trigger_word
retains the original configured shortcode rather than the matched Unicode
variant.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: d736d9c3-6264-4ec6-abf4-9bc5acf17958
📒 Files selected for processing (1)
apps/meteor/server/lib/integrations/lib/triggerHandler.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (4)
- GitHub Check: 📦 Build Packages
- GitHub Check: cubic · AI code reviewer
- GitHub Check: Hacktron Security Check
- 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:
apps/meteor/server/lib/integrations/lib/triggerHandler.ts
🧠 Learnings (3)
📚 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:
apps/meteor/server/lib/integrations/lib/triggerHandler.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:
apps/meteor/server/lib/integrations/lib/triggerHandler.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:
apps/meteor/server/lib/integrations/lib/triggerHandler.ts
🔇 Additional comments (1)
apps/meteor/server/lib/integrations/lib/triggerHandler.ts (1)
20-31: LGTM!
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## release-8.7.0 #41542 +/- ##
=================================================
- Coverage 68.59% 68.57% -0.02%
=================================================
Files 4138 4138
Lines 159417 159420 +3
Branches 28202 28194 -8
=================================================
- Hits 109349 109325 -24
- Misses 44929 44962 +33
+ Partials 5139 5133 -6
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Signed-off-by: Abhinav Kumar <abhinav@avitechlab.com>
gabriellsh
left a comment
There was a problem hiding this comment.
Not regarding the code itself, but is this really a regression? Trigger words are supposed to match the text of the message, with the native emoji implementation, the only thing that changed is how the client sends the emoji, instead of sending the shortcode as text, the unicode is used directly.
With this change, now the trigger word can also match unicode emoji, if the text matches an emoji shortcode. This can be quite confusing, since the integration will trigger in a message that does not contain that actual text. Also, it was always possible to send emoji as unicode, and though the client changed substantially in that regard, the way that emoji is sent in a message depends on the client, thus that is not a breaking change that needs to be fixed.
I'll leave some changes requested here to ensure that we discuss this before moving forward. Once we merge this PR, there won't be any take-backsies, as reverting this would be a breaking change.
Proposed changes (including videos or screenshots)
Outgoing webhooks that use an emoji shortcode as their trigger word (for example
:smile:) stopped firing in 8.7.The reason: since 8.7 the message composer saves emojis as their native Unicode character (
😄) instead of the:smile:text. The outgoing-webhook matcher compares the configured trigger word against the raw message text, so:smile:no longer appeared anywhere in the message and the webhook silently never ran. This worked in 8.6, where the message was stored as:smile:.This change makes the trigger matcher recognize both forms. For each configured trigger word it now also checks the word's native Unicode emoji equivalent, so a
:smile:trigger matches whether the message contains:smile:(e.g. sent via API) or😄(sent from the composer). It reuses the same shortcode-to-unicode conversion the message pipeline already uses.Screen.Recording.2026-07-24.at.4.34.02.AM.mov
Issue(s)
CORE-2469 (no GitHub issue).
Steps to test or reproduce
#emoji-webhook-results.#emoji-webhook-source: eventMessage Sent, Trigger Words:smile:, Word Placement AnywhereOn, URL set to the incoming webhook's URL.#emoji-webhook-source, typehelloand pick the 😄 emoji from the picker/autocomplete, then send it.#emoji-webhook-results. (Before this fix, nothing appeared.)Further comments
CORE-2469
Summary by CodeRabbit