refactor: use unified connection [WPB-23775]#2303
Merged
Merged
Conversation
fewerner
force-pushed
the
prgn/refactor/23775-use-unified-connection
branch
8 times, most recently
from
July 15, 2026 07:08
924d5dd to
6410221
Compare
coriolinus
force-pushed
the
prgn/refactor/23775-use-unified-connection
branch
2 times, most recently
from
July 21, 2026 16:08
22f14e4 to
d793639
Compare
coriolinus
force-pushed
the
prgn/refactor/23775-use-unified-connection
branch
2 times, most recently
from
July 24, 2026 10:21
2cb4498 to
f9f6893
Compare
SimonThormeyer
approved these changes
Jul 24, 2026
Member
There was a problem hiding this comment.
I am amazed that this actually works. This is the greatest improvement to the keystore crate this year, if not ever.
Great work @fewerner @coriolinus!
We are now deprecating the old connection module in favor of the unified connection, and removing platform-specific code from the entity implementations. Unfortunately, we need to retain sufficient wasm code that we can still run enough of a migration to upgrade into the new unified entity database, and that means that we've got a whole rump of otherwise- useless code sitting in the legacy module. Can't be helped, unfortunately.
We're deprecating those in favor of the new `UnifiedEntity` traits and will eventually update the names to remove the `Unified*` prefix. The old traits still exist and are implemented in the `idb_migration::legacy` module.
We only need the new stuff now. Old implementations can live in the legacy module.
Just keeping things in parity with the old `Database` impl.
- rm now-obsolete trait implementations - move certain implementations out of the platform module - in general make the entities implement what they need inline
`Database` needs to be able to manage the `KeystoreTransaction` lifecycle, so we organize these methods centrally here.
Committing a transaction will now take the transaction and end it, no matter what the outcome is. Thus, it can't be rolled back here.
This test passes now on wasm using the same sql implementation.
Previously, this was implemented on the old connections.
An explicit close method used to be required to ensure that indexeddb would persist its final changes; it had no automatic sync-on-drop behavior. Now that the unified database has Sqlite behavior in all contexts, it finalizes on drop. At the same time, supporting a close method requires a design in which the internal connection can be taken out and dropped. So, as the initial need has vanished, and eliminating the close method means we can have a simpler internal implementation, we just do that.
pathStr start with`/private/var/` but location just starts with `/var/`
`getLocation` now returns the absolute path to the db file.
`getLocation` now returns the absolute path to the db file.
We successfully moved to a unified database layer and no longer distinguish between unified and not unified.
Previously this was doing the wrong thing when upgrading an old wasm database to bytes. This fixes it.
…r-provided relative path
We don't support that function internally at all anymore, but in order to prevent breaking changes we retain the stub as a noop.
coriolinus
force-pushed
the
prgn/refactor/23775-use-unified-connection
branch
from
July 24, 2026 11:24
f9f6893 to
9c89c82
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's new in this PR
Partially implements 23775. This accomplishes most of that PR, except for two more steps:
Unified*entity trait family traits to rm theUnifiedprefixOne issue I see right away: this new
Databasewraps a connection directly, where the old one wrapped aMutex<Option<Connection>>. This means we can no longer use theDatabase::closemethod, because it consumesselfand consumers all always have anArc<Database>.Whoever picks this up will need to either adjust that and all the access patterns, or determine that we can omit
closemethods entirely now.PR Submission Checklist for internal contributors
SQPIT-764feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764.