fix(federation): error on first user interaction

Merged
SA
2mo ago
+547-73

Proposed changes (including videos or screenshots)

First federation user interaction was failing due to createOrUpdateFederatedUser was returning a projection with less fields than needed. So now createOrUpdateFederatedUser correctly returns a full IUser and new tests were added to validate that.

Issue(s)

CORE-2495

Steps to test or reproduce

Further comments

Summary by CodeRabbit

  • New Features

    • Improved federated user resolution and automatic creation during Matrix invitations, joins, and first-contact interactions.
    • Added validation for federated usernames, with clear errors for invalid IDs.
    • Improved direct-message room naming when display names are unavailable.
  • Bug Fixes

    • Prevented local users and invalid federated results from being treated as remote users.
    • Improved error handling while preserving underlying causes.
  • Tests

    • Added coverage for user resolution, registration validation, and first-contact federation flows.