Skip to content

Conversation

@ricardogarim
Copy link
Contributor

@ricardogarim ricardogarim commented Sep 23, 2025

Summary by CodeRabbit

  • Refactor
    • Added origin metadata to federation member join events to enrich event payloads.
    • Adjusted internal return structures accordingly.
  • Chores
    • Updated internal types to align with the enhanced event data.

No user-facing changes; existing functionality remains unaffected.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 23, 2025

Walkthrough

ProfilesService.makeJoin now returns a member event augmented with an origin string. The Promise result shape changes to include event: PduForType<'m.room.member'> & { origin: string } and room_version: string. No other files or parameters changed.

Changes

Cohort / File(s) Summary
Federation Profiles Service
packages/federation-sdk/src/services/profiles.service.ts
Updated makeJoin return type to include origin on the m.room.member event and clarified room_version: string.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Client
  participant ProfilesService

  Client->>ProfilesService: makeJoin(roomId, userId, versions)
  activate ProfilesService
  note right of ProfilesService: Build m.room.member event<br/>Augment with origin
  ProfilesService-->>Client: { event: m.room.member & { origin }, room_version }
  deactivate ProfilesService
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I nudge the join with a gentle thump,
add “origin” where packets jump.
A hop, a sign, a tidy string—
now events recall from whence they spring.
Ears up, I stamp in federated cheer:
the trail is clear, the path sincere.

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 "fix: return origin on make-join response event" accurately and concisely summarizes the primary change — adding an origin field to the makeJoin response event. It directly corresponds to the modifications in packages/federation-sdk/src/services/profiles.service.ts and references the affected behavior and method. The phrasing is specific and clear for a teammate scanning commit history.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ 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/make-join-origin

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.

@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.99%. Comparing base (901f242) to head (51e8a50).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #210      +/-   ##
==========================================
- Coverage   81.01%   80.99%   -0.02%     
==========================================
  Files          63       63              
  Lines        4692     4693       +1     
==========================================
  Hits         3801     3801              
- Misses        891      892       +1     

☔ 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.

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)
packages/federation-sdk/src/services/profiles.service.ts (1)

76-78: Type tweak: use RoomVersion; origin intersection likely redundant

  • Prefer room_version: RoomVersion for stronger typing.
  • PduForType<'m.room.member'> likely already includes origin; the intersection may be redundant (non-blocking).
-  ): Promise<{
-    event: PduForType<'m.room.member'> & { origin: string };
-    room_version: string;
-  }> {
+  ): Promise<{
+    event: PduForType<'m.room.member'> & { origin: string };
+    room_version: RoomVersion;
+  }> {
📜 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 1cc2333 and 51e8a50.

📒 Files selected for processing (1)
  • packages/federation-sdk/src/services/profiles.service.ts (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
packages/federation-sdk/src/services/profiles.service.ts (1)
packages/room/src/types/_common.ts (1)
  • PduForType (14-14)
🔇 Additional comments (1)
packages/federation-sdk/src/services/profiles.service.ts (1)

105-108: Keep origin as the resident (responding) homeserver — do not set it to the joiner's domain

Matrix S2S spec requires event.origin in make_join responses to be the resident/responding homeserver (the current code using this.configService.serverName is correct); do not derive origin from userId. (Matrix S2S API — GET /make_join: "origin — The name of the resident homeserver.")

Location: packages/federation-sdk/src/services/profiles.service.ts lines 105-108

Likely an incorrect or invalid review comment.

@ggazzo ggazzo merged commit 51b965c into main Sep 23, 2025
3 checks passed
@ggazzo ggazzo deleted the fix/make-join-origin branch September 23, 2025 20:41
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