fix(sqlite): invalidate engine cache on snapshot restore#1833
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | 20e2e90 | Commit Preview URL | Jun 02 2026, 09:32 AM |
838f83b to
20e2e90
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.
Motivation
Bash::restore_snapshot(), enabling stale DB state to be read or flushed back into a restored VFS.Description
reset_session_state()(default no-op) to clear hidden per-instance state and wire it into the interpreter asreset_builtin_session_state()called fromrestore_snapshotafter VFS restoration.reset_session_state()for theSqlitebuiltin to clear the per-databaseengine_cache.Vfsengine with a unique Turso-internal path and aBashkitVfsIOalias that maps the Turso path back to the caller VFS path, preventing Turso's process-level registry from resurrecting stale engines.BashkitVfsIOand extendSqliteEngine::snapshot_bytes()to consult VFS-backed buffers so cache invalidation checks can compare current VFS bytes.Bashand assert the SQLite cache is invalidated for bothMemoryandVfsbackends, and updatespecs/sqlite-builtin.mdto document the new guarantee.Testing
cargo fmt --all -- --checkand it succeeded.cargo test --features sqlite -p bashkit --test integration snapshot_restore_into_existing_bash_clears_sqlite_cache -- --nocaptureand they passed.cargo test --features sqlite -p bashkit --test integration sqlite_integration_tests -- --nocaptureand all tests passed.cargo clippyfor the SQLite feature and it passed with zero warnings treated as errors.Codex Task