Skip to content

regression: thread reply deletion only clears the first cached duplicate - #41942

Merged
dionisio-bot[bot] merged 3 commits into
release-8.8.0from
regression/thread-reply-dedupe-to-delete
Aug 27, 2026
Merged

regression: thread reply deletion only clears the first cached duplicate#41942
dionisio-bot[bot] merged 3 commits into
release-8.8.0from
regression/thread-reply-dedupe-to-delete

Conversation

@juliajforesti

@juliajforesti juliajforesti commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

CORE-2513

Proposed changes (including videos or screenshots)

Issue(s)

Steps to test or reproduce

Further comments

Review in cubic

Summary by CodeRabbit

  • Bug Fixes
    • Fixed duplicate thread messages appearing in cached conversations.
    • Ensured the most recently updated version of a message is retained.
    • Deleting a thread message now removes all duplicate occurrences.
    • Improved cache consistency during message updates and pagination.

@dionisio-bot

dionisio-bot Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

@changeset-bot

changeset-bot Bot commented Aug 25, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: cc0490a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@juliajforesti juliajforesti added this to the 8.8.0 milestone Aug 25, 2026
@codecov

codecov Bot commented Aug 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (release-8.8.0@d036fc2). Learn more about missing BASE report.

Additional details and impacted files

Impacted file tree graph

@@               Coverage Diff                @@
##             release-8.8.0   #41942   +/-   ##
================================================
  Coverage                 ?   69.35%           
================================================
  Files                    ?     4254           
  Lines                    ?   168899           
  Branches                 ?    30178           
================================================
  Hits                     ?   117141           
  Misses                   ?    46601           
  Partials                 ?     5157           
Flag Coverage Δ
e2e 58.78% <61.53%> (?)
e2e-api 45.87% <ø> (?)
unit 71.27% <100.00%> (?)

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.

@juliajforesti
juliajforesti marked this pull request as ready for review August 26, 2026 13:17
@juliajforesti
juliajforesti requested a review from a team as a code owner August 26, 2026 13:17
@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: cfcb3f4e-0630-43d6-925c-90608633262f

📥 Commits

Reviewing files that changed from the base of the PR and between f718ab1 and cc0490a.

📒 Files selected for processing (1)
  • apps/meteor/client/lib/utils/threadMessageUtils.ts

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

📜 Recent review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: cubic · AI code reviewer
🧰 Additional context used
📓 Path-based instructions (2)
The main Rocket.Chat Meteor application resides in `apps/meteor/`; place its application code there rather than in other monorepo areas.

📄 CodeRabbit inference engine (CLAUDE.md)

Files:

  • apps/meteor/client/lib/utils/threadMessageUtils.ts
Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

Files:

  • apps/meteor/client/lib/utils/threadMessageUtils.ts
🔇 Additional comments (2)
apps/meteor/client/lib/utils/threadMessageUtils.ts (2)

57-74: LGTM!


87-87: LGTM!


Walkthrough

Thread message cache mutations now deduplicate repeated message IDs. The newest message version is retained using _updatedAt, with ts as fallback. Tests cover deletion across cached pages and no-op deduplication.

Changes

Thread message cache

Layer / File(s) Summary
Deduplicate cached thread messages
apps/meteor/client/lib/utils/threadMessageUtils.ts
The mutation flow deduplicates flattened cached pages before applying mutations and rebuilding pagination data. It retains the newest message by _updatedAt, falling back to ts.
Validate duplicate message handling
apps/meteor/client/lib/utils/threadMessageUtils.spec.ts
Tests verify that deletion removes every duplicate ID and that no-op mutation retains the newest duplicate content.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to cc049

This localized bug fix is merge-ready after normal checks and review; no actionable merge-blocking risk remains.

Suggested labels: type: bug

Suggested reviewers: cardoso, dnouv, dougfabris

🚥 Pre-merge checks | ✅ 5
✅ 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 clearly describes the main change: fixing thread reply deletion when duplicate messages exist in cached pages.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2 files.

Warning

Errors were encountered while retrieving linked issues.

Errors (1)
  • CORE-2513: Request failed with status code 401

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.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 issue found across 2 files

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/lib/utils/threadMessageUtils.ts">

<violation number="1" location="apps/meteor/client/lib/utils/threadMessageUtils.ts:69">
P2: When timestamps are equal, `dedupeThreadMessagesById` keeps the later-encountered message while `mergeThreadMessages` keeps the earlier one. This inconsistency can cause the same duplicate pair to resolve differently depending on which function processes it. Use `>` to match `mergeThreadMessages` behavior.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread apps/meteor/client/lib/utils/threadMessageUtils.ts Outdated
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
@juliajforesti juliajforesti added the stat: QA assured Means it has been tested and approved by a company insider label Aug 27, 2026
@dionisio-bot dionisio-bot Bot added the stat: ready to merge PR tested and approved waiting for merge label Aug 27, 2026
@dionisio-bot
dionisio-bot Bot merged commit a533489 into release-8.8.0 Aug 27, 2026
56 checks passed
@dionisio-bot
dionisio-bot Bot deleted the regression/thread-reply-dedupe-to-delete branch August 27, 2026 13:45
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 type: bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants