Skip to content

Conversation

@sampaiodiego
Copy link
Member

@sampaiodiego sampaiodiego commented Sep 18, 2025

Summary by CodeRabbit

  • Bug Fixes
    • Improved reliability of thread replies: messages now correctly reference the latest post in a thread when available, reducing mis-threaded replies.
    • Enhanced compatibility with clients that have limited thread support via better fallback behavior.
    • More consistent thread display across federated and third-party clients, with no changes to user workflows.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 18, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Adjusted thread message payload construction in MessageService.sendThreadMessage to always include is_falling_back in relates_to and conditionally include m.in_reply_to when latestThreadEventId is present. Removed is_falling_back_thread_reply flag. No changes to exported/public interfaces.

Changes

Cohort / File(s) Summary
Thread message payload construction
packages/federation-sdk/src/services/message.service.ts
Refactored relates_to: always set is_falling_back; add m.in_reply_to with latestThreadEventId when available; removed is_falling_back_thread_reply. No external API/signature changes.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant MessageService
  participant MatrixServer as Matrix Server

  Client->>MessageService: sendThreadMessage(content, threadRootEventId, latestThreadEventId)
  alt latestThreadEventId is present
    Note over MessageService: Build relates_to = { rel_type: "m.thread", event_id: threadRootEventId, is_falling_back: true, "m.in_reply_to": { event_id: latestThreadEventId } }
  else no latestThreadEventId
    Note over MessageService: Build relates_to = { rel_type: "m.thread", event_id: threadRootEventId, is_falling_back: true }
  end
  MessageService->>MatrixServer: POST /send (content with relates_to)
  MatrixServer-->>MessageService: ack (event_id)
  MessageService-->>Client: result
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I nudge the threads with gentle paws,
A fallback flag in payload laws;
If replies bloom, I tuck them in,
m.in_reply_to joins the spin.
One hop ahead, clean trails I track—
Less fluff, more facts. Now back to snack. 🥕

✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-thread-message

📜 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 66d0c9b and a93ea19.

📒 Files selected for processing (1)
  • packages/federation-sdk/src/services/message.service.ts (1 hunks)

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


Comment @coderabbitai help to get the list of available commands and usage tips.

@ggazzo ggazzo merged commit 99347aa into main Sep 18, 2025
2 of 3 checks passed
@ggazzo ggazzo deleted the fix-thread-message branch September 18, 2025 19:52
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.01%. Comparing base (66d0c9b) to head (a93ea19).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #204   +/-   ##
=======================================
  Coverage   81.01%   81.01%           
=======================================
  Files          63       63           
  Lines        4692     4692           
=======================================
  Hits         3801     3801           
  Misses        891      891           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants