Skip to content

Conversation

@rodrigok
Copy link
Member

@rodrigok rodrigok commented Oct 9, 2025

Proposed changes (including videos or screenshots)

Issue(s)

Steps to test or reproduce

Further comments

Summary by CodeRabbit

  • Bug Fixes
    • Threaded message replies no longer fail when the latest thread event isn’t available. Replies are now sent even if the latest thread reference is missing.
    • Improves resilience in Matrix thread interactions, reducing errors and interruptions when replying in ongoing threads.
    • Enhances user experience in edge cases where thread context cannot be retrieved, ensuring smoother conversation flow and more reliable message delivery in threaded discussions.

Copilot AI review requested due to automatic review settings October 9, 2025 17:19
@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Oct 9, 2025

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

@changeset-bot
Copy link

changeset-bot bot commented Oct 9, 2025

⚠️ No Changeset found

Latest commit: a88bd9d

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

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a bug in the federation matrix service where thread functionality was not working properly due to improper handling of optional thread event IDs.

  • Added conditional parsing for latestThreadEventId to handle cases where it may be undefined
  • Prevents runtime errors when processing thread messages without a latest thread event ID

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 9, 2025

Walkthrough

The change updates FederationMatrix to pass latestThreadEventId to Matrix’s sendThreadMessage only when defined, using eventIdSchema.parse for validation. If not present, undefined is passed. No public API signatures were altered.

Changes

Cohort / File(s) Summary of Changes
Threaded message parameter handling
ee/packages/federation-matrix/src/FederationMatrix.ts
Adjusted call to sendThreadMessage to conditionally pass eventIdSchema.parse(latestThreadEventId) or undefined, making the latest thread event optional in threaded replies.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant C as Client
  participant FM as FederationMatrix
  participant MX as MatrixClient

  C->>FM: send threaded reply (message, latestThreadEventId?)
  alt latestThreadEventId defined
    FM->>FM: validate with eventIdSchema.parse(id)
    FM->>MX: sendThreadMessage(message, parsedId)
  else no latestThreadEventId
    FM->>MX: sendThreadMessage(message, undefined)
  end
  MX-->>FM: ack / result
  FM-->>C: result
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

stat: ready to merge, stat: QA assured

Suggested reviewers

  • ricardogarim
  • ggazzo

Poem

A hop, a skip—no thread in sight,
I nudge the packet, light as light.
If ID appears, I pass it through;
If not, I simply bid adieu.
Thump-thump! my paws approve the send—
Optional paths, a tidy end. 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title follows the conventional commit format and clearly indicates a fix in the federation scope for thread-related functionality. It succinctly communicates that threads were previously not working and have now been addressed. This aligns with the changes to allow an undefined latestThreadEventId and restore threaded message replies.
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/federation-thread

📜 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 5ceef6f and a88bd9d.

📒 Files selected for processing (1)
  • ee/packages/federation-matrix/src/FederationMatrix.ts (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). (3)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build
🔇 Additional comments (1)
ee/packages/federation-matrix/src/FederationMatrix.ts (1)

483-483: LGTM! Thread message handling now correctly supports optional latest event ID.

The conditional parsing prevents runtime errors when latestThreadEventId is undefined, which aligns with the PR objective of fixing thread functionality. The logic correctly passes undefined to sendThreadMessage when there's no latest thread message, making this parameter truly optional.


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.

@ggazzo ggazzo added this to the 7.11.0 milestone Oct 9, 2025
@ggazzo ggazzo added the stat: QA assured Means it has been tested and approved by a company insider label Oct 9, 2025
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Oct 9, 2025
@ggazzo ggazzo merged commit fe293d9 into release-7.11.0 Oct 9, 2025
19 checks passed
@ggazzo ggazzo deleted the fix/federation-thread branch October 9, 2025 17:34
@codecov
Copy link

codecov bot commented Oct 9, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.43%. Comparing base (5ceef6f) to head (a88bd9d).
⚠️ Report is 2 commits behind head on release-7.11.0.

Additional details and impacted files

Impacted file tree graph

@@                Coverage Diff                 @@
##           release-7.11.0   #37188      +/-   ##
==================================================
- Coverage           67.45%   67.43%   -0.02%     
==================================================
  Files                3329     3329              
  Lines              113381   113381              
  Branches            20573    20573              
==================================================
- Hits                76477    76462      -15     
- Misses              34306    34318      +12     
- Partials             2598     2601       +3     
Flag Coverage Δ
e2e 57.29% <ø> (+0.01%) ⬆️
unit 71.20% <ø> (-0.05%) ⬇️

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.

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.

2 participants