refactor: Remove unused description from attachments render#40067
refactor: Remove unused description from attachments render#40067
description from attachments render#40067Conversation
…dering The `descriptionMd` field was a parsed markdown AST version of the attachment description, rendered as visible text above file attachments. This is no longer needed as `description` is being repurposed for image alt text instead of visible message content. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Looks like this PR is ready to merge! 🎉 |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughRemoved parsing, rendering, mapping, and typings for attachment Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (1 warning, 2 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 |
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #40067 +/- ##
===========================================
- Coverage 70.52% 70.15% -0.37%
===========================================
Files 3271 3278 +7
Lines 116804 116605 -199
Branches 21066 20839 -227
===========================================
- Hits 82376 81806 -570
+ Misses 32379 31512 -867
- Partials 2049 3287 +1238
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
33d3826 to
84f4e7d
Compare
descriptionMd from attachments renderdescription from attachments render
There was a problem hiding this comment.
🧹 Nitpick comments (1)
apps/meteor/client/lib/parseMessageTextToAstMarkdown.spec.ts (1)
403-429: Redundant translated attachment test case.This block duplicates the same scenario already covered by the later translated test, so it adds maintenance cost without extra coverage.
As per coding guidelines, "Use descriptive test names that clearly communicate expected behavior in Playwright tests."♻️ Proposed cleanup
- it('should return correct attachment text translated parsed md when translate is active', () => { - const textAttachment = [ - { - ...attachmentMessage[0], - text: 'attachment not translated', - translationProvider: 'provider', - translations: { - en: 'attachment translated', - }, - }, - ]; - const textAttachmentParsed: Root = [ - { - type: 'PARAGRAPH', - value: [ - { - type: 'PLAIN_TEXT', - value: 'attachment translated', - }, - ], - }, - ]; - - expect(parseMessageAttachments(textAttachment, parseOptions, enabledAutoTranslatedOptions)[0].md).toStrictEqual( - textAttachmentParsed, - ); - });🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/meteor/client/lib/parseMessageTextToAstMarkdown.spec.ts` around lines 403 - 429, The test case duplicates an existing translated-attachment scenario; remove or consolidate this redundant test block to reduce maintenance. Locate the it(...) block that constructs textAttachment, textAttachmentParsed and calls parseMessageAttachments with parseOptions and enabledAutoTranslatedOptions, then either delete this entire it(...) test or merge its assertions into the later translated-attachment test, ensuring the remaining test keeps a descriptive name and still asserts parseMessageAttachments(...)[0].md equals textAttachmentParsed.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@apps/meteor/client/lib/parseMessageTextToAstMarkdown.spec.ts`:
- Around line 403-429: The test case duplicates an existing
translated-attachment scenario; remove or consolidate this redundant test block
to reduce maintenance. Locate the it(...) block that constructs textAttachment,
textAttachmentParsed and calls parseMessageAttachments with parseOptions and
enabledAutoTranslatedOptions, then either delete this entire it(...) test or
merge its assertions into the later translated-attachment test, ensuring the
remaining test keeps a descriptive name and still asserts
parseMessageAttachments(...)[0].md equals textAttachmentParsed.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 8adafb5e-dac3-4326-a803-a48e0d3443a2
📒 Files selected for processing (25)
apps/meteor/app/apps/server/converters/messages.jsapps/meteor/app/autotranslate/client/lib/autotranslate.tsapps/meteor/app/autotranslate/server/autotranslate.tsapps/meteor/app/autotranslate/server/deeplTranslate.tsapps/meteor/app/autotranslate/server/googleTranslate.tsapps/meteor/app/autotranslate/server/msTranslate.tsapps/meteor/app/lib/server/functions/notifications/email.jsapps/meteor/app/lib/server/lib/sendNotificationsOnMessage.tsapps/meteor/app/lib/server/methods/updateMessage.tsapps/meteor/app/livechat/server/lib/sendTranscript.tsapps/meteor/app/slackbridge/server/RocketAdapter.tsapps/meteor/app/ui/client/lib/ChatMessages.tsapps/meteor/client/hooks/useDecryptedMessage.spec.tsapps/meteor/client/hooks/useDecryptedMessage.tsapps/meteor/client/lib/normalizeThreadMessage.tsxapps/meteor/client/lib/parseMessageTextToAstMarkdown.spec.tsapps/meteor/client/lib/parseMessageTextToAstMarkdown.tsapps/meteor/client/lib/utils/normalizeMessagePreview/normalizeMessagePreview.spec.tsapps/meteor/client/lib/utils/normalizeMessagePreview/normalizeMessagePreview.tsapps/meteor/client/views/room/MessageList/hooks/useMessageBody.tsxapps/meteor/client/views/room/contextualBar/ExportMessages/useDownloadExportMutation.tsapps/meteor/client/views/room/contextualBar/ExportMessages/useExportMessagesAsPDFMutation.tsxapps/meteor/client/views/room/contextualBar/Threads/hooks/useNormalizedThreadTitleHtml.tsapps/meteor/server/features/EmailInbox/EmailInbox_Outgoing.tsee/packages/omnichannel-services/src/OmnichannelTranscript.ts
💤 Files with no reviewable changes (7)
- apps/meteor/client/views/room/contextualBar/ExportMessages/useDownloadExportMutation.ts
- apps/meteor/app/lib/server/lib/sendNotificationsOnMessage.ts
- apps/meteor/app/apps/server/converters/messages.js
- apps/meteor/app/livechat/server/lib/sendTranscript.ts
- apps/meteor/app/slackbridge/server/RocketAdapter.ts
- apps/meteor/client/views/room/contextualBar/ExportMessages/useExportMessagesAsPDFMutation.tsx
- apps/meteor/app/autotranslate/client/lib/autotranslate.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- apps/meteor/client/lib/parseMessageTextToAstMarkdown.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: 📦 Build Packages
- GitHub Check: cubic · AI code reviewer
- GitHub Check: CodeQL-Build
- GitHub Check: CodeQL-Build
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{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/app/autotranslate/server/msTranslate.tsapps/meteor/client/lib/normalizeThreadMessage.tsxapps/meteor/app/ui/client/lib/ChatMessages.tsee/packages/omnichannel-services/src/OmnichannelTranscript.tsapps/meteor/app/autotranslate/server/autotranslate.tsapps/meteor/client/views/room/contextualBar/Threads/hooks/useNormalizedThreadTitleHtml.tsapps/meteor/app/autotranslate/server/deeplTranslate.tsapps/meteor/app/lib/server/functions/notifications/email.jsapps/meteor/server/features/EmailInbox/EmailInbox_Outgoing.tsapps/meteor/client/hooks/useDecryptedMessage.spec.tsapps/meteor/client/lib/parseMessageTextToAstMarkdown.spec.tsapps/meteor/client/hooks/useDecryptedMessage.tsapps/meteor/client/views/room/MessageList/hooks/useMessageBody.tsxapps/meteor/app/lib/server/methods/updateMessage.tsapps/meteor/client/lib/utils/normalizeMessagePreview/normalizeMessagePreview.spec.tsapps/meteor/app/autotranslate/server/googleTranslate.tsapps/meteor/client/lib/utils/normalizeMessagePreview/normalizeMessagePreview.ts
**/*.spec.ts
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
**/*.spec.ts: Use descriptive test names that clearly communicate expected behavior in Playwright tests
Use.spec.tsextension for test files (e.g.,login.spec.ts)
Files:
apps/meteor/client/hooks/useDecryptedMessage.spec.tsapps/meteor/client/lib/parseMessageTextToAstMarkdown.spec.tsapps/meteor/client/lib/utils/normalizeMessagePreview/normalizeMessagePreview.spec.ts
🧠 Learnings (29)
📓 Common learnings
Learnt from: ggazzo
Repo: RocketChat/Rocket.Chat PR: 35995
File: apps/meteor/app/api/server/v1/rooms.ts:1107-1112
Timestamp: 2026-02-23T17:53:18.785Z
Learning: In Rocket.Chat PR reviews, maintain strict scope boundaries—when a PR is focused on a specific endpoint (e.g., rooms.favorite), avoid reviewing or suggesting changes to other endpoints that were incidentally refactored (e.g., rooms.invite) unless explicitly requested by maintainers.
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/page-objects/fragments/home-content.ts:60-82
Timestamp: 2026-02-24T19:36:55.089Z
Learning: In RocketChat/Rocket.Chat e2e tests (apps/meteor/tests/e2e/page-objects/fragments/home-content.ts), thread message preview listitems do not have aria-roledescription="message", so lastThreadMessagePreview locator cannot be scoped to messageListItems (which filters for aria-roledescription="message"). It should remain scoped to page.getByRole('listitem') or mainMessageList.getByRole('listitem').
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 39230
File: apps/meteor/app/api/server/v1/chat.ts:214-222
Timestamp: 2026-03-03T11:11:48.541Z
Learning: In apps/meteor/server/lib/moderation/reportMessage.ts, the reportMessage function validates that description is not empty or whitespace-only with `if (!description.trim())`. When migrating the chat.reportMessage endpoint to OpenAPI, adding minLength validation to the schema preserves this existing behavior.
📚 Learning: 2026-03-03T11:11:48.541Z
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 39230
File: apps/meteor/app/api/server/v1/chat.ts:214-222
Timestamp: 2026-03-03T11:11:48.541Z
Learning: In apps/meteor/server/lib/moderation/reportMessage.ts, the reportMessage function validates that description is not empty or whitespace-only with `if (!description.trim())`. When migrating the chat.reportMessage endpoint to OpenAPI, adding minLength validation to the schema preserves this existing behavior.
Applied to files:
apps/meteor/app/autotranslate/server/msTranslate.tsapps/meteor/client/lib/normalizeThreadMessage.tsxapps/meteor/app/ui/client/lib/ChatMessages.tsee/packages/omnichannel-services/src/OmnichannelTranscript.tsapps/meteor/app/autotranslate/server/autotranslate.tsapps/meteor/app/autotranslate/server/deeplTranslate.tsapps/meteor/client/lib/parseMessageTextToAstMarkdown.spec.tsapps/meteor/client/hooks/useDecryptedMessage.tsapps/meteor/client/views/room/MessageList/hooks/useMessageBody.tsxapps/meteor/app/lib/server/methods/updateMessage.tsapps/meteor/client/lib/utils/normalizeMessagePreview/normalizeMessagePreview.spec.tsapps/meteor/app/autotranslate/server/googleTranslate.tsapps/meteor/client/lib/utils/normalizeMessagePreview/normalizeMessagePreview.ts
📚 Learning: 2026-03-20T13:51:23.302Z
Learnt from: ggazzo
Repo: RocketChat/Rocket.Chat PR: 39553
File: apps/meteor/app/integrations/server/methods/incoming/updateIncomingIntegration.ts:179-181
Timestamp: 2026-03-20T13:51:23.302Z
Learning: In `apps/meteor/app/integrations/server/methods/incoming/updateIncomingIntegration.ts`, the truthiness guards `...(integration.avatar && { avatar })`, `...(integration.emoji && { emoji })`, `...(integration.alias && { alias })`, and `...(integration.script && { script })` in the `$set` payload of `updateIncomingIntegration` are intentional. Empty-string values for these fields should NOT overwrite the stored value — only truthy values are persisted. Do not flag these as bugs preventing explicit clears.
Applied to files:
apps/meteor/app/autotranslate/server/msTranslate.tsapps/meteor/client/lib/normalizeThreadMessage.tsxapps/meteor/app/autotranslate/server/autotranslate.tsapps/meteor/app/autotranslate/server/deeplTranslate.tsapps/meteor/server/features/EmailInbox/EmailInbox_Outgoing.tsapps/meteor/client/lib/parseMessageTextToAstMarkdown.spec.tsapps/meteor/client/views/room/MessageList/hooks/useMessageBody.tsxapps/meteor/app/lib/server/methods/updateMessage.tsapps/meteor/client/lib/utils/normalizeMessagePreview/normalizeMessagePreview.spec.ts
📚 Learning: 2026-01-17T01:51:47.764Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 38219
File: packages/core-typings/src/cloud/Announcement.ts:5-6
Timestamp: 2026-01-17T01:51:47.764Z
Learning: In packages/core-typings/src/cloud/Announcement.ts, the AnnouncementSchema.createdBy field intentionally overrides IBannerSchema.createdBy (object with _id and optional username) with a string enum ['cloud', 'system'] to match existing runtime behavior. This is documented as technical debt with a FIXME comment at apps/meteor/app/cloud/server/functions/syncWorkspace/handleCommsSync.ts:53 and should not be flagged as an error until the runtime behavior is corrected.
Applied to files:
apps/meteor/app/autotranslate/server/msTranslate.tsapps/meteor/client/lib/normalizeThreadMessage.tsxapps/meteor/app/ui/client/lib/ChatMessages.tsapps/meteor/client/views/room/contextualBar/Threads/hooks/useNormalizedThreadTitleHtml.tsapps/meteor/app/lib/server/functions/notifications/email.jsapps/meteor/client/lib/parseMessageTextToAstMarkdown.spec.tsapps/meteor/app/lib/server/methods/updateMessage.tsapps/meteor/app/autotranslate/server/googleTranslate.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 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/app/autotranslate/server/msTranslate.tsapps/meteor/app/ui/client/lib/ChatMessages.tsee/packages/omnichannel-services/src/OmnichannelTranscript.tsapps/meteor/app/autotranslate/server/autotranslate.tsapps/meteor/client/views/room/contextualBar/Threads/hooks/useNormalizedThreadTitleHtml.tsapps/meteor/app/autotranslate/server/deeplTranslate.tsapps/meteor/server/features/EmailInbox/EmailInbox_Outgoing.tsapps/meteor/client/hooks/useDecryptedMessage.spec.tsapps/meteor/client/lib/parseMessageTextToAstMarkdown.spec.tsapps/meteor/client/hooks/useDecryptedMessage.tsapps/meteor/app/lib/server/methods/updateMessage.tsapps/meteor/client/lib/utils/normalizeMessagePreview/normalizeMessagePreview.spec.tsapps/meteor/app/autotranslate/server/googleTranslate.tsapps/meteor/client/lib/utils/normalizeMessagePreview/normalizeMessagePreview.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/app/autotranslate/server/msTranslate.tsapps/meteor/app/ui/client/lib/ChatMessages.tsee/packages/omnichannel-services/src/OmnichannelTranscript.tsapps/meteor/app/autotranslate/server/autotranslate.tsapps/meteor/client/views/room/contextualBar/Threads/hooks/useNormalizedThreadTitleHtml.tsapps/meteor/app/autotranslate/server/deeplTranslate.tsapps/meteor/server/features/EmailInbox/EmailInbox_Outgoing.tsapps/meteor/client/hooks/useDecryptedMessage.spec.tsapps/meteor/client/lib/parseMessageTextToAstMarkdown.spec.tsapps/meteor/client/hooks/useDecryptedMessage.tsapps/meteor/app/lib/server/methods/updateMessage.tsapps/meteor/client/lib/utils/normalizeMessagePreview/normalizeMessagePreview.spec.tsapps/meteor/app/autotranslate/server/googleTranslate.tsapps/meteor/client/lib/utils/normalizeMessagePreview/normalizeMessagePreview.ts
📚 Learning: 2026-02-24T19:36:55.089Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/page-objects/fragments/home-content.ts:60-82
Timestamp: 2026-02-24T19:36:55.089Z
Learning: In RocketChat/Rocket.Chat e2e tests (apps/meteor/tests/e2e/page-objects/fragments/home-content.ts), thread message preview listitems do not have aria-roledescription="message", so lastThreadMessagePreview locator cannot be scoped to messageListItems (which filters for aria-roledescription="message"). It should remain scoped to page.getByRole('listitem') or mainMessageList.getByRole('listitem').
Applied to files:
apps/meteor/client/lib/normalizeThreadMessage.tsxapps/meteor/app/ui/client/lib/ChatMessages.tsapps/meteor/client/views/room/contextualBar/Threads/hooks/useNormalizedThreadTitleHtml.tsapps/meteor/client/hooks/useDecryptedMessage.spec.tsapps/meteor/client/lib/parseMessageTextToAstMarkdown.spec.tsapps/meteor/client/views/room/MessageList/hooks/useMessageBody.tsxapps/meteor/app/lib/server/methods/updateMessage.tsapps/meteor/client/lib/utils/normalizeMessagePreview/normalizeMessagePreview.spec.tsapps/meteor/client/lib/utils/normalizeMessagePreview/normalizeMessagePreview.ts
📚 Learning: 2026-03-11T18:17:53.972Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 39425
File: apps/meteor/client/lib/chats/flows/processMessageUploads.ts:112-119
Timestamp: 2026-03-11T18:17:53.972Z
Learning: In `apps/meteor/client/lib/chats/flows/processMessageUploads.ts`, when sending multiple file uploads, each file is confirmed via its own `/rooms.mediaConfirm/${rid}/${fileId}` call and produces a separate message. Only the first file's confirm payload carries the composed message text (`msg`); all subsequent files receive `msg: ''`. This one-message-per-file behavior is intentional by design — do not flag it as a bug or suggest batching into a single message.
Applied to files:
apps/meteor/client/lib/normalizeThreadMessage.tsxapps/meteor/app/ui/client/lib/ChatMessages.tsee/packages/omnichannel-services/src/OmnichannelTranscript.tsapps/meteor/app/autotranslate/server/autotranslate.tsapps/meteor/app/lib/server/functions/notifications/email.jsapps/meteor/server/features/EmailInbox/EmailInbox_Outgoing.tsapps/meteor/client/views/room/MessageList/hooks/useMessageBody.tsxapps/meteor/app/lib/server/methods/updateMessage.tsapps/meteor/client/lib/utils/normalizeMessagePreview/normalizeMessagePreview.ts
📚 Learning: 2026-03-11T22:04:20.529Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 39545
File: apps/meteor/client/views/room/body/hooks/useHasNewMessages.ts:59-61
Timestamp: 2026-03-11T22:04:20.529Z
Learning: In `apps/meteor/client/views/room/body/hooks/useHasNewMessages.ts`, the `msg.u._id === uid` early-return in the `streamNewMessage` handler is intentional: the "New messages" indicator is designed to notify about messages from other users only. Self-sent messages — including those sent from a different session/device — are always skipped, by design. Do not flag this as a multi-session regression.
Applied to files:
apps/meteor/client/lib/normalizeThreadMessage.tsxapps/meteor/app/ui/client/lib/ChatMessages.tsapps/meteor/client/views/room/contextualBar/Threads/hooks/useNormalizedThreadTitleHtml.tsapps/meteor/app/lib/server/functions/notifications/email.jsapps/meteor/client/hooks/useDecryptedMessage.spec.tsapps/meteor/client/hooks/useDecryptedMessage.tsapps/meteor/client/views/room/MessageList/hooks/useMessageBody.tsxapps/meteor/app/lib/server/methods/updateMessage.tsapps/meteor/client/lib/utils/normalizeMessagePreview/normalizeMessagePreview.ts
📚 Learning: 2026-03-11T18:15:53.272Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 39425
File: apps/meteor/app/api/server/v1/rooms.ts:294-296
Timestamp: 2026-03-11T18:15:53.272Z
Learning: In Rocket.Chat's `rooms.mediaConfirm/:rid/:fileId` endpoint (apps/meteor/app/api/server/v1/rooms.ts), updating `file.name` from `bodyParams.fileName` without updating `file.path` is intentionally safe. The file path is keyed by `_id` (not by filename), so the stored path remains valid regardless of a rename. `file.name` only affects the display name in the message attachment; do not flag this as a path-divergence issue.
Applied to files:
apps/meteor/client/lib/normalizeThreadMessage.tsxapps/meteor/client/views/room/contextualBar/Threads/hooks/useNormalizedThreadTitleHtml.tsapps/meteor/app/lib/server/functions/notifications/email.jsapps/meteor/client/views/room/MessageList/hooks/useMessageBody.tsxapps/meteor/app/lib/server/methods/updateMessage.ts
📚 Learning: 2026-03-12T17:12:49.121Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 39425
File: apps/meteor/client/lib/chats/flows/uploadFiles.ts:28-33
Timestamp: 2026-03-12T17:12:49.121Z
Learning: Rocket.Chat — apps/meteor/client/lib/chats/flows/uploadFiles.ts: When E2E_Enable_Encrypt_Files is disabled, plaintext file uploads are allowed in E2E rooms; this fallback is expected and should not be flagged as a security regression.
Applied to files:
apps/meteor/client/lib/normalizeThreadMessage.tsxapps/meteor/app/lib/server/functions/notifications/email.jsapps/meteor/client/hooks/useDecryptedMessage.spec.tsapps/meteor/client/hooks/useDecryptedMessage.ts
📚 Learning: 2026-03-27T14:52:56.865Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 39892
File: apps/meteor/client/views/room/contextualBar/Threads/Thread.tsx:150-155
Timestamp: 2026-03-27T14:52:56.865Z
Learning: In Rocket.Chat, there are two different `ModalBackdrop` components with different prop APIs. During review, confirm the import source: (1) `rocket.chat/fuselage` `ModalBackdrop` uses `ModalBackdropProps` based on `BoxProps` (so it supports `onClick` and other Box/DOM props) and does not have an `onDismiss` prop; (2) `rocket.chat/ui-client` `ModalBackdrop` uses a narrower props interface like `{ children?: ReactNode; onDismiss?: () => void }` and handles Escape keypress and outside mouse-up, and it does not forward arbitrary DOM props such as `onClick`. Flag mismatched props (e.g., `onDismiss` passed to the fuselage component or `onClick` passed to the ui-client component) and ensure the usage matches the correct component being imported.
Applied to files:
apps/meteor/client/lib/normalizeThreadMessage.tsxapps/meteor/client/views/room/MessageList/hooks/useMessageBody.tsx
📚 Learning: 2026-02-24T19:16:35.307Z
Learnt from: sampaiodiego
Repo: RocketChat/Rocket.Chat PR: 39003
File: apps/meteor/client/lib/chats/flows/sendMessage.ts:39-45
Timestamp: 2026-02-24T19:16:35.307Z
Learning: In apps/meteor/client/lib/chats/flows/sendMessage.ts, when sdk.call('sendMessage', ...) throws an error, the message is intentionally left with temp: true (not deleted or cleaned up) to support a future retry UI feature. This allows users to retry sending failed messages rather than losing them.
Applied to files:
apps/meteor/app/ui/client/lib/ChatMessages.ts
📚 Learning: 2026-02-25T20:10:16.987Z
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 38913
File: packages/ddp-client/src/legacy/types/SDKLegacy.ts:34-34
Timestamp: 2026-02-25T20:10:16.987Z
Learning: In the RocketChat/Rocket.Chat monorepo, packages/ddp-client and apps/meteor do not use TypeScript project references. Module augmentations in apps/meteor (e.g., declare module 'rocket.chat/rest-typings') are not visible when compiling packages/ddp-client in isolation, which is why legacy SDK methods that depend on OperationResult types for OpenAPI-migrated endpoints must remain commented out.
Applied to files:
apps/meteor/app/ui/client/lib/ChatMessages.ts
📚 Learning: 2025-11-19T18:20:07.720Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 37419
File: packages/i18n/src/locales/en.i18n.json:918-921
Timestamp: 2025-11-19T18:20:07.720Z
Learning: Repo: RocketChat/Rocket.Chat — i18n/formatting
Learning: This repository uses a custom message formatting parser in UI blocks/messages; do not assume standard Markdown rules. For keys like Call_ended_bold, Call_not_answered_bold, Call_failed_bold, and Call_transferred_bold in packages/i18n/src/locales/en.i18n.json, retain the existing single-asterisk emphasis unless maintainers request otherwise.
Applied to files:
apps/meteor/app/ui/client/lib/ChatMessages.tsapps/meteor/client/lib/parseMessageTextToAstMarkdown.spec.ts
📚 Learning: 2025-11-19T12:32:29.696Z
Learnt from: d-gubert
Repo: RocketChat/Rocket.Chat PR: 37547
File: packages/i18n/src/locales/en.i18n.json:634-634
Timestamp: 2025-11-19T12:32:29.696Z
Learning: Repo: RocketChat/Rocket.Chat
Context: i18n workflow
Learning: In this repository, new translation keys should be added to packages/i18n/src/locales/en.i18n.json only; other locale files are populated via the external translation pipeline and/or fall back to English. Do not request adding the same key to all locale files in future reviews.
Applied to files:
apps/meteor/app/autotranslate/server/autotranslate.ts
📚 Learning: 2026-02-10T16:32:42.586Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 38528
File: apps/meteor/client/startup/roles.ts:14-14
Timestamp: 2026-02-10T16:32:42.586Z
Learning: In Rocket.Chat's Meteor client code, DDP streams use EJSON and Date fields arrive as Date objects; do not manually construct new Date() in stream handlers (for example, in sdk.stream()). Only REST API responses return plain JSON where dates are strings, so implement explicit conversion there if needed. Apply this guidance to all TypeScript files under apps/meteor/client to ensure consistent date handling in DDP streams and REST responses.
Applied to files:
apps/meteor/client/views/room/contextualBar/Threads/hooks/useNormalizedThreadTitleHtml.tsapps/meteor/client/hooks/useDecryptedMessage.spec.tsapps/meteor/client/lib/parseMessageTextToAstMarkdown.spec.tsapps/meteor/client/hooks/useDecryptedMessage.tsapps/meteor/client/lib/utils/normalizeMessagePreview/normalizeMessagePreview.spec.tsapps/meteor/client/lib/utils/normalizeMessagePreview/normalizeMessagePreview.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `expect` matchers for assertions (`toEqual`, `toContain`, `toBeTruthy`, `toHaveLength`, etc.) instead of `assert` statements in Playwright tests
Applied to files:
apps/meteor/client/hooks/useDecryptedMessage.spec.tsapps/meteor/client/lib/parseMessageTextToAstMarkdown.spec.tsapps/meteor/client/lib/utils/normalizeMessagePreview/normalizeMessagePreview.spec.ts
📚 Learning: 2026-02-12T15:39:28.416Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 32703
File: apps/meteor/client/lib/chats/flows/uploadFiles.ts:52-58
Timestamp: 2026-02-12T15:39:28.416Z
Learning: In `apps/meteor/client/lib/chats/flows/uploadFiles.ts`, when E2E encryption is required but not allowed (e.g., `E2E_Enable_Encrypt_Files` setting is disabled), the function intentionally abandons the entire upload queue and displays a toast error. This fail-fast behavior prevents partial uploads when encryption requirements cannot be met and is the expected behavior, not a bug.
Applied to files:
apps/meteor/client/hooks/useDecryptedMessage.spec.tsapps/meteor/client/hooks/useDecryptedMessage.ts
📚 Learning: 2025-12-10T21:00:54.909Z
Learnt from: KevLehman
Repo: RocketChat/Rocket.Chat PR: 37091
File: ee/packages/abac/jest.config.ts:4-7
Timestamp: 2025-12-10T21:00:54.909Z
Learning: Rocket.Chat monorepo: Jest testMatch pattern '<rootDir>/src/**/*.spec.(ts|js|mjs)' is valid in this repo and used across multiple packages (e.g., packages/tools, ee/packages/omnichannel-services). Do not flag it as invalid in future reviews.
Applied to files:
apps/meteor/client/hooks/useDecryptedMessage.spec.tsapps/meteor/client/lib/parseMessageTextToAstMarkdown.spec.tsapps/meteor/client/lib/utils/normalizeMessagePreview/normalizeMessagePreview.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Utilize Playwright fixtures (`test`, `page`, `expect`) for consistency in test files
Applied to files:
apps/meteor/client/hooks/useDecryptedMessage.spec.tsapps/meteor/client/lib/parseMessageTextToAstMarkdown.spec.tsapps/meteor/client/lib/utils/normalizeMessagePreview/normalizeMessagePreview.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Ensure tests run reliably in parallel without shared state conflicts
Applied to files:
apps/meteor/client/hooks/useDecryptedMessage.spec.tsapps/meteor/client/lib/parseMessageTextToAstMarkdown.spec.tsapps/meteor/client/lib/utils/normalizeMessagePreview/normalizeMessagePreview.spec.ts
📚 Learning: 2026-03-14T14:58:58.834Z
Learnt from: smirk-dev
Repo: RocketChat/Rocket.Chat PR: 39625
File: apps/meteor/app/api/server/v1/push.ts:85-97
Timestamp: 2026-03-14T14:58:58.834Z
Learning: In RocketChat/Rocket.Chat, the `push.token` POST/DELETE endpoints in `apps/meteor/app/api/server/v1/push.ts` were already migrated to the chained router API pattern on `develop` prior to PR `#39625`. `cleanTokenResult` (which strips `authToken` and returns `PushTokenResult`) and `isPushTokenPOSTProps`/`isPushTokenDELETEProps` validators already exist on `develop`. PR `#39625` only migrates `push.get` and `push.info` to the chained pattern. Do not flag `cleanTokenResult` or `PushTokenResult` as newly introduced behavior-breaking changes when reviewing this PR.
Applied to files:
apps/meteor/client/hooks/useDecryptedMessage.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : All test files must be created in `apps/meteor/tests/e2e/` directory
Applied to files:
apps/meteor/client/hooks/useDecryptedMessage.spec.ts
📚 Learning: 2026-02-24T19:22:48.358Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/omnichannel/omnichannel-send-pdf-transcript.spec.ts:66-67
Timestamp: 2026-02-24T19:22:48.358Z
Learning: In Playwright end-to-end tests (e.g., under apps/meteor/tests/e2e/...), prefer locating elements by translated text (getByText) and ARIA roles (getByRole) over data-qa attributes. If translation values change, update the corresponding test locators accordingly. Never use data-qa locators. This guideline applies to all Playwright e2e test specs in the repository and helps keep tests robust to UI text changes and accessible semantics.
Applied to files:
apps/meteor/client/hooks/useDecryptedMessage.spec.tsapps/meteor/client/lib/parseMessageTextToAstMarkdown.spec.tsapps/meteor/client/lib/utils/normalizeMessagePreview/normalizeMessagePreview.spec.ts
📚 Learning: 2026-03-06T18:10:15.268Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 39397
File: packages/gazzodown/src/code/CodeBlock.spec.tsx:47-68
Timestamp: 2026-03-06T18:10:15.268Z
Learning: In tests (especially those using testing-library/dom/jsdom) for Rocket.Chat components, the HTML <code> element has an implicit ARIA role of 'code'. Therefore, screen.getByRole('code') or screen.findByRole('code') will locate <code> elements even without a role attribute. Do not flag findByRole('code') as invalid in reviews; prefer using the implicit role instead of adding role="code" unless necessary for accessibility.
Applied to files:
apps/meteor/client/hooks/useDecryptedMessage.spec.tsapps/meteor/client/lib/parseMessageTextToAstMarkdown.spec.tsapps/meteor/client/lib/utils/normalizeMessagePreview/normalizeMessagePreview.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Prefer web-first assertions (`toBeVisible`, `toHaveText`, etc.) in Playwright tests
Applied to files:
apps/meteor/client/lib/parseMessageTextToAstMarkdown.spec.tsapps/meteor/client/lib/utils/normalizeMessagePreview/normalizeMessagePreview.spec.ts
📚 Learning: 2026-02-24T19:09:09.561Z
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 38974
File: apps/meteor/app/api/server/v1/im.ts:220-221
Timestamp: 2026-02-24T19:09:09.561Z
Learning: In RocketChat/Rocket.Chat OpenAPI migration PRs for apps/meteor/app/api/server/v1 endpoints, maintainers prefer to avoid any logic changes; style-only cleanups (like removing inline comments) may be deferred to follow-ups to keep scope tight.
Applied to files:
apps/meteor/app/lib/server/methods/updateMessage.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to **/*.spec.ts : Use descriptive test names that clearly communicate expected behavior in Playwright tests
Applied to files:
apps/meteor/client/lib/utils/normalizeMessagePreview/normalizeMessagePreview.spec.ts
🔇 Additional comments (20)
apps/meteor/app/lib/server/functions/notifications/email.js (1)
80-81: Good cleanup: file email body now correctly renders only file names.This aligns with the removal of
descriptionMd/description-based file rendering and keeps output safely escaped viaescapeHTML.apps/meteor/client/hooks/useDecryptedMessage.ts (1)
21-22: Attachment fallback is correctly decoupled from description fields.Good change: the fallback now consistently uses
Message_with_attachmentwhen decrypted text is empty but attachments exist, matching the new behavior and avoiding dependency on attachment description content.apps/meteor/client/hooks/useDecryptedMessage.spec.ts (1)
53-64: Test expectations now correctly reflect generic attachment fallback behavior.The updated mock/assertion correctly verifies that attachment-only decrypted payloads resolve to
Message_with_attachment, without relying on removed description-based fields.apps/meteor/app/ui/client/lib/ChatMessages.ts (1)
123-123: Looks good: edit prefill now correctly avoids attachment description fallback.Line 123 aligns with this PR’s intent by restricting edit prefill to draft text or
message.msg, so attachment description/alt-text content is no longer pulled into the composer.apps/meteor/app/autotranslate/server/msTranslate.ts (1)
195-195: Text-only attachment translation input looks correct.Line 195 correctly aligns this provider with the new text-only attachment translation behavior.
apps/meteor/app/autotranslate/server/deeplTranslate.ts (1)
199-199: DeepL request payload update is consistent and safe.Line 199 correctly keeps attachment translation sourced from
attachment.textonly.apps/meteor/app/autotranslate/server/googleTranslate.ts (1)
198-198: Google attachment translation input change is good.Line 198 correctly removes description fallback and keeps translation input scoped to
attachment.text.apps/meteor/app/autotranslate/server/autotranslate.ts (1)
323-323: Attachment translation gating update is correct.Line 323 appropriately restricts attachment translation to entries with
attachment.text, matching the new behavior.apps/meteor/client/lib/normalizeThreadMessage.tsx (1)
27-33: LGTM!The attachment selection logic now correctly uses only
titlefor finding a displayable attachment, aligning with the PR's objective to removedescriptionfrom rendering paths. The pattern is consistent with other files in this PR (e.g.,useMessageBody.tsx,useNormalizedThreadTitleHtml.ts).apps/meteor/client/views/room/contextualBar/Threads/hooks/useNormalizedThreadTitleHtml.ts (1)
35-41: LGTM!The attachment selection logic is updated to use only
title, with proper HTML escaping applied viaescapeHTML(). This is consistent with the PR's objective and matches the pattern used across other normalization utilities.apps/meteor/app/lib/server/methods/updateMessage.ts (1)
37-40: LGTM!The early-return comparison is simplified to only check
originalMessage.msgagainstmessage.msg, removing the previous fallback toattachments[0]?.description. This aligns with the PR's objective to stop treating attachmentdescriptionas editable message content.ee/packages/omnichannel-services/src/OmnichannelTranscript.ts (1)
315-324: LGTM!The transcript message data now correctly uses only
message.msg(defaulting to empty string) instead of falling back to attachmentdescription. File attachments are still included via thefilesarray, so file uploads will continue to appear in transcripts with their names/images.apps/meteor/server/features/EmailInbox/EmailInbox_Outgoing.ts (1)
145-145: LGTM!The email body text now correctly uses only
message?.msginstead of concatenating attachment descriptions. File attachments are still included viavalidAttachments, ensuring files are properly sent with the email.apps/meteor/client/views/room/MessageList/hooks/useMessageBody.tsx (1)
33-39: LGTM!The attachment selection logic is updated to use only
title, consistent with the pattern applied across all message body/preview normalization utilities in this PR.apps/meteor/client/lib/utils/normalizeMessagePreview/normalizeMessagePreview.ts (1)
13-21: LGTM!The attachment selection logic correctly uses only
titlewith proper HTML escaping, and appropriately falls back to the translated'Sent_an_attachment'message when no titled attachment is found.apps/meteor/client/lib/utils/normalizeMessagePreview/normalizeMessagePreview.spec.ts (2)
50-78: LGTM!Tests are correctly updated to reflect the new behavior where only
titleis used for attachment preview selection. The test names clearly communicate the expected behavior.
151-169: LGTM!The edge case test correctly verifies that when attachments exist but none have a
title, the function returns the translated'Sent_an_attachment'fallback.apps/meteor/client/lib/parseMessageTextToAstMarkdown.spec.ts (3)
185-208:attachment.texttranslation assertions are correctly aligned.This update matches the parser behavior and correctly validates translated
mdgeneration fromattachment.text.
381-383: Attachment fixture source field migration looks correct.Switching the fixture payload to
textis consistent with current attachment parsing inputs.
431-459: UndefinedautoTranslateLanguagefallback coverage is good.This test clearly validates fallback to non-translated
attachment.textwhen no language is provided.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/meteor/app/slackbridge/server/RocketAdapter.ts (1)
206-214:⚠️ Potential issue | 🟡 MinorAvoid sending
"undefined"or leading-space text in file-share Slack messages.
Line 213currently interpolatesrocketMessage.msgdirectly. When it is missing/empty, Slack can receive"undefined <file>"or" <file>". Composemsgfrom non-empty parts.Proposed fix
- const text = rocketMessage.msg; + const text = rocketMessage.msg?.trim(); const attachment = this.getMessageAttachment(rocketMessage); if (attachment) { fileName = Meteor.absoluteUrl(attachment.title_link); } - await slack.postMessage(slack.getSlackChannel(rocketMessage.rid), { ...rocketMessage, msg: `${text} ${fileName}` }); + const msg = [text, fileName].filter(Boolean).join(' '); + await slack.postMessage(slack.getSlackChannel(rocketMessage.rid), { ...rocketMessage, msg });🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/meteor/app/slackbridge/server/RocketAdapter.ts` around lines 206 - 214, The current send composes msg by interpolating rocketMessage.msg and fileName which can produce "undefined <file>" or a leading space; update the logic in RocketAdapter (where getMessageAttachment, slack.getSlackChannel and slack.postMessage are used) to build msg from non-empty parts only: compute text = rocketMessage.msg || '' and fileName as before, then create msg by joining [text, fileName].filter(Boolean).join(' ') (or equivalent) and trim the result before passing it to slack.postMessage so no "undefined" or extra spaces are sent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@apps/meteor/app/slackbridge/server/RocketAdapter.ts`:
- Around line 206-214: The current send composes msg by interpolating
rocketMessage.msg and fileName which can produce "undefined <file>" or a leading
space; update the logic in RocketAdapter (where getMessageAttachment,
slack.getSlackChannel and slack.postMessage are used) to build msg from
non-empty parts only: compute text = rocketMessage.msg || '' and fileName as
before, then create msg by joining [text, fileName].filter(Boolean).join(' ')
(or equivalent) and trim the result before passing it to slack.postMessage so no
"undefined" or extra spaces are sent.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: edea23f8-2745-4980-b682-588c615df788
📒 Files selected for processing (3)
apps/meteor/app/livechat/server/lib/sendTranscript.tsapps/meteor/app/slackbridge/server/RocketAdapter.tsapps/meteor/client/lib/parseMessageTextToAstMarkdown.spec.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- apps/meteor/app/livechat/server/lib/sendTranscript.ts
- apps/meteor/client/lib/parseMessageTextToAstMarkdown.spec.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: 📦 Build Packages
- GitHub Check: cubic · AI code reviewer
- 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:
apps/meteor/app/slackbridge/server/RocketAdapter.ts
🧠 Learnings (12)
📚 Learning: 2026-03-11T18:15:53.272Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 39425
File: apps/meteor/app/api/server/v1/rooms.ts:294-296
Timestamp: 2026-03-11T18:15:53.272Z
Learning: In Rocket.Chat's `rooms.mediaConfirm/:rid/:fileId` endpoint (apps/meteor/app/api/server/v1/rooms.ts), updating `file.name` from `bodyParams.fileName` without updating `file.path` is intentionally safe. The file path is keyed by `_id` (not by filename), so the stored path remains valid regardless of a rename. `file.name` only affects the display name in the message attachment; do not flag this as a path-divergence issue.
Applied to files:
apps/meteor/app/slackbridge/server/RocketAdapter.ts
📚 Learning: 2026-02-24T19:09:09.561Z
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 38974
File: apps/meteor/app/api/server/v1/im.ts:220-221
Timestamp: 2026-02-24T19:09:09.561Z
Learning: In RocketChat/Rocket.Chat OpenAPI migration PRs for apps/meteor/app/api/server/v1 endpoints, maintainers prefer to avoid any logic changes; style-only cleanups (like removing inline comments) may be deferred to follow-ups to keep scope tight.
Applied to files:
apps/meteor/app/slackbridge/server/RocketAdapter.ts
📚 Learning: 2026-03-11T18:17:53.972Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 39425
File: apps/meteor/client/lib/chats/flows/processMessageUploads.ts:112-119
Timestamp: 2026-03-11T18:17:53.972Z
Learning: In `apps/meteor/client/lib/chats/flows/processMessageUploads.ts`, when sending multiple file uploads, each file is confirmed via its own `/rooms.mediaConfirm/${rid}/${fileId}` call and produces a separate message. Only the first file's confirm payload carries the composed message text (`msg`); all subsequent files receive `msg: ''`. This one-message-per-file behavior is intentional by design — do not flag it as a bug or suggest batching into a single message.
Applied to files:
apps/meteor/app/slackbridge/server/RocketAdapter.ts
📚 Learning: 2026-01-17T01:51:47.764Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 38219
File: packages/core-typings/src/cloud/Announcement.ts:5-6
Timestamp: 2026-01-17T01:51:47.764Z
Learning: In packages/core-typings/src/cloud/Announcement.ts, the AnnouncementSchema.createdBy field intentionally overrides IBannerSchema.createdBy (object with _id and optional username) with a string enum ['cloud', 'system'] to match existing runtime behavior. This is documented as technical debt with a FIXME comment at apps/meteor/app/cloud/server/functions/syncWorkspace/handleCommsSync.ts:53 and should not be flagged as an error until the runtime behavior is corrected.
Applied to files:
apps/meteor/app/slackbridge/server/RocketAdapter.ts
📚 Learning: 2026-02-25T20:10:16.987Z
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 38913
File: packages/ddp-client/src/legacy/types/SDKLegacy.ts:34-34
Timestamp: 2026-02-25T20:10:16.987Z
Learning: In the RocketChat/Rocket.Chat monorepo, packages/ddp-client and apps/meteor do not use TypeScript project references. Module augmentations in apps/meteor (e.g., declare module 'rocket.chat/rest-typings') are not visible when compiling packages/ddp-client in isolation, which is why legacy SDK methods that depend on OperationResult types for OpenAPI-migrated endpoints must remain commented out.
Applied to files:
apps/meteor/app/slackbridge/server/RocketAdapter.ts
📚 Learning: 2025-09-19T15:15:04.642Z
Learnt from: rodrigok
Repo: RocketChat/Rocket.Chat PR: 36991
File: apps/meteor/server/services/federation/infrastructure/rocket-chat/adapters/Settings.ts:219-221
Timestamp: 2025-09-19T15:15:04.642Z
Learning: The Federation_Matrix_homeserver_domain setting in apps/meteor/server/services/federation/infrastructure/rocket-chat/adapters/Settings.ts is part of the old federation system and is being deprecated/removed, so configuration issues with this setting should not be flagged for improvement.
Applied to files:
apps/meteor/app/slackbridge/server/RocketAdapter.ts
📚 Learning: 2026-02-24T19:36:55.089Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/page-objects/fragments/home-content.ts:60-82
Timestamp: 2026-02-24T19:36:55.089Z
Learning: In RocketChat/Rocket.Chat e2e tests (apps/meteor/tests/e2e/page-objects/fragments/home-content.ts), thread message preview listitems do not have aria-roledescription="message", so lastThreadMessagePreview locator cannot be scoped to messageListItems (which filters for aria-roledescription="message"). It should remain scoped to page.getByRole('listitem') or mainMessageList.getByRole('listitem').
Applied to files:
apps/meteor/app/slackbridge/server/RocketAdapter.ts
📚 Learning: 2026-03-20T13:51:23.302Z
Learnt from: ggazzo
Repo: RocketChat/Rocket.Chat PR: 39553
File: apps/meteor/app/integrations/server/methods/incoming/updateIncomingIntegration.ts:179-181
Timestamp: 2026-03-20T13:51:23.302Z
Learning: In `apps/meteor/app/integrations/server/methods/incoming/updateIncomingIntegration.ts`, the truthiness guards `...(integration.avatar && { avatar })`, `...(integration.emoji && { emoji })`, `...(integration.alias && { alias })`, and `...(integration.script && { script })` in the `$set` payload of `updateIncomingIntegration` are intentional. Empty-string values for these fields should NOT overwrite the stored value — only truthy values are persisted. Do not flag these as bugs preventing explicit clears.
Applied to files:
apps/meteor/app/slackbridge/server/RocketAdapter.ts
📚 Learning: 2026-03-03T11:11:48.541Z
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 39230
File: apps/meteor/app/api/server/v1/chat.ts:214-222
Timestamp: 2026-03-03T11:11:48.541Z
Learning: In apps/meteor/server/lib/moderation/reportMessage.ts, the reportMessage function validates that description is not empty or whitespace-only with `if (!description.trim())`. When migrating the chat.reportMessage endpoint to OpenAPI, adding minLength validation to the schema preserves this existing behavior.
Applied to files:
apps/meteor/app/slackbridge/server/RocketAdapter.ts
📚 Learning: 2026-03-12T17:12:49.121Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 39425
File: apps/meteor/client/lib/chats/flows/uploadFiles.ts:28-33
Timestamp: 2026-03-12T17:12:49.121Z
Learning: Rocket.Chat — apps/meteor/client/lib/chats/flows/uploadFiles.ts: When E2E_Enable_Encrypt_Files is disabled, plaintext file uploads are allowed in E2E rooms; this fallback is expected and should not be flagged as a security regression.
Applied to files:
apps/meteor/app/slackbridge/server/RocketAdapter.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 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/app/slackbridge/server/RocketAdapter.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/app/slackbridge/server/RocketAdapter.ts
There was a problem hiding this comment.
1 issue found across 5 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/meteor/client/hooks/useDecryptedMessage.ts">
<violation number="1" location="apps/meteor/client/hooks/useDecryptedMessage.ts:23">
P2: This unconditional second `if` overwrites decrypted text when attachments are also present. Use `else if` to preserve text precedence and avoid changing message rendering behavior.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
apps/meteor/tests/end-to-end/api/rooms.ts (1)
483-483: Strengthen themsgassertion to prevent false positivesLine 483 currently only proves
msg !== 'some_file_description'. It still passes ifmsgis accidentally populated with another non-empty value. Consider assertingmsgis absent or empty.Proposed assertion tightening
- expect(res.body.message).to.not.have.property('msg', 'some_file_description'); + expect(res.body.message.msg).to.be.oneOf([undefined, '']);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/meteor/tests/end-to-end/api/rooms.ts` at line 483, The current assertion only checks that res.body.message.msg is not equal to 'some_file_description' which can still pass if msg contains some other non-empty value; update the assertion on res.body.message to either assert the 'msg' property is absent (e.g., ensure no property 'msg') or assert it is empty (e.g., msg === '' or length === 0) so the test fails if any unexpected non-empty value appears — locate the assertion referencing res.body.message and replace the negated equality check with a strict absence or empty-string assertion on the 'msg' property.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@apps/meteor/tests/end-to-end/api/rooms.ts`:
- Line 483: The current assertion only checks that res.body.message.msg is not
equal to 'some_file_description' which can still pass if msg contains some other
non-empty value; update the assertion on res.body.message to either assert the
'msg' property is absent (e.g., ensure no property 'msg') or assert it is empty
(e.g., msg === '' or length === 0) so the test fails if any unexpected non-empty
value appears — locate the assertion referencing res.body.message and replace
the negated equality check with a strict absence or empty-string assertion on
the 'msg' property.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 22521c40-2c86-4e21-9d7f-8d0cea7c58b4
📒 Files selected for processing (5)
apps/meteor/client/hooks/useDecryptedMessage.spec.tsapps/meteor/client/hooks/useDecryptedMessage.tsapps/meteor/client/lib/parseMessageTextToAstMarkdown.spec.tsapps/meteor/client/lib/utils/normalizeMessagePreview/normalizeMessagePreview.spec.tsapps/meteor/tests/end-to-end/api/rooms.ts
🚧 Files skipped from review as they are similar to previous changes (4)
- apps/meteor/client/hooks/useDecryptedMessage.ts
- apps/meteor/client/hooks/useDecryptedMessage.spec.ts
- apps/meteor/client/lib/parseMessageTextToAstMarkdown.spec.ts
- apps/meteor/client/lib/utils/normalizeMessagePreview/normalizeMessagePreview.spec.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: 🔎 Code Check / Code Lint
- GitHub Check: 🔨 Test Storybook / Test Storybook
- GitHub Check: 🔎 Code Check / TypeScript
- GitHub Check: 🔨 Test Unit / Unit Tests
- GitHub Check: 📦 Meteor Build (coverage)
🧰 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/tests/end-to-end/api/rooms.ts
🧠 Learnings (13)
📓 Common learnings
Learnt from: ggazzo
Repo: RocketChat/Rocket.Chat PR: 35995
File: apps/meteor/app/api/server/v1/rooms.ts:1107-1112
Timestamp: 2026-02-23T17:53:18.785Z
Learning: In Rocket.Chat PR reviews, maintain strict scope boundaries—when a PR is focused on a specific endpoint (e.g., rooms.favorite), avoid reviewing or suggesting changes to other endpoints that were incidentally refactored (e.g., rooms.invite) unless explicitly requested by maintainers.
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 39230
File: apps/meteor/app/api/server/v1/chat.ts:214-222
Timestamp: 2026-03-03T11:11:48.541Z
Learning: In apps/meteor/server/lib/moderation/reportMessage.ts, the reportMessage function validates that description is not empty or whitespace-only with `if (!description.trim())`. When migrating the chat.reportMessage endpoint to OpenAPI, adding minLength validation to the schema preserves this existing behavior.
📚 Learning: 2026-03-12T17:12:49.121Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 39425
File: apps/meteor/client/lib/chats/flows/uploadFiles.ts:28-33
Timestamp: 2026-03-12T17:12:49.121Z
Learning: Rocket.Chat — apps/meteor/client/lib/chats/flows/uploadFiles.ts: When E2E_Enable_Encrypt_Files is disabled, plaintext file uploads are allowed in E2E rooms; this fallback is expected and should not be flagged as a security regression.
Applied to files:
apps/meteor/tests/end-to-end/api/rooms.ts
📚 Learning: 2026-03-11T18:17:53.972Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 39425
File: apps/meteor/client/lib/chats/flows/processMessageUploads.ts:112-119
Timestamp: 2026-03-11T18:17:53.972Z
Learning: In `apps/meteor/client/lib/chats/flows/processMessageUploads.ts`, when sending multiple file uploads, each file is confirmed via its own `/rooms.mediaConfirm/${rid}/${fileId}` call and produces a separate message. Only the first file's confirm payload carries the composed message text (`msg`); all subsequent files receive `msg: ''`. This one-message-per-file behavior is intentional by design — do not flag it as a bug or suggest batching into a single message.
Applied to files:
apps/meteor/tests/end-to-end/api/rooms.ts
📚 Learning: 2026-03-19T13:59:40.678Z
Learnt from: d-gubert
Repo: RocketChat/Rocket.Chat PR: 38357
File: apps/meteor/app/apps/server/converters/uploads.ts:45-49
Timestamp: 2026-03-19T13:59:40.678Z
Learning: In `apps/meteor/app/apps/server/converters/uploads.ts`, the `room` async handler in `convertToApp` uses non-null assertions (`upload.rid!` and `result!`) intentionally. The data flow guarantees that any upload reaching this point must have a `rid`; if it does not, throwing an error is the desired behavior (fail-fast / data integrity guard). Do not flag these non-null assertions as unsafe during code review.
Applied to files:
apps/meteor/tests/end-to-end/api/rooms.ts
📚 Learning: 2026-03-11T18:15:53.272Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 39425
File: apps/meteor/app/api/server/v1/rooms.ts:294-296
Timestamp: 2026-03-11T18:15:53.272Z
Learning: In Rocket.Chat's `rooms.mediaConfirm/:rid/:fileId` endpoint (apps/meteor/app/api/server/v1/rooms.ts), updating `file.name` from `bodyParams.fileName` without updating `file.path` is intentionally safe. The file path is keyed by `_id` (not by filename), so the stored path remains valid regardless of a rename. `file.name` only affects the display name in the message attachment; do not flag this as a path-divergence issue.
Applied to files:
apps/meteor/tests/end-to-end/api/rooms.ts
📚 Learning: 2026-02-12T15:39:28.416Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 32703
File: apps/meteor/client/lib/chats/flows/uploadFiles.ts:52-58
Timestamp: 2026-02-12T15:39:28.416Z
Learning: In `apps/meteor/client/lib/chats/flows/uploadFiles.ts`, when E2E encryption is required but not allowed (e.g., `E2E_Enable_Encrypt_Files` setting is disabled), the function intentionally abandons the entire upload queue and displays a toast error. This fail-fast behavior prevents partial uploads when encryption requirements cannot be met and is the expected behavior, not a bug.
Applied to files:
apps/meteor/tests/end-to-end/api/rooms.ts
📚 Learning: 2026-03-11T22:04:20.529Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 39545
File: apps/meteor/client/views/room/body/hooks/useHasNewMessages.ts:59-61
Timestamp: 2026-03-11T22:04:20.529Z
Learning: In `apps/meteor/client/views/room/body/hooks/useHasNewMessages.ts`, the `msg.u._id === uid` early-return in the `streamNewMessage` handler is intentional: the "New messages" indicator is designed to notify about messages from other users only. Self-sent messages — including those sent from a different session/device — are always skipped, by design. Do not flag this as a multi-session regression.
Applied to files:
apps/meteor/tests/end-to-end/api/rooms.ts
📚 Learning: 2026-02-24T19:36:55.089Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/page-objects/fragments/home-content.ts:60-82
Timestamp: 2026-02-24T19:36:55.089Z
Learning: In RocketChat/Rocket.Chat e2e tests (apps/meteor/tests/e2e/page-objects/fragments/home-content.ts), thread message preview listitems do not have aria-roledescription="message", so lastThreadMessagePreview locator cannot be scoped to messageListItems (which filters for aria-roledescription="message"). It should remain scoped to page.getByRole('listitem') or mainMessageList.getByRole('listitem').
Applied to files:
apps/meteor/tests/end-to-end/api/rooms.ts
📚 Learning: 2026-03-10T08:13:52.153Z
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 39414
File: apps/meteor/app/api/server/v1/rooms.ts:1241-1297
Timestamp: 2026-03-10T08:13:52.153Z
Learning: In the RocketChat/Rocket.Chat OpenAPI migration PRs for endpoints under apps/meteor/app/api/server/v1/rooms.ts, the pattern `ajv.compile<void>({...})` is intentionally used for the 200 response schema even when the endpoint returns `{ success: true }`. This is an established convention across all migrated endpoints (rooms.leave, rooms.favorite, rooms.delete, rooms.muteUser, rooms.unmuteUser). Do not flag this as a type mismatch during reviews of these migration PRs.
Applied to files:
apps/meteor/tests/end-to-end/api/rooms.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `expect` matchers for assertions (`toEqual`, `toContain`, `toBeTruthy`, `toHaveLength`, etc.) instead of `assert` statements in Playwright tests
Applied to files:
apps/meteor/tests/end-to-end/api/rooms.ts
📚 Learning: 2025-12-10T21:00:54.909Z
Learnt from: KevLehman
Repo: RocketChat/Rocket.Chat PR: 37091
File: ee/packages/abac/jest.config.ts:4-7
Timestamp: 2025-12-10T21:00:54.909Z
Learning: Rocket.Chat monorepo: Jest testMatch pattern '<rootDir>/src/**/*.spec.(ts|js|mjs)' is valid in this repo and used across multiple packages (e.g., packages/tools, ee/packages/omnichannel-services). Do not flag it as invalid in future reviews.
Applied to files:
apps/meteor/tests/end-to-end/api/rooms.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 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/tests/end-to-end/api/rooms.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/tests/end-to-end/api/rooms.ts
7e75f26 to
73b1d7e
Compare
Proposed changes (including videos or screenshots)
Summary
descriptionMdfield fromMessageAttachmentBasetypedescriptionMdparsing fromBeforeSaveMarkdownParserandparseMessageTextToAstMarkdowndescriptionMdfallbacks from copy/report message actionsThe
descriptionMdfield was a parsed markdown AST of the attachment description, rendered as text above file attachments. This is no longer needed asdescriptionis being repurposed exclusively for image alt text.Test plan
Issue(s)
Steps to test or reproduce
Further comments
WA-17
Summary by CodeRabbit