Skip to content

Implement Codex/sync speed pass#1

Merged
RadNotRed merged 2 commits intomainfrom
codex/sync-speed-pass
Apr 2, 2026
Merged

Implement Codex/sync speed pass#1
RadNotRed merged 2 commits intomainfrom
codex/sync-speed-pass

Conversation

@RadNotRed
Copy link
Copy Markdown
Owner

@RadNotRed RadNotRed commented Apr 2, 2026

Adds a sync speed pass that skips redundant copies by reusing shadow cache when metadata changes but content hash is identical, controlled by new compare.hash_on_metadata_change config exposed in validation and wizard defaults. Introduces directory caching for file copies and ensures modified times are preserved from metadata for accurate sync manifests.

Also adds packaging assets and scripts for Linux/macOS/Windows (icons, installers, release workflows) plus reset scripts and docs to distribute and recover the app.

Changes Made

  • Extend config with compare.hash_on_metadata_change and wire through sync planning to mark metadata-only updates instead of recopying files.
  • Add metadata update actions, shadow cache reuse check, and hash helper to avoid unnecessary copies while maintaining manifest accuracy.
  • Preserve file modified times via explicit millis in copy helpers with directory creation caching.
  • Add packaging workflows/scripts and assets for releases (Linux tarball, macOS app/dmg, Windows installer/portable) and reset scripts documentation.
  • Update docs and config example to document comparison option and defaults.

Testing

  • cargo test (fails in current environment: missing system glib-2.0/pkg-config)

Copilot AI review requested due to automatic review settings April 2, 2026 19:30
@RadNotRed
Copy link
Copy Markdown
Owner Author

@codex[agent] check over this before PR to ensure no underlying issues

@Codex
Copy link
Copy Markdown

Codex AI commented Apr 2, 2026

@codex[agent] check over this before PR to ensure no underlying issues

Reviewed current head c4f3d8a and 4f6d381; no additional issues spotted. cargo test currently fails locally because glib-2.0 (pkg-config) isn’t available in this environment.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR focuses on improving sync performance by avoiding unnecessary file copies when only file metadata (mtime) changes, while also reducing repeated directory creation overhead during copy operations.

Changes:

  • Add a “metadata update” operation in shadow planning/execution to reuse cached shadow content when file size matches and content hash matches, but mtime differs.
  • Introduce a DirectoryCache to avoid repeated create_dir_all calls during batch copy execution, and switch set membership tracking from BTreeSet to HashSet.
  • Plumb compare.hash_on_metadata_change from config into sync planning, and add test coverage for the new reuse behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/sync_engine.rs Adds metadata-only update actions, directory creation caching, and new hashing-based reuse path when only mtime changes.
src/config.rs Exposes compare on ResolvedConfig so sync engine can use hash_on_metadata_change.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +961 to +966
fn shadow_cache_reusable(path: &Path, size: u64) -> bool {
let Ok(metadata) = fs::metadata(path) else {
return false;
};
metadata.is_file() && metadata.len() == size
}
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shadow_cache_reusable only verifies that the existing shadow file is a regular file with a matching size. In the metadata-update reuse path this can incorrectly trust a shadow file that was modified out-of-band (mtime/content changed) but happens to keep the same size, and then the code overwrites its mtime and updates the manifest as if it were valid. Consider also validating the cached file’s timestamp against the previous manifest record (e.g., require metadata_matches_path(path, size, record.modified_millis)), or pass the expected modified_millis into this helper so reuse only happens when the cache still corresponds to the recorded version.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot apply changes based on this feedback

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot apply changes based on this feedback

@RadNotRed RadNotRed merged commit 689078e into main Apr 2, 2026
5 checks passed
@RadNotRed RadNotRed deleted the codex/sync-speed-pass branch April 2, 2026 20:01
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.

3 participants