Skip to content

fix: adopt untracked local files that match the Cloud on mirror - #27

Open
pgebheim wants to merge 1 commit into
raaneem:mainfrom
lilco-dev:pr/adopt-untracked
Open

pgebheim wants to merge 1 commit into
raaneem:mainfrom
lilco-dev:pr/adopt-untracked

Conversation

@pgebheim

Copy link
Copy Markdown

Fix: adopt untracked local files that match the Cloud on mirror

When mirroring, a local file that isn't tracked in the sync manifest but whose content matches the Cloud file (same md5) previously raised a "Protected local edit" error and stalled the sync. This happens after removing and re-adding a synced folder, or on a fresh device that already has the files.

The mirror now adopts such files (records the manifest baseline, no download, no vault write) instead of erroring. Tracked local edits that diverge from their baseline are still protected before any cloud round-trip — that distinction is unchanged.

Test plan: pnpm test — two new tests: "adopts an untracked local file that matches the Cloud" and "still protects an untracked local file that differs"; full suite green.


Extracted from the Supernote Sync & Transcribe fork.

Removing a folder from mirroring trashes its files and drops their manifest
baselines. If the files come back (restored, or a folder removed and
re-added), the mirror saw local files with no baseline and flagged every one
as "Protected local edit" — 0 downloaded, 0 unchanged, stuck.

Now mirrorFile adopts an untracked local file when its md5 matches the Cloud
file: it records the manifest baseline and reports the file unchanged instead
of protecting it, with no re-download. Genuinely divergent untracked files are
still protected, and a tracked local edit is still protected before any cloud
round-trip.
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