fix(sync): remote wins on first sync for create_if_missing files#6
Closed
stefanzvonar wants to merge 1 commit intopaddo-tech:mainfrom
Closed
fix(sync): remote wins on first sync for create_if_missing files#6stefanzvonar wants to merge 1 commit intopaddo-tech:mainfrom
stefanzvonar wants to merge 1 commit intopaddo-tech:mainfrom
Conversation
When a dotfile has no sync history on a machine but exists locally (e.g. an app creates a default before tether runs), conflict detection treated it as a local edit and refused to apply remote content.
stefanzvonar
added a commit
that referenced
this pull request
Apr 4, 2026
When a dotfile has create_if_missing=true and no sync history, skip
conflict detection and let remote content win. This handles the case
where an app creates a default file before tether runs (e.g. Claude Code
writing {} to settings.json on startup).
For files without create_if_missing, local remains authoritative when
there's no sync history (from the is_true_conflict fix).
Incorporates the fix from PR #6.
5 tasks
Collaborator
Author
|
Superseded by #8 which combines this fix with additional fixes for the same issue area (is_true_conflict + effective_dotfiles merge). |
paddo
pushed a commit
that referenced
this pull request
Apr 7, 2026
When a dotfile has create_if_missing=true and no sync history, skip
conflict detection and let remote content win. This handles the case
where an app creates a default file before tether runs (e.g. Claude Code
writing {} to settings.json on startup).
For files without create_if_missing, local remains authoritative when
there's no sync history (from the is_true_conflict fix).
Incorporates the fix from PR #6.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
When a dotfile with
create_if_missing = trueis added to the config and synced to a new machine, the remote content may not be applied — leaving the file empty or with a default value instead of the synced content.This happens when an application creates the file before tether runs (e.g. Claude Code writes
{}to~/.claude/settings.jsonon startup). Tether's conflict detection treats that locally-created default as a "local edit" and refuses to overwrite it with the remote version.As-Is
.claude/settings.json(with real content) to tether config and syncstether sync— config is pulled, file doesn't exist locallydecrypt_from_repowrites the remote content, the app creates a default file (e.g.{})detect_conflict()sees: local exists ({}), nolast_synced_hash, local ≠ remote → true conflictlocal_unchanged = (local_hash == last_synced_hash)→Some(hash) == None→ false → remote not writtenBoth code paths fail to apply remote content when there's no sync history for the file.
To-Be
When
create_if_missing = trueAND there's no sync history for the file on this machine (last_synced_hashis None), treat it as a first-time sync where remote wins:After the first sync completes, subsequent syncs use the normal three-way conflict detection since
last_synced_hashwill be populated.Test plan
cargo clippy --all-targets -- -D warningspassescargo testpasses.claude/settings.jsonwithcreate_if_missing = trueon Machine A, sync{}), runtether sync→ file should have Machine A's contenttether sync→ file created with remote content