Skip to content

Add manifest-based orphan cleanup for non-force sync mappings#32

Merged
dsaenztagarro merged 1 commit into
masterfrom
31-manifest-orphan-cleanup
Mar 1, 2026
Merged

Add manifest-based orphan cleanup for non-force sync mappings#32
dsaenztagarro merged 1 commit into
masterfrom
31-manifest-orphan-cleanup

Conversation

@dsaenztagarro
Copy link
Copy Markdown
Owner

Summary

  • Add manifest tracking so dotsync detects and removes orphaned files (e.g., renamed scripts) on subsequent pulls
  • Only applies to non-force mappings with only filters — force-mode already handles cleanup
  • Manifests stored at $XDG_DATA_HOME/dotsync/manifests/<key>.json

Changes

  • Mapping model: sync_type attribute, manifest_key method, public has_inclusions?
  • SyncMappings: Pass sync_type through shorthand conversion
  • New Dotsync::Manifest: Read/write/orphan detection utility
  • MappingsTransfer: cleanup_orphans method + dry-run orphan preview
  • PullAction: Call cleanup_orphans after transfer_mappings
  • PullActionConfig: Expose xdg_data_home for manifest storage

Closes #31

Test plan

  • bundle exec rspec — 536 examples, 0 failures
  • Rubocop passes (pre-commit hook)
  • Coverage: 96.44% line / 82.74% branch (above thresholds)
  • Manual: create xdg_bin mapping with only, pull, rename file, pull again — verify orphan removed

🤖 Generated with Claude Code

When files are renamed in the dotfiles repo, the old file remained as an
orphan in the destination. This adds manifest tracking so dotsync detects
and removes orphaned files on subsequent pulls.

- Add sync_type attribute and manifest_key to Mapping model
- Pass sync_type through SyncMappings shorthand conversion
- Create Dotsync::Manifest utility (read/write/orphans)
- Add cleanup_orphans to MappingsTransfer with dry-run preview
- Call cleanup_orphans in PullAction after transfer_mappings

Closes #31

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dsaenztagarro dsaenztagarro merged commit 2bdd902 into master Mar 1, 2026
2 checks passed
@dsaenztagarro dsaenztagarro deleted the 31-manifest-orphan-cleanup branch March 1, 2026 08:57
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.

Manifest-based orphan cleanup for non-force sync mappings

1 participant