close
Skip to content

fix(sdk): The LatestEventValue is erased when a room has been emptied#6035

Merged
Hywan merged 2 commits into
matrix-org:mainfrom
Hywan:fix-issue-5317
Jan 16, 2026
Merged

fix(sdk): The LatestEventValue is erased when a room has been emptied#6035
Hywan merged 2 commits into
matrix-org:mainfrom
Hywan:fix-issue-5317

Conversation

@Hywan
Copy link
Copy Markdown
Member

@Hywan Hywan commented Jan 16, 2026

This patch is twofold:

  1. It ensures that a LatestEventValue is erased when a room has been emptied,
  2. It implements a test for Ignoring a user doesn't remove their messages from the room list #5317: the LatestEventValue is re-computed when a user is ignored.

Best to review one patch at a time.


@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Jan 16, 2026

Merging this PR will not alter performance

✅ 50 untouched benchmarks


Comparing Hywan:fix-issue-5317 (c739600) with main (92a7d03)

Open in CodSpeed

@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 16, 2026

Codecov Report

❌ Patch coverage is 97.89474% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.93%. Comparing base (92a7d03) to head (c739600).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...trix-sdk/src/latest_events/latest_event/builder.rs 97.89% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6035      +/-   ##
==========================================
- Coverage   88.93%   88.93%   -0.01%     
==========================================
  Files         358      358              
  Lines       99177    99272      +95     
  Branches    99177    99272      +95     
==========================================
+ Hits        88204    88287      +83     
- Misses       6992     7000       +8     
- Partials     3981     3985       +4     

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

@Hywan Hywan marked this pull request as ready for review January 16, 2026 10:12
@Hywan Hywan requested a review from a team as a code owner January 16, 2026 10:12
@Hywan Hywan requested review from poljar and removed request for a team January 16, 2026 10:12
Copy link
Copy Markdown
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.

Makes sense, please just clarify the comment about what's happening bit.

Comment thread crates/matrix-sdk/src/latest_events/latest_event/builder.rs
Hywan added 2 commits January 16, 2026 14:43
This patch ensures that a `LatestEventValue` is erased when a room has
been emptied.

If we are computing a value from the Event Cache, it's because we
have received an update from the Event Cache. This update falls in two
categories: either an event has been added or updated, or the room has
been emptied. We consider the room has been emptied by default. If we
are able to scan at least one in-memory event, we consider the room has
not been emptied.

This patch adds one specific, and updates other tests that were using
an empty Event Cache (which now produces a different result in this
situation).
This patch adds a test to ensure the `LatestEventValue` is re-computed
(more specifically: erased) when a user is ignored.
@Hywan Hywan merged commit e9f5ed1 into matrix-org:main Jan 16, 2026
52 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.

Ignoring a user doesn't remove their messages from the room list

2 participants