Add SyncAutoRestore API and SyncRecovery key#7910
Merged
Conversation
Member
Author
e112155 to
7ccde5c
Compare
18 tasks
CrisBarreiro
approved these changes
Mar 10, 2026
25 tasks
aitorvs
pushed a commit
that referenced
this pull request
Mar 12, 2026
Task/Issue URL: https://app.asana.com/1/137249556945/project/1213488933349586/task/1213232213875729?focus=true ### Description Adds the `SyncAutoRestore` API and internal dev tooling for validating Block Store integration. **What's in this PR** (stacked on persistent-storage module) - `SyncAutoRestore` interface in `sync-api` with `canRestore()` and `restoreSyncAccount()` - `RealSyncAutoRestore` implementation, gated behind `syncAutoRestore` feature flag (defaults FALSE) - `SyncRecoveryPersistentStorageKey` — the key that will store the sync recovery code in Block Store (`shouldBackupToCloud = true`) - Internal settings Block Store section showing: feature flag status, availability, E2E encryption support, current stored value, write/clear controls - Unit tests for `RealSyncAutoRestore` **API proposal:** https://app.asana.com/1/137249556945/project/1202552961248957/task/1213554376592121 ### Steps to test this PR **QA optional** _Block Store dev tooling_ - [x] Install `internalRelease` on a device with Google Play Services - [x] Open App Settings → Internal Settings → Sync Internal Settings - [x] Verify Block Store section shows: feature flag status (disabled), availability, E2E status, current value "(key not set)" - [x] Enter text in input → tap Write → confirm toast "Stored successfully" and value updates - [x] Tap Clear → confirm toast "Cleared successfully" and value returns to "(key not set)" <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Introduces a new cloud-backup persistent storage key for sync recovery data and wires it into a new auto-restore capability check; misconfiguration could impact sensitive data handling. Functional impact is limited by a default-off feature flag and restore being unimplemented. > > **Overview** > Adds a new `SyncAutoRestore` API plus `RealSyncAutoRestore` implementation, gated behind a new `syncAutoRestore` feature flag (default **off**), where `canRestore()` checks for a stored recovery token in persistent storage and `restoreSyncAccount()` is currently a stub. > > Introduces `SyncRecoveryPersistentStorageKey` (configured with `shouldBackupToCloud = true`) and expands Sync Internal Settings with a **Block Store** section to display flag/availability/E2E support and to read/write/clear the stored value for validation. Includes unit tests covering `canRestore()` behavior under flag and storage success/failure conditions. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit e112155. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: Craig Russell <1336281+CDRussell@users.noreply.github.com>
This was referenced Mar 13, 2026
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.

Task/Issue URL: https://app.asana.com/1/137249556945/project/1213488933349586/task/1213232213875729?focus=true
Description
Adds the
SyncAutoRestoreAPI and internal dev tooling for validating Block Store integration.What's in this PR (stacked on persistent-storage module)
SyncAutoRestoreinterface insync-apiwithcanRestore()andrestoreSyncAccount()RealSyncAutoRestoreimplementation, gated behindsyncAutoRestorefeature flag (defaults FALSE)SyncRecoveryPersistentStorageKey— the key that will store the sync recovery code in Block Store (shouldBackupToCloud = true)RealSyncAutoRestoreAPI proposal: https://app.asana.com/1/137249556945/project/1202552961248957/task/1213554376592121
Steps to test this PR
QA optional
Block Store dev tooling
internalReleaseon a device with Google Play ServicesNote
Medium Risk
Introduces a new cloud-backup persistent storage key for sync recovery data and wires it into a new auto-restore capability check; misconfiguration could impact sensitive data handling. Functional impact is limited by a default-off feature flag and restore being unimplemented.
Overview
Adds a new
SyncAutoRestoreAPI plusRealSyncAutoRestoreimplementation, gated behind a newsyncAutoRestorefeature flag (default off), wherecanRestore()checks for a stored recovery token in persistent storage andrestoreSyncAccount()is currently a stub.Introduces
SyncRecoveryPersistentStorageKey(configured withshouldBackupToCloud = true) and expands Sync Internal Settings with a Block Store section to display flag/availability/E2E support and to read/write/clear the stored value for validation. Includes unit tests coveringcanRestore()behavior under flag and storage success/failure conditions.Written by Cursor Bugbot for commit e112155. Configure here.