Repository navigation
fix(restore): refuse newer-schema snapshots before swapping live data - #5649
Merged
thedotmack merged 4 commits intoNov 9, 2026
Merged
thedotmack merged 4 commits into
thedotmack merged 4 commits into
Conversation
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_019FbY8a4P6RjaWFnrGVZXnd
Owner
|
Merged, thank you @Afloat16! A restore now refuses a snapshot written by a newer schema before it touches anything, so the healthy live database stays in place instead of being swapped for one this version can't open. The WAL-only newer-stamp case was a sharp edge to cover. I merged main and dropped the generated bundles. |
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.
Summary
A snapshot can pass SQLite quick_check while carrying a schema newer than the installed binary understands. Restore currently installs that snapshot over a healthy database and reports success; the subsequent writer guard then refuses startup.
Pass the binary's existing LATEST_SCHEMA_VERSION into the staging standalone job. Read the staged database's actual user_version, including committed WAL state, and reject a newer stamp before the live database is checkpointed, backed up, or replaced. The error tells the caller to upgrade before restoring. Unstamped, older, and current-schema snapshots retain their existing restore behavior.
Validation
e6ff561f85377dc3b0dd3f1c731aeb74514ac075.