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

fix(room): make the room previews more reliable #4325

Merged
merged 3 commits into from
Nov 26, 2024
Merged

Conversation

bnjbvr
Copy link
Member

@bnjbvr bnjbvr commented Nov 26, 2024

This should help make room previews more reliable:

  • the behavior of Room::history_visibility was to always return an HistoryVisibility value, even when the event is missing. In case it was missing, it would return WorldReadable, which is against the spec, which states that it should be Shared, in that case.
  • as noted in ci: test_room_preview intermittently fails #3483 (comment), the m.room.create and m.room.history_visibility MUST be present to correctly calculate the room_type and is_world_readable fields from a RoomPreview.

Solution for 1 consists in splitting the method into two: one that returns an Option<HistoryVisibility>, and another that returns the better sensible default as specified by the spec.

Solution for 2 consists in adding those two events to the required_state list for the room list service. For sync v2, we're getting all the events anyways, so we should handle them correctly.

Fixes #3483.

@bnjbvr bnjbvr requested a review from a team as a code owner November 26, 2024 14:07
@bnjbvr bnjbvr requested review from stefanceriu and removed request for a team November 26, 2024 14:07
And introduce `Room::history_visibility_or_default()` to return a better
sensible default, according to the spec.
…sibility events

These two are required to properly compute the room preview of a joined
room:

- m.room.create ends up filling the `room_type` (space or not)
- m.room.history_visibility ends up filling the `is_world_readable`
  field.
@bnjbvr bnjbvr enabled auto-merge (rebase) November 26, 2024 14:23
@stefanceriu stefanceriu removed their request for review November 26, 2024 15:19
@bnjbvr
Copy link
Member Author

bnjbvr commented Nov 26, 2024

Latest fixup! commit includes a fix for the integration test; the behavior has slightly changed when we try to sync a room's members while being invited. If we don't know about the history visibility, we now assume it's "shared" instead of "world visible". As a result, we don't even run the request for sync_members(), which means what was a failure before (forward from the synapse server) becomes a soft pass (no request is spawn, sync_members() early returns Ok).

@bnjbvr bnjbvr merged commit 2c45316 into main Nov 26, 2024
38 of 39 checks passed
@bnjbvr bnjbvr deleted the bnjbvr/room-preview-fixes branch November 26, 2024 18:02
Copy link

codecov bot commented Nov 26, 2024

Codecov Report

Attention: Patch coverage is 80.00000% with 4 lines in your changes missing coverage. Please review.

Project coverage is 85.00%. Comparing base (c61f707) to head (3675c40).
Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
crates/matrix-sdk-base/src/client.rs 66.66% 2 Missing ⚠️
crates/matrix-sdk-base/src/rooms/normal.rs 80.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4325      +/-   ##
==========================================
- Coverage   85.07%   85.00%   -0.08%     
==========================================
  Files         275      275              
  Lines       30314    30320       +6     
==========================================
- Hits        25789    25772      -17     
- Misses       4525     4548      +23     

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

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.

ci: test_room_preview intermittently fails
2 participants