Skip to content

fix(ui): Platform Sync Clear actually forces a full trunk/branch resync#840

Merged
QuantumExplorer merged 1 commit into
swift-sdk-integrationfrom
fix/platform-sync-clear-resync
Jul 17, 2026
Merged

fix(ui): Platform Sync Clear actually forces a full trunk/branch resync#840
QuantumExplorer merged 1 commit into
swift-sdk-integrationfrom
fix/platform-sync-clear-resync

Conversation

@QuantumExplorer

Copy link
Copy Markdown
Member

Problem

On the Platform Sync Status screen, Clear + Sync Now looked like a from-scratch resync but wasn't one: Clear only called clearDisplay() (a published-counter wipe). The Rust-owned BLAST incremental-sync watermark survived, so the next Sync Now resumed from the checkpoint — Recent queries only, no trunk/branch walk — under a zeroed UI that implied a full rescan. Exactly the "I feel like it isn't really resyncing" QA observation.

Fix

PlatformAddressSyncCoordinator.clearLocalState(), ported from the SwiftExampleApp PlatformBalanceSyncService contract:

  1. resetPlatformAddressSyncState() first — drains the in-flight pass and drops the Rust watermark, which is what actually forces the full trunk/branch rescan. Fail closed: on error the display keeps its real state rather than showing a false "cleared".
  2. Zero (never delete) the network's PersistentPlatformAddress volatile fields — the rows are durable derivation state the rescan upserts against; deleting them would strand balances until an app relaunch re-seeds them.
  3. Delete the PersistentPlatformAddressesSyncState watermark rows — pure volatile state, recreated by the next sync.
  4. Clear the display, then re-arm the background loop — the Rust reset deliberately leaves it stopped.

The screen's Clear button now runs this sequence; Sync Now / Clear are gated on the new isClearing flag for its duration.

Test plan

  • dashpay arm64-sim build green; installed on QA-iPhone16
  • Platform Sync Status → Clear → Sync Now: Queries card shows non-zero Trunk/Branch counts (full walk), balances repopulate
  • Clear while offline → error surfaces in Last Error, display NOT falsely zeroed

🤖 Generated with Claude Code

The Sync Info screen's Clear button only called clearDisplay() — a
published-counter wipe. The Rust-owned incremental-sync watermark
survived, so the next Sync Now resumed from the checkpoint (Recent
queries only) while the zeroed UI implied a from-scratch rescan that
never happened.

Clear now runs the SwiftExampleApp clearLocalState contract:
1. resetPlatformAddressSyncState() first (fail closed — on error the
   display keeps its real state instead of showing a false "cleared"),
2. zero the network's PersistentPlatformAddress volatile fields in
   place (rows are durable derivation state the rescan upserts
   against — deleting them would strand balances until relaunch),
3. delete the PersistentPlatformAddressesSyncState watermark rows,
4. clear the display and re-arm the background loop the Rust reset
   deliberately leaves stopped.

Sync Now / Clear gate on the new isClearing flag for the duration.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c5eaf05f-63b3-4591-83c0-3d9890309fbb

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/platform-sync-clear-resync

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@QuantumExplorer
QuantumExplorer merged commit 8f4fef0 into swift-sdk-integration Jul 17, 2026
2 checks passed
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.

1 participant