Skip to content

Fix re-conversion on FAT/exFAT caused by unicode path mismatch#49

Merged
pixelate merged 1 commit into
mainfrom
claude/fix-unicode-path-normalization
Apr 17, 2026
Merged

Fix re-conversion on FAT/exFAT caused by unicode path mismatch#49
pixelate merged 1 commit into
mainfrom
claude/fix-unicode-path-normalization

Conversation

@pixelate
Copy link
Copy Markdown
Owner

Summary

  • PathResolver#find_files_to_cleanup was deleting the target file itself on every Octatrack sync, which caused FileConverter to see the path as missing and re-convert from scratch.
  • Root cause: Dir.glob on the exFAT card returns filenames in NFC (Bj\xC3\xB6rk), but target_path is built in NFD (Bjo\xCC\x88rk) from the APFS source path. The reject { |path| path == target_path } was byte-comparing, so the target wasn't rejected and got rm_f'd.
  • Fix: compare with File.identical?, which stats both paths and is normalization-agnostic.

Test plan

  • Added regression test with NFC dir on disk vs NFD target_path
  • rake (rubocop + steep + 294 tests) green
  • End-to-end: synced Björk - Biophilia to the real Octatrack card twice — all 13 tracks skipped on the second run, mtimes unchanged

Compare cleanup candidates to target_path via File.identical? instead of
string equality so cross-filesystem unicode normalization mismatches
(NFC from Dir.glob on exFAT vs NFD from APFS-sourced target_path) don't
cause the target file to be treated as stale and deleted, triggering a
re-convert on every sync.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@pixelate pixelate merged commit 513b48e into main Apr 17, 2026
3 checks passed
@pixelate pixelate deleted the claude/fix-unicode-path-normalization branch April 17, 2026 20:10
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