Skip to content

Conversation

@mgoldenberg
Copy link
Contributor

@mgoldenberg mgoldenberg commented Dec 5, 2025

Background

This pull request is part of a series of pull requests to add a full IndexedDB implementation of the EventCacheStore and MediaStore (see #4617, #4996, #5090, #5138, #5226, #5274, #5343, #5384, #5406, #5414, #5497, #5506, #5540, #5574, #5603, #5676, #5682, #5749, #5795). This particular pull request fixes a number of bugs related to encrypted stores and their tests.

The primary issue is that the encrypted tests were being run without a StoreCipher for both the EventCacheStore and the MediaStore. Furthermore, once the StoreCipher is initialized for these tests, some of the EventCacheStore tests were failing.

Changes

Initialize StoreCipher in encrypted tests

This is pretty simple, just add a StoreCipher to event_cache_store::tests::encrypted::get_event_cache_store and media_store::tests::encrypted::get_media_store.

Fix failing tests in EventCacheStore

A number of tests began to fail when introducing encryption to the EventCacheStore.

  • event_cache_store_integration_tests::test_get_room_events
  • event_cache_store_integration_tests::test_get_room_events_filtered
  • event_cache_store_integration_tests::test_remove_room

These tests failed because the constants representing the uppermost and lowermost possible bounds of an EventId were being encrypted when constructing a query for all events in a room. Once encrypted, these constants no longer represented the uppermost and lowermost possible bounds of an EventId.

The solution is to not encrypt these constant values, as they lose their purpose once encrypted.

Future Work

  • Expose EventCacheStore and MediaStore outside of the matrix-sdk-indexeddb

  • Public API changes documented in changelogs (optional)

Signed-off-by: Michael Goldenberg [email protected]

… cache and media store

Note that the encrypted tests were actually being run unencrypted.
Introducing a store cipher causes them to run encrypted, and
furthermore, reveals some bugs which are only visible when running
an encrypted event cache store.

Signed-off-by: Michael Goldenberg <[email protected]>
In the implementation of EventCacheStore, there are a number of
places where the upper and lower bounds of an EventId are
constructed. It is important to bypass hashing and encryption
when constructing these bounds, otherwise the values will be
modified and will no longer represent the bounds.

Signed-off-by: Michael Goldenberg <[email protected]>
@mgoldenberg mgoldenberg requested a review from a team as a code owner December 5, 2025 18:26
@mgoldenberg mgoldenberg requested review from Hywan and removed request for a team December 5, 2025 18:26
Signed-off-by: Michael Goldenberg <[email protected]>
@codspeed-hq
Copy link

codspeed-hq bot commented Dec 5, 2025

CodSpeed Performance Report

Merging #5933 will not alter performance

Comparing mgoldenberg:indexeddb-event-cache-and-media-store-encrypted-tests (0ad56ae) with main (238e4e8)

Summary

✅ 50 untouched

@codecov
Copy link

codecov bot commented Dec 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.49%. Comparing base (238e4e8) to head (fd0f854).
⚠️ Report is 8 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5933      +/-   ##
==========================================
- Coverage   88.50%   88.49%   -0.01%     
==========================================
  Files         362      362              
  Lines      103291   103291              
  Branches   103291   103291              
==========================================
- Hits        91413    91405       -8     
- Misses       7535     7544       +9     
+ Partials     4343     4342       -1     

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

@codspeed-hq
Copy link

codspeed-hq bot commented Dec 5, 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.

Copy link
Member

@Hywan Hywan left a comment

Choose a reason for hiding this comment

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

Thanks! Look super great!

@Hywan Hywan merged commit acf3a7a into matrix-org:main Dec 9, 2025
52 of 53 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.

2 participants