feat: relocate vault backups to a managed folder with retention cap - #5
Merged
Conversation
|
React Doctor found no issues. 🎉
|
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
src/main/vault/backups.ts: vault backups now live underuserData/vault-backups/<sha256-of-vault-path>/instead of being dropped next to the vault file forever, with a hardcoded retention cap (MAX_BACKUPS_PER_VAULT = 3— oldest deleted first by mtime).confirmMigrationAndBackup(the shared helper from feat: add SQL schema version guard with migration confirmation parity #4) now callscreateVaultBackupinstead of an inlinecopyFileSync, so both header-version and schema-version migration backups land in the new location with descriptive names (<reason>-v<from>-to-v<to>-<timestamp>.nvx).useVaultCapabilitieshook — are removed.vault:migration-confirmed/vault:migration-cancelledwere synchronously nullingmigrationBackupTimestampright after resolving the pending migration promise. Since resolving a promise only schedules its continuation as a microtask (it doesn't run inline), this reset was winning the race every time — meaning the "create a backup" checkbox has silently never actually created a backup, since the confirmation dialog was wired up in feat: add SQL schema version guard with migration confirmation parity #4. Fixed by leaving the reset to the code that actually reads the flag.Test plan
pnpm dev: triggered a schema migration with the backup checkbox checked — confirmed (after the race-condition fix) the backup file lands under%APPDATA%\Notvex Dev\vault-backups\<hash>\with the new naming.toast.error("No backups yet."), no explorer opens.createVaultBackupexactly.pnpm validatepasses.