Skip to content

feat: Change type of DecryptedRoomEvent::event to Raw<AnyTimelineEvent> #5512

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 14, 2025

Conversation

kaylendog
Copy link
Contributor

@kaylendog kaylendog commented Aug 11, 2025

  • Change DecryptedRoomEvent::event to Raw<AnyTimelineEvent>
  • Update usages to pattern match on AnyTimelineEvent::MessageLike where necessary

Copy link

codecov bot commented Aug 11, 2025

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 88.57%. Comparing base (6c944a9) to head (b1ab5c4).
⚠️ Report is 33 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...dk-base/src/event_cache/store/integration_tests.rs 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5512   +/-   ##
=======================================
  Coverage   88.57%   88.57%           
=======================================
  Files         339      339           
  Lines       93627    93627           
  Branches    93627    93627           
=======================================
+ Hits        82927    82934    +7     
+ Misses       6565     6558    -7     
  Partials     4135     4135           

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

@kaylendog kaylendog force-pushed the kaylendog/decrypted-room-event branch from 1f8f05d to 699f39f Compare August 11, 2025 11:42
@kaylendog kaylendog self-assigned this Aug 11, 2025
@kaylendog kaylendog marked this pull request as ready for review August 11, 2025 13:47
@kaylendog kaylendog requested review from a team as code owners August 11, 2025 13:47
@kaylendog kaylendog requested review from Hywan and andybalaam and removed request for a team August 11, 2025 13:47
@kaylendog kaylendog changed the title feat: Change DecryptedRoomEvent::event to Raw<AnyTimelineEvent> feat: Change DecryptedRoomEvent::event type to Raw<AnyTimelineEvent> Aug 11, 2025
@kaylendog kaylendog changed the title feat: Change DecryptedRoomEvent::event type to Raw<AnyTimelineEvent> feat: Change type of DecryptedRoomEvent::event to Raw<AnyTimelineEvent> Aug 11, 2025
@andybalaam
Copy link
Member

Test failure seems to be an internal problem at codspeed

Copy link
Member

@andybalaam andybalaam left a comment

Choose a reason for hiding this comment

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

Looks good, and kudos for breaking into small commits. I like each commit to compile and pass tests, however, because it makes git bisect work nicely, so I'd prefer all in one commit if these don't compile separately :-)

No need to change that now though: we can squash merge this if we agree it should all be combined.

For the changelog: please can you list the pub functions that are affected and what users should do to if they use these methods?

@kaylendog kaylendog force-pushed the kaylendog/decrypted-room-event branch from 864fbeb to b1ab5c4 Compare August 12, 2025 10:11
@kaylendog kaylendog requested a review from andybalaam August 12, 2025 10:11
Copy link

codspeed-hq bot commented Aug 12, 2025

CodSpeed Performance Report

Merging #5512 will not alter performance

Comparing kaylendog:kaylendog/decrypted-room-event (864fbeb) with main (6c944a9)

Summary

✅ 31 untouched benchmarks

Copy link

codspeed-hq bot commented Aug 12, 2025

Unable to generate the performance report

There was an internal error while processing the run's data. We're working on fixing the issue. Feel free to contact us on Discord or at [email protected] if the issue persists.

@Hywan
Copy link
Member

Hywan commented Aug 13, 2025

Thanks for the patch. Can you explain me why you need that? The changes are good and nice, kudos for that, but you forgot to explain the motivations for that ^^.

@kaylendog
Copy link
Contributor Author

kaylendog commented Aug 13, 2025

Thanks for the patch. Can you explain me why you need that? The changes are good and nice, kudos for that, but you forgot to explain the motivations for that ^^.

It's fundamentally about being able to avoid casting when implementing encrypted state events. At the moment, using Raw<AnyMessageLikeEvent> requires that a decrypted event can never be a state event (unless it is unchecked-casted). There are a couple of places in my older #5456 PR where I needed to cast between Any(Sync)StateEvent and AnyMessageLikeEvent and vice versa. This change would allow me to avoid the casting when decrypting state events.

I would have liked to feature gate this behind experimental-encrypted-state-events but that would require conditional compilation flags all over the place.

@Hywan Hywan merged commit ca8b64e into matrix-org:main Aug 14, 2025
49 of 50 checks passed
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.

4 participants