Skip to content

Conversation

@pwltr
Copy link
Contributor

@pwltr pwltr commented Jan 17, 2026

Summary of Fixes

Bug 1: Migration completion not checked during restore

Problem: After migration, users should only use VSS backups, but restoreFromMostRecentBackup() didn't check if migration was completed.

Fix: Added a check at the start of restoreFromMostRecentBackup() - if isMigrationCompleted is true, only use VSS backups and skip RN backup checks entirely.

Bug 2: Migration flag cleared during wipe

Problem: AppReset.wipe() clears all UserDefaults (line 37), which removes the rnMigrationCompleted flag. After wipe+restore, the app would check RN backups again.

Fix: Preserve the rnMigrationCompleted flag before wiping UserDefaults, then restore it after wipe. This ensures that if a user migrated before, they'll only use VSS backups after restore.

Bug 3: Aggressive fallback to RN when VSS timestamp unavailable

Problem: If VSS timestamp fetch failed (returned nil), the code would immediately fall back to RN backup, even though VSS backup might exist.

Fix: Improved the logic to prefer VSS even when timestamp is unavailable, with better logging to help debug timestamp fetch issues.

Changes Made

  1. MigrationsService.swift: Added isMigrationCompleted property and markMigrationCompleted() method
  2. AppScene.swift:
    • Added early return if migration was completed (only use VSS)
    • Improved logging for backup selection
    • Better handling when VSS timestamp is unavailable
  3. AppReset.swift: Preserve rnMigrationCompleted flag during wipe

Testing Recommendations

  1. Test scenario: User migrates from RN → uses native app → wipes → restores
    • Should only use VSS backup, not RN backup
  2. Test scenario: User migrates from RN → wipes → restores (no VSS backup yet)
    • Should use RN backup as fallback
  3. Test scenario: Fresh install (no migration) → restore
    • Should compare timestamps correctly

The fix ensures that once a user has migrated from RN, they'll always use VSS backups for restores, preventing the issue of restoring stale RN channel data.

@pwltr pwltr requested review from ben-kaufman and jvsena42 January 17, 2026 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants