Fix re-conversion on FAT/exFAT caused by unicode path mismatch#49
Merged
Conversation
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>
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
PathResolver#find_files_to_cleanupwas deleting the target file itself on every Octatrack sync, which causedFileConverterto see the path as missing and re-convert from scratch.Dir.globon the exFAT card returns filenames in NFC (Bj\xC3\xB6rk), buttarget_pathis built in NFD (Bjo\xCC\x88rk) from the APFS source path. Thereject { |path| path == target_path }was byte-comparing, so the target wasn't rejected and gotrm_f'd.File.identical?, which stats both paths and is normalization-agnostic.Test plan
target_pathrake(rubocop + steep + 294 tests) greenBjörk - Biophiliato the real Octatrack card twice — all 13 tracks skipped on the second run, mtimes unchanged