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

chore(sdk): Remove RoomListEntry and ops in Sliding Sync #3664

Merged
merged 1 commit into from
Jul 10, 2024

Conversation

Hywan
Copy link
Member

@Hywan Hywan commented Jul 8, 2024

This patch removes everything related to the computation of ops from a sliding sync response. With the recent RoomList's client-side sorting project, we no longer need to handle these ops. Moreover, the simplified sliding sync specification that is coming removes the ops.

A SlidingSyncList was containing a rooms field. It's removed by this patch. Consequently, all the SlidingSyncList::room_list and ::room_list_stream methods are also removed.

A FrozenSlidingSyncList was containing the FrozenSlidingSyncRoom. This patch moves the FrozenSlidingSyncRooms inside FrozenSlidingSync. Why is it still correct? We only want to keep the SlidingSyncRoom::timeline_queue in the cache for the moment (until the EventCache has a persistent storage). Since a SlidingSyncList no longer holds any information about the rooms, and since SlidingSync itself has all the SlidingSyncRoom, this move is natural and still valid.

Bye bye all this code :'-).


@Hywan Hywan requested a review from a team as a code owner July 8, 2024 15:51
@Hywan Hywan requested review from andybalaam and removed request for a team July 8, 2024 15:51
@Hywan Hywan mentioned this pull request Jul 8, 2024
32 tasks
@Hywan Hywan force-pushed the feat-sdk-sliding-sync-remove-ops branch from 68e5b70 to 37c4522 Compare July 8, 2024 15:57
Copy link

codecov bot commented Jul 8, 2024

Codecov Report

Attention: Patch coverage is 96.87500% with 1 line in your changes missing coverage. Please review.

Project coverage is 84.26%. Comparing base (02dddb4) to head (cd8dc22).

Files Patch % Lines
crates/matrix-sdk/src/sliding_sync/cache.rs 90.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3664      +/-   ##
==========================================
- Coverage   84.27%   84.26%   -0.01%     
==========================================
  Files         259      258       -1     
  Lines       26662    26530     -132     
==========================================
- Hits        22469    22356     -113     
+ Misses       4193     4174      -19     

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

This patch removes everything related to the computation of `ops`
from a sliding sync response. With the recent `RoomList`'s client-side
sorting project, we no longer need to handle these `ops`. Moreover, the
simplified sliding sync specification that is coming removes the `ops`.

A `SlidingSyncList` was containing a `rooms` field. It's removed by
this patch. Consequently, all the `SlidingSyncList::room_list` and
`::room_list_stream` methods are also removed.

A `FrozenSlidingSyncList` was containing the `FrozenSlidingSyncRoom`.
This patch moves the `FrozenSlidingSyncRoom`s inside
`FrozenSlidingSync`. Why is it still correct? We only want to keep the
`SlidingSyncRoom::timeline_queue` in the cache for the moment (until
the `EventCache` has a persistent storage). Since a `SlidingSyncList`
no longer holds any information about the rooms, and since `SlidingSync`
itself has all the `SlidingSyncRoom`, this move is natural and still
valid.

Bye bye all this code :'-).
@Hywan Hywan force-pushed the feat-sdk-sliding-sync-remove-ops branch from 37c4522 to cd8dc22 Compare July 9, 2024 07:57
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.

Yay for deleting code!

@Hywan Hywan merged commit d78b682 into matrix-org:main Jul 10, 2024
40 checks passed
Hywan added a commit to Hywan/matrix-rust-sdk that referenced this pull request Aug 12, 2024
The patch matrix-org#2395 has
introduced `SlidingSyncInner::past_positions` as a mechanism to filter
duplicated responses. It was a problem because the sliding sync `ops`
could easily create corrupted states if they were applied more than
once.

Since matrix-org#3664, `ops`
are ignored.

Now, `past_positions` create a problem with the sliding sync native
implementation inside Synapse because `pos` can stay the same between
multiple responses.

While `past_positions` was helpful to fix bugs in the past, it's no
longer necessary today. Moreover, it breaks an invariant about `pos`: we
must consider it as a blackbox. It means we must ignore if a `pos` value
has been received in the past or not. This invariant has been broken for
good reasons, but it now creates new issues.

This patch removes `past_positions`, along with the associated code
(like `Error::ResponseAlreadyReceived` for example).
Hywan added a commit to Hywan/matrix-rust-sdk that referenced this pull request Aug 12, 2024
The patch matrix-org#2395 has
introduced `SlidingSyncInner::past_positions` as a mechanism to filter
duplicated responses. It was a problem because the sliding sync `ops`
could easily create corrupted states if they were applied more than
once.

Since matrix-org#3664, `ops`
are ignored.

Now, `past_positions` create a problem with the sliding sync native
implementation inside Synapse because `pos` can stay the same between
multiple responses.

While `past_positions` was helpful to fix bugs in the past, it's no
longer necessary today. Moreover, it breaks an invariant about `pos`: we
must consider it as a blackbox. It means we must ignore if a `pos` value
has been received in the past or not. This invariant has been broken for
good reasons, but it now creates new issues.

This patch removes `past_positions`, along with the associated code
(like `Error::ResponseAlreadyReceived` for example).
Hywan added a commit that referenced this pull request Aug 12, 2024
The patch #2395 has
introduced `SlidingSyncInner::past_positions` as a mechanism to filter
duplicated responses. It was a problem because the sliding sync `ops`
could easily create corrupted states if they were applied more than
once.

Since #3664, `ops`
are ignored.

Now, `past_positions` create a problem with the sliding sync native
implementation inside Synapse because `pos` can stay the same between
multiple responses.

While `past_positions` was helpful to fix bugs in the past, it's no
longer necessary today. Moreover, it breaks an invariant about `pos`: we
must consider it as a blackbox. It means we must ignore if a `pos` value
has been received in the past or not. This invariant has been broken for
good reasons, but it now creates new issues.

This patch removes `past_positions`, along with the associated code
(like `Error::ResponseAlreadyReceived` for example).
bnjbvr pushed a commit that referenced this pull request Aug 12, 2024
The patch #2395 has
introduced `SlidingSyncInner::past_positions` as a mechanism to filter
duplicated responses. It was a problem because the sliding sync `ops`
could easily create corrupted states if they were applied more than
once.

Since #3664, `ops`
are ignored.

Now, `past_positions` create a problem with the sliding sync native
implementation inside Synapse because `pos` can stay the same between
multiple responses.

While `past_positions` was helpful to fix bugs in the past, it's no
longer necessary today. Moreover, it breaks an invariant about `pos`: we
must consider it as a blackbox. It means we must ignore if a `pos` value
has been received in the past or not. This invariant has been broken for
good reasons, but it now creates new issues.

This patch removes `past_positions`, along with the associated code
(like `Error::ResponseAlreadyReceived` for example).
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