Skip to content

fix: restrict restore sync policy to transfer and icloud restore#11211

Merged
originalix merged 5 commits intoxfrom
fix/restrict-restore-sync-policy
Apr 15, 2026
Merged

fix: restrict restore sync policy to transfer and icloud restore#11211
originalix merged 5 commits intoxfrom
fix/restrict-restore-sync-policy

Conversation

@sidmorizon
Copy link
Copy Markdown
Contributor

@sidmorizon sidmorizon commented Apr 14, 2026

Summary

  • limit applyRestoreSyncPolicy activation to Prime Transfer and iCloud backup restore flows
  • preserve existing behavior for regular account import, watching account import, wallet rename, and batch account creation flows
  • update restore-time sync item handling so metadata backfill only happens when the restore policy is explicitly enabled

Intent & Context

The goal of this change is to keep the new restore sync reconciliation logic scoped to the recovery flows that actually need it. The user request was to review and ensure the updated behavior only triggers during Transfer and iCloud import restore, while every other flow keeps its existing logic unchanged.

Root Cause

The restore-related sync policy needed to reuse server-side metadata when recovering wallets and accounts, but the supporting implementation lives in shared account and local DB layers. Without explicit gating, the same code paths could accidentally affect normal import, rename, or batch creation flows.

Design Decisions

  • Introduced an explicit applyRestoreSyncPolicy flag and threaded it through shared service and local DB entry points.
  • Kept the default path unchanged by branching all new behavior behind the restore-policy flag.
  • Applied the flag only from Prime Transfer and iCloud backup restore entry points.
  • Preserved existing cloud sync manager behavior when the restore policy callback is not provided.

Changes Detail

  • Updated local DB wallet/account/indexed-account creation and rename logic to reuse sync payload metadata only when restore policy is enabled.
  • Added restore-specific sync item timestamp backfill behavior to avoid changing normal sync semantics.
  • Passed the restore policy through Transfer HD wallet restore, imported account restore, watching account restore, and iCloud backup restore flows.
  • Kept event emission and change-history behavior aligned with actual metadata changes during restore.

Risk Assessment

  • Risk Level: Medium
  • Affected Platforms: Extension / Mobile / Desktop / Web
  • Risk Areas: shared restore flow plumbing in kit-bg, sync item generation, wallet/account rename side effects during recovery

Test plan

  • Verify Prime Transfer restore keeps cloud metadata for duplicated HD wallets and restored accounts
  • Verify iCloud backup restore keeps cloud metadata for duplicated wallets and restored accounts
  • Verify regular imported account and watching account flows behave the same as before
  • Verify normal batch HD account creation does not trigger restore-only sync behavior

Open with Devin

@revan-zhang
Copy link
Copy Markdown
Contributor

revan-zhang commented Apr 14, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

originalix
originalix previously approved these changes Apr 14, 2026
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@sidmorizon sidmorizon enabled auto-merge (squash) April 14, 2026 13:16
originalix
originalix previously approved these changes Apr 14, 2026
zhaono1
zhaono1 previously approved these changes Apr 14, 2026
devin-ai-integration[bot]

This comment was marked as resolved.

@sidmorizon sidmorizon dismissed stale reviews from originalix and zhaono1 via fef90ea April 14, 2026 13:44
@originalix originalix disabled auto-merge April 15, 2026 00:35
@originalix originalix merged commit 2a6b02f into x Apr 15, 2026
12 checks passed
@originalix originalix deleted the fix/restrict-restore-sync-policy branch April 15, 2026 00:35
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.

4 participants