Skip to content

Conversation

@yash-rajpal
Copy link
Member

@yash-rajpal yash-rajpal commented Oct 6, 2025

Proposed changes (including videos or screenshots)

Fixes a client crash caused by missing title or value properties in attachment fields.
The web client expects both title and value to always be present, but our APIs currently allow attachments without these parameters.

  • Updated the client to handle existing messages gracefully, preventing crashes when these properties are missing.

API validation will be added on release 8.0.0 since it is a breaking change - #37233

Issue(s)

Steps to test or reproduce

Further comments

SUP-854

No tests here since this will be properly fixed on release-8.0.0 by PR #37233 which contains appropriate tests.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed a client crash that occurred when message attachments contained invalid or malformed field data.

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Oct 6, 2025

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is targeting the wrong base branch. It should target 7.12.0, but it targets 7.11.0

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link

changeset-bot bot commented Oct 6, 2025

🦋 Changeset detected

Latest commit: a1d7f16

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 42 packages
Name Type
@rocket.chat/meteor Patch
@rocket.chat/core-typings Patch
@rocket.chat/rest-typings Patch
@rocket.chat/uikit-playground Patch
@rocket.chat/api-client Patch
@rocket.chat/apps Patch
@rocket.chat/core-services Patch
@rocket.chat/cron Patch
@rocket.chat/ddp-client Patch
@rocket.chat/freeswitch Patch
@rocket.chat/fuselage-ui-kit Patch
@rocket.chat/gazzodown Patch
@rocket.chat/http-router Patch
@rocket.chat/livechat Patch
@rocket.chat/model-typings Patch
@rocket.chat/ui-avatar Patch
@rocket.chat/ui-client Patch
@rocket.chat/ui-contexts Patch
@rocket.chat/web-ui-registration Patch
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/federation-service Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/stream-hub-service Patch
@rocket.chat/federation-matrix Patch
@rocket.chat/license Patch
@rocket.chat/media-calls Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/models Patch
@rocket.chat/network-broker Patch
@rocket.chat/omni-core-ee Patch
@rocket.chat/mock-providers Patch
@rocket.chat/ui-video-conf Patch
@rocket.chat/ui-voip Patch
@rocket.chat/instance-status Patch
@rocket.chat/omni-core Patch

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 6, 2025

Walkthrough

This PR fixes a client crash (TypeError) that occurred when rendering message attachment fields missing the 'title' property. The DefaultAttachment component now conditionally renders title and value fields as MarkdownText only when they exist, setting them to null otherwise. A changeset documents the patch version bump.

Changes

Cohort / File(s) Summary
Bug Fix: Conditional Rendering
apps/meteor/client/components/message/content/attachments/DefaultAttachment.tsx
Modified fields mapping to conditionally render title and value as MarkdownText only when present; missing fields now set to null instead of always rendering, preventing TypeError crashes.
Changeset
.changeset/chilled-pans-unite.md
New changeset documenting patch version update for @rocket.chat/meteor with fix description: "Fixes client crash on invalid message attachment fields payload."

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Simple, localized conditional rendering fix in a single component addressing a specific crash scenario. Changes are straightforward and low-risk.

Suggested reviewers

  • scuciatto

Poem

🐰 A field was missing, the title had fled,
The client went crashing, and errors turned red.
With a hop and a fix, now null is the way,
The attachments render—no crash, hip hooray! ✨

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly describes the primary fix for preventing a client crash due to improper attachment fields, matching the main change in this PR.
Linked Issues Check ✅ Passed The pull request adds defensive checks to avoid rendering missing title or value in attachment fields, directly addressing the crash described in SUP-854, and the deferred API validation is intentionally postponed to release 8.0.0 as planned.
Out of Scope Changes Check ✅ Passed All code modifications are confined to conditional rendering of attachment field title and value and the associated changeset, which align with the stated objective of preventing crashes due to missing attachment field properties.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/attachement-fields

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 942798c and a1d7f16.

📒 Files selected for processing (2)
  • .changeset/chilled-pans-unite.md (1 hunks)
  • apps/meteor/client/components/message/content/attachments/DefaultAttachment.tsx (1 hunks)
⏰ 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). (7)
  • GitHub Check: 🔨 Test Unit / Unit Tests
  • GitHub Check: 🔨 Test Storybook / Test Storybook
  • GitHub Check: 🔎 Code Check / TypeScript
  • GitHub Check: 🔎 Code Check / Code Lint
  • GitHub Check: 📦 Meteor Build - coverage
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build
🔇 Additional comments (2)
.changeset/chilled-pans-unite.md (1)

1-5: LGTM!

The changeset correctly documents a patch version bump for the client crash fix. The description accurately reflects the nature of the bug fix.

apps/meteor/client/components/message/content/attachments/DefaultAttachment.tsx (1)

89-94: LGTM! Conditional rendering prevents crashes from missing properties.

The conditional rendering properly handles missing or empty title and value fields by setting them to null instead of attempting to render <MarkdownText> with undefined content. This addresses the client crash described in the PR objectives.


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 and usage tips.

@codecov
Copy link

codecov bot commented Oct 6, 2025

Codecov Report

❌ Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.55%. Comparing base (180154b) to head (a1d7f16).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #37147      +/-   ##
===========================================
- Coverage    67.58%   67.55%   -0.03%     
===========================================
  Files         3295     3295              
  Lines       112648   112652       +4     
  Branches     20455    20453       -2     
===========================================
- Hits         76133    76106      -27     
- Misses       33842    33871      +29     
- Partials      2673     2675       +2     
Flag Coverage Δ
e2e 57.30% <0.00%> (-0.02%) ⬇️
unit 71.58% <0.00%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@yash-rajpal yash-rajpal marked this pull request as ready for review October 6, 2025 15:23
@yash-rajpal yash-rajpal requested review from a team as code owners October 6, 2025 15:23
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
apps/meteor/tests/end-to-end/api/chat.ts (1)

558-585: Add a success case for non-string field values

Once the validation bug is fixed, please extend the happy-path test to cover a field like { value: 0 } or { value: false }. Those payloads were valid before and should remain so; adding a test here will keep us from regressing again.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 287f302 and 6cd13f5.

📒 Files selected for processing (4)
  • .changeset/hungry-fans-wait.md (1 hunks)
  • apps/meteor/app/lib/server/functions/sendMessage.ts (1 hunks)
  • apps/meteor/client/components/message/content/attachments/DefaultAttachment.tsx (1 hunks)
  • apps/meteor/tests/end-to-end/api/chat.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
apps/meteor/tests/end-to-end/api/chat.ts (1)
apps/meteor/tests/data/api-data.ts (3)
  • request (10-10)
  • api (46-48)
  • credentials (39-42)
⏰ 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). (3)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build

@yash-rajpal yash-rajpal added this to the 8.0.0 milestone Oct 6, 2025
@dougfabris
Copy link
Member

why 8.0.0?

@yash-rajpal
Copy link
Member Author

why 8.0.0?

@dougfabris This PR introduces API validation on attachment.fields, which is a breaking change since the payload that used to work earlier, won't work anymore.

@dougfabris dougfabris changed the title fix: title and value properties should be required on attachments.fields fix!: title and value properties should be required on attachments.fields Oct 7, 2025
@yash-rajpal yash-rajpal marked this pull request as draft October 7, 2025 15:11
@scuciatto
Copy link
Member

scuciatto commented Oct 14, 2025

@yash-rajpal : Since this is a breaking change, it must target the release-8.0.0 branch

@yash-rajpal yash-rajpal force-pushed the fix/attachement-fields branch from 942798c to aa2a2ac Compare October 15, 2025 16:22
@yash-rajpal yash-rajpal requested review from MartinSchoeler and aleksandernsilva and removed request for a team October 15, 2025 16:23
@yash-rajpal yash-rajpal marked this pull request as ready for review October 15, 2025 16:28
@dougfabris dougfabris changed the title fix!: title and value properties should be required on attachments.fields fix: title and value properties should be required on attachments.fields Oct 15, 2025
@dougfabris dougfabris modified the milestones: 8.0.0, 7.12.0 Oct 15, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
.changeset/chilled-pans-unite.md (1)

5-5: Clarify the changeset message (imperative, specify missing keys).

Be explicit about the condition and use imperative voice for consistency.

Apply this diff:

-Fixes client crash on invalid message attachment fields payload.
+Fix client crash when rendering message attachment fields with missing title/value.
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 942798c and dae31ab.

📒 Files selected for processing (2)
  • .changeset/chilled-pans-unite.md (1 hunks)
  • apps/meteor/client/components/message/content/attachments/DefaultAttachment.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/meteor/client/components/message/content/attachments/DefaultAttachment.tsx
🔇 Additional comments (1)
.changeset/chilled-pans-unite.md (1)

2-2: Confirm package scope for the bump.

If the changes are confined to apps/meteor (DefaultAttachment.tsx), scoping to '@rocket.chat/meteor' is correct. If other packages consume or export the affected component or types, include them in this changeset too.

@yash-rajpal yash-rajpal changed the title fix: title and value properties should be required on attachments.fields fix: Client crash on missing proper attachments.fields Oct 15, 2025
@aleksandernsilva aleksandernsilva added the stat: QA assured Means it has been tested and approved by a company insider label Oct 16, 2025
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Oct 16, 2025
@kodiakhq kodiakhq bot merged commit 053d6e0 into develop Oct 16, 2025
50 checks passed
@kodiakhq kodiakhq bot deleted the fix/attachement-fields branch October 16, 2025 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants