feat: add Tauri sqlite persisted collection package#1369
feat: add Tauri sqlite persisted collection package#1369samwillis wants to merge 3 commits intosamwillis/persistence-capacitorfrom
Conversation
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
More templates
@tanstack/angular-db
@tanstack/db
@tanstack/db-browser-wa-sqlite-persisted-collection
@tanstack/db-capacitor-sqlite-persisted-collection
@tanstack/db-electron-sqlite-persisted-collection
@tanstack/db-ivm
@tanstack/db-node-sqlite-persisted-collection
@tanstack/db-react-native-sqlite-persisted-collection
@tanstack/db-sqlite-persisted-collection-core
@tanstack/db-tauri-sqlite-persisted-collection
@tanstack/electric-db-collection
@tanstack/offline-transactions
@tanstack/powersync-db-collection
@tanstack/query-db-collection
@tanstack/react-db
@tanstack/rxdb-db-collection
@tanstack/solid-db
@tanstack/svelte-db
@tanstack/trailbase-db-collection
@tanstack/vue-db
commit: |
|
Size Change: 0 B Total Size: 110 kB ℹ️ View Unchanged
|
|
Size Change: 0 B Total Size: 4.23 kB ℹ️ View Unchanged
|
95f4d17 to
56598ba
Compare
Wrap the official Tauri SQL plugin in the shared SQLite persistence layer so persisted collections can run in Tauri apps without shipping repo-owned Rust code. Add contract coverage and a real Tauri conformance harness to validate the runtime integration end to end. Made-with: Cursor
2c620f1 to
b7c0267
Compare
kevin-dp
left a comment
There was a problem hiding this comment.
PR Review: #1369 — feat: add Tauri sqlite persisted collection package
Overall
Clean implementation. The driver correctly handles the Tauri SQL plugin's $N placeholder syntax (vs the standard ?), the persistence layer follows established patterns, and the e2e harness uses an HTTP callback server to communicate results from the Tauri process — a smart approach.
Issues to address
-
Missing runtime persistence contract test and persistence integration test — Every other persistence package (Browser, Electron, React Native, Capacitor) includes both a
*-runtime-persistence-contract.test.tsand a*-persistence.test.ts. This PR only has the driver contract and core adapter contract tests. The runtime persistence contract validates adapter caching, coordinator defaulting/override, and schema policy inference from sync mode — these aren't covered by the other two contract suites. -
5,700-line
Cargo.lockchecked into the repo — This is the Rust lockfile for the e2e Tauri app. It accounts for ~70% of the PR's additions. Consider adding it to.gitignorefor the e2e app (it will be regenerated on build), or at minimum confirm this is intentional since it adds significant noise to the repo and will need ongoing maintenance as Tauri/dependency versions change.
Worth considering
-
e2e/app/src/runtime-vitest.ts(545 lines) is duplicated verbatim from the Capacitor PR — Now that two packages need this, it's worth extracting into a shared location. -
convertSqlitePlaceholdersToTauriis a custom SQL parser (~70 lines) that handles quoting, escaping, and comments. It's well-implemented, but the test coverage is thin — only one test (keeps literal question marks untouched while binding positional parameters). Consider adding edge cases for?inside--line comments,/* */block comments, and escaped quotes (''), since the parser explicitly handles all three. -
tsconfig.jsonincludes"jsx": "react"— No JSX in this package; unnecessary.
Summary
Approve with changes — add the two missing test suites (runtime persistence contract + persistence integration) and decide on the Cargo.lock. The core driver and persistence implementations look correct. Also fix the failing CI tests.
Summary
@tauri-apps/plugin-sqlbacked Tauri SQLite persisted-collection package on top of the shared SQLite coreTest plan
pnpm --filter @tanstack/db-tauri-sqlite-persisted-collection testpnpm --filter @tanstack/db-tauri-sqlite-persisted-collection test:e2eMade with Cursor