Skip to content

Headless sync recovery implementation#7941

Merged
CDRussell merged 1 commit intodevelopfrom
feature/craig/sync-auto-recovery-headless-sync-setup
Mar 18, 2026
Merged

Headless sync recovery implementation#7941
CDRussell merged 1 commit intodevelopfrom
feature/craig/sync-auto-recovery-headless-sync-setup

Conversation

@CDRussell
Copy link
Member

@CDRussell CDRussell commented Mar 11, 2026

Task/Issue URL: https://app.asana.com/1/137249556945/project/72649045549333/task/1211766481496464?focus=true

Description

Adds in the headless sync setup using the persisted sync recovery key.

This is still gated by the syncAutoRestore feature flag which remains disabled for now (you'll need to update this manually for some of the tests)

Steps to test this PR

Notes

  • Prerequisites: Internal build installed on a device with Google Play Services, logged into Google account.
  • Navigate to Settings > Sync Dev Settings to access Block Store controls.
  • ℹ️ Clearing data and relaunching the app does not restore Block Store data; it has to be an uninstall/reinstall.
  • Suggested logcat filter: Sync-Recovery|Sync-AutoRestore

Scenario 1: Feature flag OFF (default) — no restore offered regardless of stored key

  • Fresh install
  • Launch app and verify the "Restore" dialog is not shown, normal onboarding flow proceeds
  • go to Sync Dev Settings and write any string to Block Store
  • Uninstall and reinstall (do not clear app data)
  • Launch app and verify the "Restore" dialog is still not shown (because flag is off)

Scenario 2: Feature flag ON, no recovery key — no restore offered

  • Apply the patch defined below to hardcode syncAutoRestore to be enabled, and install
  • Clear app data to ensure Block Store has no data
  • Launch app — verify the "Restore" dialog is not shown, normal onboarding proceeds

Scenario 3: Feature flag ON, recovery key present — user accepts restore

  • Keep the hardcoded FF enabled changes from before
  • Save a password or two
  • Set up Sync on the device, using Sync & Backup -> Sync & Back Up This Device and copy the recovery key when it's available using the Copy code button
  • Paste the recovery key into Block Store via Sync Dev Settings and use the Write button to persist it
  • Uninstall and reinstall (do not clear app data)
  • Go through onboarding — verify the "Restore" dialog is shown
  • Tap "Restore My Stuff" — verify onboarding continues normally (e.g., comparison chart shown next)
  • Complete onboarding, then go to Settings > Sync — verify sync account is re-established
  • Verify previous password is available

Scenario 4: Feature flag ON, recovery key present — user skips restore

  • Repeat setup from Scenario 3 (to get a valid recovery code in Block Store, uninstall and then reinstall)
  • Launch app — verify the "Restore" dialog is shown
  • Tap "Skip" button from that dialog — verify you see the Got it! I'll skip other tips dialog
  • Complete onboarding, then go to Settings > Sync — verify sync is not set up

Scenario 5: Invalid code persisted

  • Use Sync Dev Settings to write an invalid recovery code (e.g., a few random characters)
  • Uninstall and reinstall (do not clear app data)
  • Launch app — verify the "Restore" dialog is shown
  • Tap Restore My Stuff. Verify the UX continues normally and in logs you see Sync-Recovery: restore failed

Patch to enable FF for syncAutoRestore

Index: sync/sync-impl/src/main/java/com/duckduckgo/sync/impl/SyncFeature.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/sync/sync-impl/src/main/java/com/duckduckgo/sync/impl/SyncFeature.kt b/sync/sync-impl/src/main/java/com/duckduckgo/sync/impl/SyncFeature.kt
--- a/sync/sync-impl/src/main/java/com/duckduckgo/sync/impl/SyncFeature.kt	(revision Staged)
+++ b/sync/sync-impl/src/main/java/com/duckduckgo/sync/impl/SyncFeature.kt	(date 1773231063963)
@@ -78,6 +78,6 @@
     @Toggle.DefaultValue(DefaultFeatureValue.TRUE)
     fun syncAutoRecoveryCapabilityDetectionRead(): Toggle
 
-    @Toggle.DefaultValue(DefaultFeatureValue.FALSE)
+    @Toggle.DefaultValue(DefaultFeatureValue.INTERNAL)
     fun syncAutoRestore(): Toggle
 }

@CDRussell CDRussell force-pushed the feature/craig/sync-auto-recovery-headless-sync-setup branch from 1ceb7b9 to 9fd5859 Compare March 11, 2026 11:34
Base automatically changed from feature/craig/sync-auto-recovery-onboarding-key-detection to develop March 11, 2026 16:17
@CDRussell CDRussell force-pushed the feature/craig/sync-auto-recovery-headless-sync-setup branch from 9fd5859 to 10a0d20 Compare March 11, 2026 17:10
@CDRussell CDRussell marked this pull request as ready for review March 11, 2026 17:34
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@CDRussell CDRussell force-pushed the feature/craig/sync-auto-recovery-headless-sync-setup branch from 62f6080 to 7dbbbcd Compare March 18, 2026 11:37
@CDRussell CDRussell merged commit ef2008f into develop Mar 18, 2026
8 checks passed
Copy link
Member Author

Merge activity

@CDRussell CDRussell deleted the feature/craig/sync-auto-recovery-headless-sync-setup branch March 18, 2026 12:01
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