Skip to content

Conversation

@ggazzo
Copy link
Member

@ggazzo ggazzo commented Nov 13, 2025

rocketchat.atlassian.net/browse/FB-58

Summary by CodeRabbit

  • Refactor
    • Simplified event payload structures by removing non-essential fields from message, encryption, reaction, redaction, and membership events.
    • Reduced event metadata in emitted notifications for lighter event propagation across services.
    • Removed event relationship type definitions to streamline event structure definitions.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 13, 2025

Walkthrough

The pull request removes the RelatesTo union type from exports and prunes common event fields (room_id, sender, origin_server_ts, content, and related fields) from multiple HomeserverEventSignatures event type definitions and corresponding service emission payloads across the federation SDK.

Changes

Cohort / File(s) Summary
Type Definitions
packages/federation-sdk/src/index.ts
Removed RelatesTo union type export and pruned fields from event signatures including homeserver.matrix.encrypted, homeserver.matrix.message, homeserver.matrix.reaction, homeserver.matrix.redaction, homeserver.matrix.membership, and room state events; removed room_id, sender, origin_server_ts, content, and other context-specific fields.
Service Emissions
packages/federation-sdk/src/services/room.service.ts, send-join.service.ts, staging-area.service.ts
Removed identical sets of fields from emitted event payloads across membership, message, encrypted, reaction, redaction, and room state event handlers; payloads now contain only minimal metadata (event_id and event).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Type signature changes: Verify removal of fields from public HomeserverEventSignatures entries does not break downstream consumers expecting these fields.
  • Consistent pruning across services: Confirm field removals are uniformly applied across all service emission points and no inconsistencies exist.
  • Breaking API changes: Assess whether removal of RelatesTo and event fields constitutes a breaking change requiring versioning or migration guidance.

Possibly related PRs

Suggested reviewers

  • rodrigok

Poem

🐰 Fields once vital, now shed like fur in spring,
RelatesTo fades, a simpler wing,
room_id, sender—old company goes,
Events now lean, like whispers the rabbit knows! ✨

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.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title accurately describes the main change: pruning event payload fields across federation services by removing unused type definitions and reducing emitted event payloads.
✨ 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 chore/emit-event

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 marked this pull request as ready for review November 13, 2025 20:57
@ggazzo ggazzo changed the title refactor: remove unused RelatesTo type definitions from index.ts refactor: prune event payload fields across federation services Nov 13, 2025
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 52.77%. Comparing base (c8ff64c) to head (04fdaae).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #299      +/-   ##
==========================================
+ Coverage   52.43%   52.77%   +0.33%     
==========================================
  Files          96       96              
  Lines       12661    12571      -90     
==========================================
- Hits         6639     6634       -5     
+ Misses       6022     5937      -85     

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

@ggazzo ggazzo merged commit 5cc3127 into main Nov 13, 2025
3 checks passed
@ggazzo ggazzo deleted the chore/emit-event branch November 13, 2025 21:02
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