Improve dependency version flexibility for eventcore-sqlite consumers #378
Labels
No labels
adr
automated
bug
chore
dependencies
documentation
enhancement
epic
github-actions
P1-high
P2-medium
P3-low
release
research
rust
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jwilger/eventcore#378
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
eventcore-sqlitecurrently forces dependency constraints on consumers in two ways:encryptionfeature pulls inrusqlite/bundled-sqlcipher-vendored-openssl, statically linking a vendored SQLCipher (a SQLite fork) and OpenSSL. Any downstream crate that also pulls in rusqlite/sqlite/openssl native code can hit symbol conflicts at link time — not just type incompatibility.rusqlite, so consumers who want to construct connections must declare their ownrusqlitedependency, creating the possibility of a version mismatch with whatevereventcore-sqlitewas built against. In practice this has caused at least one downstream project to consider downgradingrusqliteto align witheventcore-sqlite.eventcore-postgresdoes not have this issue (sqlx + rustls is pure Rust, no native linking).Proposed Changes
1. Make
encryptionnon-defaultConsumers who want encryption opt in. Everyone else gets to choose their own
rusqlitefeatures (or use system sqlite). This sidesteps the worst class of native-link conflicts entirely for consumers who don't need encryption.This is technically a breaking change for the default-feature surface; should land in a 0.x minor bump with a clear migration note.
2. Re-export
rusqlitefromeventcore-sqliteConsumers write
use eventcore_sqlite::rusqlite::Connectionand never declarerusqlitethemselves in the common case. There is nothing to mismatch.3. Add a "bring-your-own-connection" constructor
Currently
eventcore-sqliteconstructs the connection internally. Add a constructor that accepts an already-constructedrusqlite::Connection(or pool) so consumers who need fine-grained control over connection setup (custom pragmas, attached databases, encryption keys) can wire it themselves. Keep the convenience constructor for the simple case.The Rust type system enforces version compatibility for free here: if the consumer's
rusqlite::Connectiontype doesn't unify with ours, they get a compile error at the call site, not a runtime failure.4. Document the version compatibility contract
Add a README section explicitly stating:
rusqliteversion eacheventcore-sqliterelease is built againsteventcore_sqlite::rusqlitere-export rather than declaringrusqlitedirectlyencryptionfeature (vendored OpenSSL/SQLCipher native linking)5. Use permissive version ranges
Confirm
rusqlite = "0.32"(not"=0.32.x") so cargo can unify across the full0.32.*range. Already true today; preserve as a convention.Generalization (Future Consideration)
The same pattern applies to any backend crate wrapping a third-party dep:
This issue is scoped to
eventcore-sqlite. Ifeventcore-postgresever grows native-linked features, the same conventions should apply there.Acceptance Criteria
encryptionis no longer a default feature ofeventcore-sqliteeventcore-sqlitere-exportsrusqliteat the crate rootrusqlite::Connectionfrom the consumer