fix(database): add native reliability validation#540
Merged
Conversation
- add file-based backup/restore helpers and malformed-file recovery for the native Drift database - cover sqlite pragmas, backup round trips, corruption recovery, and larger history restores with deterministic tests - add a shared make target and release runbook for database reliability validation This turns issue #516 into a reproducible database-reliability slice on top of current main.
Contributor
Plugin Module Size GatePolicy: modules over 3 MB must be delivered as plugins; plugin modules over 5 MB must document cache management.
|
Contributor
🚀 PR Quick Check Summary
|
|
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.



fix(database): add native reliability validation
Summary
This PR introduces changes to the native database reliability contract.
Goal: make local database backup/restore and malformed-file recovery deterministic and verifiable on current main.
Core outcome:
Changes
Code
Added:
make test-database-reliabilitytargetUpdated:
AppDatabasewith path-based construction, backup restore helpers, WAL-aware export, and malformed-file recoveryLogic
API Changes (if any)
AppDatabasenow accepts an optional native database path.AppDatabase.restoreBackup(...)andrestoreDatabase(...)are added for backup restore flows.Database Changes (if any)
Observability / Logging
Performance Impact
Risks
malformed-file detection currently targets obvious non-SQLite files rather than deeper logical corruption
backup export now performs a checkpoint, which is correct for durability but should remain limited to explicit backup paths
Rollback plan:
Testing
Unit tests:
flutter test test/core/database/app_database_reliability_test.dartIntegration tests:
Manual testing:
adb devices -lconfirms a reachable Pixel 9 for device-only follow-up checksDeployment Notes
Config changes:
Order of deployment:
mainRelated Commits
fix(database): add native reliability validationNotes
docs/release/DATABASE_RELIABILITY_VALIDATION.md.