build: configure rusqlite for building on wasm [WPB-23771]#1926
Merged
coriolinus merged 4 commits intomainfrom Mar 10, 2026
Merged
build: configure rusqlite for building on wasm [WPB-23771]#1926coriolinus merged 4 commits intomainfrom
coriolinus merged 4 commits intomainfrom
Conversation
Contributor
Author
|
Looks like it's currently failing on CI because How did this work in our demo? Simple, we didn't build refinery there. Looks like the path to victory here is to upgrade the |
It's harder to understand when individual dependencies get full sub-tables, so use inline tables for each of them, such that there is one relevant dependency table for each cfg setup.
Rusqlite and refinery get compiled unconditionally, but we only include sqlcipher in non-os-unknown (i.e. non-wasm) builds. For os-unknown (wasm) builds, we instead include `sqlite-wasm-rs` and `sqlite-wasm-vfs` and the `sqlite3mc` feature.
This necessitates depending on an unreleased revision of `refinery`, unfortunately.
In v0.38, rusqlite fixed a logical problem: casting values to/from unsigned 64-bit values was sometimes causing runtime errors, because internally sqlite only knows about signed 64-bit integers. The problem: rusqlite/rusqlite#1722 The fix: rusqlite/rusqlite#1732 This was a problem for us because we use u64s to represent timestamps in the keystore. This commit chooses to just add the feature flag which reenables the old behavior. We're not going to be maintaining this code anymore once the potential to overflow an i64 with a unix timestamp is a reasonable possibility, and we're not using that type in other contexts, so we should be fine. I did consider the alternative of changing the underlying type from u64 to i64. However, that would have meant a cascading series of pointless changes all the way up to the ffi layer, and it just did not seem worth it. So I rejected that for now.
a548e87 to
b013e63
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
Based on https://github.com/coriolinus/rusqlite-experiment/blob/main/ffi/Cargo.toml we have set up Sqlite to build in all target environments in the keystore.
PR Submission Checklist for internal contributors
SQPIT-764feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764.