Skip to content

Add SyncAutoRestore API and SyncRecovery key#7910

Merged
CDRussell merged 1 commit intodevelopfrom
feature/craig/sync-auto-restore-api
Mar 11, 2026
Merged

Add SyncAutoRestore API and SyncRecovery key#7910
CDRussell merged 1 commit intodevelopfrom
feature/craig/sync-auto-restore-api

Conversation

@CDRussell
Copy link
Member

@CDRussell CDRussell commented Mar 9, 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

  • Install internalRelease on a device with Google Play Services
  • Open App Settings → Internal Settings → Sync Internal Settings
  • Verify Block Store section shows: feature flag status (disabled), availability, E2E status, current value "(key not set)"
  • Enter text in input → tap Write → confirm toast "Stored successfully" and value updates
  • Tap Clear → confirm toast "Cleared successfully" and value returns to "(key not set)"

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.

Written by Cursor Bugbot for commit e112155. Configure here.

@CDRussell CDRussell force-pushed the feature/craig/sync-auto-restore-api branch from e112155 to 7ccde5c Compare March 10, 2026 10:50
@CDRussell CDRussell merged commit 0de6049 into develop Mar 11, 2026
18 checks passed
@CDRussell CDRussell deleted the feature/craig/sync-auto-restore-api branch March 11, 2026 15:50
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants