Skip to content

Conversation

@mgoldenberg
Copy link
Contributor

NOTE: this should not be merged until matrix-org/rust-indexed-db#1 is merged! The [patch] in this branch should point to the official matrix-org fork of rust-indexed_db, but is currently pointed at my personal fork.

Background

This pull request makes updates indexed_db_futures in the matrix-sdk-indexeddb crate. The reason we'd like to update this dependency is because the version currently used does not fully support the Chrome browser (see #5420).

The latest version of indexed_db_futures has significant changes. Many of these changes can be integrated without issue. There is, however, a single change which is incompatible with the matrix-sdk-indexeddb crate. Namely, one cannot access the active transaction in the callback to update the database (for details, see Alorel/rust-indexed-db#66).

An Updated Proposal

Originally, new migrations were implemented in order to work around this issue (see #5467). However, the proposal was ultimately rejected (see @andybalaam's comment).

For this reason, the dependency has instead been [patch]ed in the top-level Cargo.toml with a modified version of indexed_db_futures (see matrix-org/rust-indexed-db#1). Furthermore, these changes have been proposed to the maintainer and are awaiting feedback (see Alorel/rust-indexed-db#72).

Why do we need the active transaction in our migrations?

The crypto_store module provides access to the active transaction to its migrations (see here). Furthermore, there is a single migration (v11_to_v12) in the crypto_store module which actually makes use of the active transaction (see here).

For clarity, the reason v11_to_v12 is problematic in the latest versions of indexed_db_futures is because it is simply adding an index to an object store which was created in a different migration and this requires access to the active transaction. All the other migrations create object stores and indices in the same migration, which does not suffer from the same issue.

Changes

  • Move indexed_db_futures to the workspace Cargo.toml and add a [patch] so that it points to a modified version.
  • Add GenericError type and conversions in order to more easily map indexed_db_futures errors into matrix-sdk-* errors.
  • Update all IndexedDB interactions so that they use the upgraded interface provided by indexed_db_futures
  • Add functionality for running wasm-pack tests against Chrome

Closes #5420.


  • Public API changes documented in changelogs (optional)

Signed-off-by: Michael Goldenberg m@mgoldenberg.net

Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
…nd errors for each store

Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
…firefox

Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
@codecov
Copy link

codecov bot commented Sep 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.41%. Comparing base (5b52c72) to head (9ad64d6).
⚠️ Report is 44 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5722   +/-   ##
=======================================
  Coverage   88.40%   88.41%           
=======================================
  Files         359      359           
  Lines       99060    99060           
  Branches    99060    99060           
=======================================
+ Hits        87574    87579    +5     
+ Misses       7347     7342    -5     
  Partials     4139     4139           

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

@codspeed-hq
Copy link

codspeed-hq bot commented Sep 26, 2025

CodSpeed Performance Report

Merging #5722 will not alter performance

Comparing mgoldenberg:upgrade-indexed-db-futures (9ad64d6) with main (681b221)

Summary

✅ 50 untouched

Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
@mgoldenberg mgoldenberg marked this pull request as ready for review September 27, 2025 23:25
@mgoldenberg mgoldenberg requested a review from a team as a code owner September 27, 2025 23:25
@mgoldenberg mgoldenberg requested review from Hywan and removed request for a team September 27, 2025 23:25
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.

Please, use the Matrix Rust SDK's fork. Apart from that, I think we are good! Thanks the tremendous work!

@mgoldenberg mgoldenberg requested a review from Hywan October 1, 2025 15:45
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.

Looks good to me.

.get_all()
.await?
.iter()
.filter_map(Result::ok)
Copy link
Member

Choose a reason for hiding this comment

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

It means that we ignore rows containing an error. I'm okay with that, but I don't know if that was the behaviour before though.

.get_all()
.await?
.iter()
.filter_map(Result::ok)
Copy link
Member

Choose a reason for hiding this comment

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

Same here.

@Hywan Hywan merged commit 2e6790d into matrix-org:main Oct 3, 2025
53 of 54 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.

matrix-sdk-indexeddb is only tested against Firefox

2 participants