Skip to content
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

refactor!(all the things): fuse SyncTimelineEvent into TimelineEvent #4568

Merged
merged 6 commits into from
Jan 22, 2025

Conversation

bnjbvr
Copy link
Member

@bnjbvr bnjbvr commented Jan 21, 2025

The breakiest of breaking changes:

  • The only difference was in their constructors; SyncTimelineEvent took a Raw<AnySyncTimelineEvent>, and TimelineEvent took a Raw<AnyTimelineEvent> that it immediately cast into Raw<AnySyncTimelineEvent>, so we can use both.
  • TimelineEvent had its push_actions optional, which is the right call; another commit makes that change, partially reverting some changes of the first commit, sorry!
  • SyncTimelineEvent is eventually renamed to TimelineEvent, but as the last commit suggests… maybe this could be plain called Event? (Would likely break some serialization formats that rely on type names)

@bnjbvr bnjbvr requested a review from a team as a code owner January 21, 2025 14:58
@bnjbvr bnjbvr requested review from poljar and removed request for a team January 21, 2025 14:58
Copy link

codecov bot commented Jan 21, 2025

Codecov Report

Attention: Patch coverage is 88.70968% with 7 lines in your changes missing coverage. Please review.

Project coverage is 85.41%. Comparing base (a528624) to head (a66fa24).
Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
...es/matrix-sdk-common/src/deserialized_responses.rs 62.50% 3 Missing ⚠️
crates/matrix-sdk-base/src/read_receipts.rs 60.00% 2 Missing ⚠️
crates/matrix-sdk-base/src/latest_event.rs 80.00% 1 Missing ⚠️
crates/matrix-sdk/src/room/mod.rs 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4568      +/-   ##
==========================================
- Coverage   85.42%   85.41%   -0.01%     
==========================================
  Files         285      285              
  Lines       32222    32211      -11     
==========================================
- Hits        27525    27513      -12     
- Misses       4697     4698       +1     

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

Copy link
Contributor

@poljar poljar left a comment

Choose a reason for hiding this comment

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

I think this makes sense and looks good as well. Please just add the missing PR links to the changelog entries.

@@ -11,6 +11,9 @@ All notable changes to this project will be documented in this file.
- Replaced `Room::compute_display_name` with the reintroduced `Room::display_name()`. The new
method computes a display name, or return a cached value from the previous successful computation.
If you need a sync variant, consider using `Room::cached_display_name()`.
- [**breaking**]: The reexported types `SyncTimelineEvent` and `TimelineEvent` have been fused into a single type
`TimelineEvent`, and its field `push_actions` has been made `Option`al (it is set to `None` when
we couldn't compute the push actions, because we lacked some information).
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a link to the PR introducing this change.

@@ -11,6 +11,9 @@ All notable changes to this project will be documented in this file.
- Replaced `Room::compute_display_name` with the reintroduced `Room::display_name()`. The new
method computes a display name, or return a cached value from the previous successful computation.
If you need a sync variant, consider using `Room::cached_display_name()`.
- [**breaking**]: The reexported types `SyncTimelineEvent` and `TimelineEvent` have been fused into a single type
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- [**breaking**]: The reexported types `SyncTimelineEvent` and `TimelineEvent` have been fused into a single type
- [**breaking**]: The reexported types `SyncTimelineEvent` and `TimelineEvent` have been fused into a single type

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not against this change, but can I ask why we should do it like this? This will break the list into two lists, now, which seems counter to the point of having a list of changes.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't particularly care, but if you prefer the rendering without the extra newlines, then we shouldn't have them in the other changelog either.

@@ -6,6 +6,10 @@ All notable changes to this project will be documented in this file.

## [Unreleased] - ReleaseDate

- [**breaking**]: `SyncTimelineEvent` and `TimelineEvent` have been fused into a single type
`TimelineEvent`, and its field `push_actions` has been made `Option`al (it is set to `None` when
we couldn't compute the push actions, because we lacked some information).
Copy link
Contributor

Choose a reason for hiding this comment

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

Same, PR link please.

@@ -25,6 +25,10 @@ All notable changes to this project will be documented in this file.

### Refactor

- [**breaking**]: The reexported types `SyncTimelineEvent` and `TimelineEvent` have been fused into a single type
`TimelineEvent`, and its field `push_actions` has been made `Option`al (it is set to `None` when
we couldn't compute the push actions, because we lacked some information).
Copy link
Contributor

Choose a reason for hiding this comment

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

Another one.

@poljar
Copy link
Contributor

poljar commented Jan 22, 2025

maybe this could be plain called Event?

Eh, not so sure, we already have another Event<C> type in the crypto crate, people usually complain when we have multiple types with the same name.

As the comment noted, they're essentially doing the same thing. A
`TimelineEvent` may not have computed push actions, and in that regard
it seemed more correct than `SyncTimelineEvent`, so another commit will
make the field optional.
@bnjbvr bnjbvr force-pushed the bnjbvr/unify-timeline-events branch from 7fc8246 to 914f274 Compare January 22, 2025 17:18
@bnjbvr
Copy link
Member Author

bnjbvr commented Jan 22, 2025

Had to rebase for the new Lint CI job.

@bnjbvr bnjbvr force-pushed the bnjbvr/unify-timeline-events branch from 914f274 to a66fa24 Compare January 22, 2025 19:10
@bnjbvr bnjbvr enabled auto-merge (rebase) January 22, 2025 19:10
@bnjbvr bnjbvr merged commit 2d0f873 into main Jan 22, 2025
40 checks passed
@bnjbvr bnjbvr deleted the bnjbvr/unify-timeline-events branch January 22, 2025 19:24
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.

2 participants