Skip to content

Refresh sync status on conflict resolution and prevent silent no-ops - #202

Merged
callumalpass merged 1 commit into
mainfrom
fix/ios-conflict-resolution
Nov 26, 2026
Merged

callumalpass merged 1 commit into
mainfrom
fix/ios-conflict-resolution

Conversation

@callumalpass

Copy link
Copy Markdown
Member

Fixes tapping a sync conflict button ("Keep this vault's" / "Keep the collection's" / "Keep both") appearing to do nothing, and signing out leaving stale failure/conflict state in the status snapshot until reloading or switching vaults.

Root causes

  1. Delayed status refresh and no immediate tap feedback: resolveDefinition() waited for a full follow-up reconcileAll() before publishing updated status, and SyncPane did not disable the conflict action buttons while resolving. If the follow-up scan was slow or interrupted, the definition had already been resolved on disk/server while the conflict row stayed unchanged on screen.
  2. Silent early return on layout mismatch: reconcilePass() classifies a path as "resource" when it exists in resourcesAll, even if local mdbase.yaml disagrees on types_folder/contracts_folder, but resolveDefinition() previously returned early when sync.kindOf(p) !== "resource" without clearing the failure or refreshing status.
  3. Silent no-op when mirroring never started after a ready phase race: needsMergeConfirmation() aborted on object-identity sync.phase !== phase if another ready snapshot (same collection) arrived during remoteAll(), while the newer onPhase skipped startMirror() because was.kind === "ready". That left phase.kind === "ready" with mirroring === false, making enqueue() silently ignore conflict buttons and Sync now.
  4. Stale snapshot after signOut(): onPhase({ kind: "signed_out" }) fired before releaseCollection() cleared pathFailures and conflictCopies, and releaseCollection() never republished status afterwards.

Changes

  • src/sync/native/pass.ts, src/sync/native/transfers.ts, src/sync/native/plugin.ts: Publish busy status at the start of resolveDefinition() and refreshed status immediately after persisting the cleared failure (before follow-up reconcileAll()); resolve remote resources even across local/remote layout mismatches (or clear stale non-resource failures); reject if enqueue() did not execute instead of silently returning.
  • src/sync/native/conflicts.ts: Reject keepConflictCopies() if enqueue() did not execute.
  • src/sync/native/session.ts: Guard onPhase() / needsMergeConfirmation() by kind and collectionId rather than phase object identity so same-collection ready updates don't cancel startMirror(); republish status at the end of releaseCollection().
  • src/workspace/syncPane.ts: Disable conflict resolution buttons immediately while a resolution action is in flight and prevent duplicate clicks.
  • src/i18n/locales/*/messages.po: Sync Lingui source location references (no new untranslated strings).
  • test/native/sync.test.mjs, test/workspaceView.test.ts: Add tests covering immediate status refresh, layout-mismatch resource resolution, mirror-stopped rejection, concurrent ready phase startup, signOut() snapshot clearing, and button disable/error surfacing.

@callumalpass
callumalpass marked this pull request as ready for review November 26, 2026 22:01
@callumalpass
callumalpass enabled auto-merge (squash) November 26, 2026 22:01
@callumalpass
callumalpass merged commit b1ce5c2 into main Nov 26, 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