Skip to content

Conversation

@ricardogarim
Copy link
Contributor

@ricardogarim ricardogarim commented Oct 1, 2025

https://rocketchat.atlassian.net/browse/FDR-186

Proposed changes (including videos or screenshots)

Issue(s)

Steps to test or reproduce

Further comments

Summary by CodeRabbit

  • Bug Fixes

    • Federated message deletions now proceed consistently and are no longer blocked by user-specific context.
  • Improvements

    • Simplified federation deletion flow for more reliable propagation across federated rooms.
    • Room data retrieval enhanced to ensure accurate deletion handling.
  • Chores

    • Federation SDK dependency updated to a newer patch release.

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Oct 1, 2025

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

  • This PR is missing the 'stat: QA assured' label

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 1, 2025

⚠️ No Changeset found

Latest commit: 66f8103

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 1, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Removes the uid/user dependency from federated message deletion, adds federation to the room projection used during deletion lookup, updates the federation hook to stop using user info, and changes FederationMatrix and its interface to deleteMessage(matrixRoomId, message) (uid removed). Also bumps @rocket.chat/federation-sdk in two packages.

Changes

Cohort / File(s) Summary
Server message deletion lookup
apps/meteor/app/lib/server/functions/deleteMessage.ts
Adds federation to Rooms.findOneById projection: now { lastMessage, prid, mid, federated, federation }.
Federation hook: afterDeleteMessage
apps/meteor/ee/server/hooks/federation/index.ts
Removes user destructuring and user-based gating; calls FederationMatrix.deleteMessage(room.federation.mrid, message) (drops uid).
Federation Matrix service implementation
ee/packages/federation-matrix/src/FederationMatrix.ts
Changes signature to deleteMessage(matrixRoomId, message); updates internal redaction call to omit uid parameter.
Federation service interface
packages/core-services/src/types/IFederationMatrixService.ts
Updates interface: deleteMessage(matrixRoomId: string, message: IMessage): Promise<void> (removed uid).
Dependency bumps
ee/apps/federation-service/package.json, ee/packages/federation-matrix/package.json
Bumps @rocket.chat/federation-sdk from 0.1.11 to 0.1.13.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as User
  participant S as App Server
  participant H as Federation Hook
  participant F as FederationMatrix
  participant M as Matrix HS

  U->>S: Delete message request
  S->>S: Load room with { lastMessage, prid, mid, federated, federation }
  S->>H: afterDeleteMessage(room, message)
  H->>F: deleteMessage(room.federation.mrid, message)
  F->>M: redactMessage(matrixRoomId, matrixEventId)
  M-->>F: redaction result
  F-->>H: done
  H-->>S: done
  S-->>U: acknowledge deletion
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

stat: ready to merge, stat: QA assured

Suggested reviewers

  • sampaiodiego

Poem

A twitch, a hop, a tidy prune,
I snip the uid and hum a tune.
Matrix hushes, events retract,
Hooks hop on the updated track.
Rabbit refactor — swift and neat. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Linked Issues Check ⚠️ Warning The pull request updates server-side federation deletion logic to remove the uid parameter and adjust the deleteMessage signature, which should resolve the “Federation configuration is invalid” error, but it contains no changes to the client-side confirmation modal or toast behaviour described in FDR-186. The lack of UI modifications means the modal may still not disappear and users may not see the toast notifications as intended. Therefore the code only partially fulfills the objectives of the linked issue. Please add the necessary client-side updates to dismiss the confirmation modal upon successful deletion and display the appropriate toast notifications to fully address FDR-186’s requirements.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title succinctly identifies the primary change as a fix for federated message deletion, accurately reflecting the core update in the changeset without extraneous detail.
Out of Scope Changes Check ✅ Passed All modifications focus exclusively on restructuring the federation deleteMessage workflow, updating related service interfaces, and bumping the federation SDK dependency, which directly align with fixing federated message deletion. There are no unrelated or extraneous changes outside the scope of the linked issue.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

📜 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 939e948 and 66f8103.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (6)
  • apps/meteor/app/lib/server/functions/deleteMessage.ts (1 hunks)
  • apps/meteor/ee/server/hooks/federation/index.ts (2 hunks)
  • ee/apps/federation-service/package.json (1 hunks)
  • ee/packages/federation-matrix/package.json (1 hunks)
  • ee/packages/federation-matrix/src/FederationMatrix.ts (2 hunks)
  • packages/core-services/src/types/IFederationMatrixService.ts (1 hunks)

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.

@ricardogarim ricardogarim force-pushed the fix/federation-delete-message branch from b616983 to edb8dd8 Compare October 1, 2025 13:09
@ricardogarim ricardogarim marked this pull request as ready for review October 1, 2025 18:35
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

📜 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 affd1ac and edb8dd8.

📒 Files selected for processing (4)
  • apps/meteor/app/lib/server/functions/deleteMessage.ts (1 hunks)
  • apps/meteor/ee/server/hooks/federation/index.ts (2 hunks)
  • ee/packages/federation-matrix/src/FederationMatrix.ts (2 hunks)
  • packages/core-services/src/types/IFederationMatrixService.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-19T15:15:04.642Z
Learnt from: rodrigok
PR: RocketChat/Rocket.Chat#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/ee/server/hooks/federation/index.ts
🧬 Code graph analysis (3)
ee/packages/federation-matrix/src/FederationMatrix.ts (1)
packages/core-typings/src/IMessage/IMessage.ts (1)
  • IMessage (138-239)
packages/core-services/src/types/IFederationMatrixService.ts (1)
packages/core-typings/src/IMessage/IMessage.ts (1)
  • IMessage (138-239)
apps/meteor/ee/server/hooks/federation/index.ts (2)
packages/core-typings/src/IMessage/IMessage.ts (1)
  • IMessage (138-239)
ee/packages/federation-matrix/src/FederationMatrix.ts (1)
  • FederationMatrix (53-994)
🪛 GitHub Actions: CI
ee/packages/federation-matrix/src/FederationMatrix.ts

[error] 637-637: src/FederationMatrix.ts(637,58): TS2554: Expected 3 arguments, but got 2.

🔇 Additional comments (6)
apps/meteor/app/lib/server/functions/deleteMessage.ts (1)

38-38: LGTM! Projection correctly includes federation data.

The addition of federation: 1 to the projection is necessary to support the updated federation deletion flow, where room.federation.mrid is accessed in the afterDeleteMessage callback.

apps/meteor/ee/server/hooks/federation/index.ts (2)

2-2: LGTM! Removed unused import.

The isUserNativeFederated import is no longer needed after removing user-based logic from the deletion flow.


60-67: Remove redundant guard for room.federation
shouldPerformFederationAction is a type guard narrowing room to IRoomNativeFederated (whose federation.mrid is always defined).

Likely an incorrect or invalid review comment.

packages/core-services/src/types/IFederationMatrixService.ts (1)

13-13: LGTM! Interface signature correctly simplified.

The removal of the uid parameter from deleteMessage aligns with the PR objective to eliminate user dependency from federated message deletion.

ee/packages/federation-matrix/src/FederationMatrix.ts (2)

619-619: LGTM! Method signature correctly updated.

The deleteMessage method signature now matches the updated IFederationMatrixService interface by removing the uid parameter.


636-636: Address TODO comment about message author.

The TODO at line 636 notes that message.u?.username is not the user who removed the message. While the uid parameter has been removed, consider whether the redaction should track who performed the deletion for audit purposes.

Verify if the Matrix federation protocol requires tracking who performed the redaction, or if anonymous redaction is acceptable for your use case.

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)
ee/apps/federation-service/package.json (1)

28-28: Confirm all workspace references bump to 0.1.13.

This package now pulls @rocket.chat/federation-sdk@0.1.13. Please make sure every other workspace package (and the lockfile) using this SDK is bumped to the same version so we avoid a mixed workspace state.

📜 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 edb8dd8 and 939e948.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (2)
  • ee/apps/federation-service/package.json (1 hunks)
  • ee/packages/federation-matrix/package.json (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). (4)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: Builds matrix rust bindings against alpine
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build
🔇 Additional comments (1)
ee/packages/federation-matrix/package.json (1)

41-41: Looks good—dependency bump aligns with the service.

This keeps the matrix package in sync with the service after the API signature change.

@ggazzo ggazzo changed the base branch from develop to release-7.11.0 October 1, 2025 21:44
@ggazzo ggazzo requested review from a team as code owners October 1, 2025 21:44
@ggazzo ggazzo added this to the 7.11.0 milestone Oct 1, 2025
@ggazzo ggazzo force-pushed the fix/federation-delete-message branch from 939e948 to 66f8103 Compare October 1, 2025 21:45
@ggazzo ggazzo merged commit ec81ab4 into release-7.11.0 Oct 1, 2025
5 of 7 checks passed
@ggazzo ggazzo deleted the fix/federation-delete-message branch October 1, 2025 21:45
ricardogarim added a commit that referenced this pull request Oct 7, 2025
Co-authored-by: Guilherme Gazzo <guilherme@gazzo.xyz>
ricardogarim added a commit that referenced this pull request Oct 8, 2025
Co-authored-by: Guilherme Gazzo <guilherme@gazzo.xyz>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants