Repository navigation
fix(sync): retain hash-matched downloads in synced state and ignore bare .git files - #119
Open
markusbrand wants to merge 1 commit into
Open
markusbrand wants to merge 1 commit into
markusbrand wants to merge 1 commit into
Conversation
…and ignore bare .git files - In client-tauri/src-tauri/src/sync.rs, register skipped downloads that already match the server hash or were resumed into completed_downloads so they are retained in state.paths and not resurrected upon subsequent local deletion - In is_ignored, recognize bare .git files (such as git submodules or worktrees) and sub/.git files - Add unit tests for hash matching retention, resume retention, and bare .git ignore patterns - Add OpenSpec change proposal, spec, design, and tasks tracking the fix
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.
Summary
This PR fixes two reproducible bugs in the desktop client sync engine (
client-tauri/src-tauri/src/sync.rs) tracked by OpenSpec changefix-sync-matching-download-state-retention:State Retention for Skipped/Matched Downloads (High Severity):
In commit
0c64e44,to_download_setwas excluded frombase_syncedto avoid recording failed transfers intostate.paths. However, when a file planned for download was skipped because it already existed on disk with an identical SHA-256 hash or was previously downloaded in a resumed cycle,completed_downloads.insert(path.clone())was not called beforecontinue. As a result, the file was dropped fromstate.paths(sync_state.json), causing it to be resurrected and re-downloaded if later deleted locally.completed_downloads.insert(path.clone())to both the resume check and the matching local hash check inrun_sync.Ignore Bare
.gitFiles (Medium Severity):In
is_ignored, checks only matchednormalized.contains("/.git/") || normalized.starts_with(".git/"). Bare.gitfiles (such as git submodules or worktree pointers where.gitis a regular file) and nested.gitfiles likesub/.gitwere not ignored, causing sync errors or unintentional file uploads.is_ignoredto checknormalized == ".git"andnormalized.ends_with("/.git").OpenSpec Artifacts
openspec/changes/fix-sync-matching-download-state-retention/proposal.mdopenspec/changes/fix-sync-matching-download-state-retention/specs/desktop-client/spec.mdopenspec/changes/fix-sync-matching-download-state-retention/design.mdopenspec/changes/fix-sync-matching-download-state-retention/tasks.mdTesting & Verification
client-tauri/src-tauri/src/sync.rs:test_is_ignored_bare_git_filestest_skipped_download_matching_hash_retained_in_synced_statetest_resumed_download_retained_in_synced_statecargo testinclient-tauri/src-tauri: 24 passed, 0 failed..venv/bin/pytest backend: 108 passed, 0 failed.npm run buildinclient-tauri: built cleanly.