X Tutup
Skip to content

Add SyncAutoRestore API and SyncRecovery key#7910

Open
CDRussell wants to merge 1 commit intodevelopfrom
feature/craig/sync-auto-restore-api
Open

Add SyncAutoRestore API and SyncRecovery key#7910
CDRussell wants to merge 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.

Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@CDRussell CDRussell marked this pull request as ready for review March 9, 2026 13:04
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

X Tutup