Repository navigation
Conversation
… actor - Consolidate the ScanEngine, LanguageFilesScanner and FileSizeCalculator tree walks into FileSizeCalculator.directorySize so APFS clone dedup lives in one place. - Use lstat file type from FileAllocation instead of an extra resourceValues call per entry; drop AppleStorageService's duplicate lstat. - Size admin-removal uninstall items on a detached task instead of the main actor; reuse cached sizes for the permission retry path. - Add a clonefile-based test for full vs. modified clones. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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
APFS full clones (e.g.
cp -c, Finder duplicates, app bundles sharing blocks) report a full allocated size per inode, so tree-size scans counted the same blocks once per clone and inflated totals.FileAllocation: onelstatplus agetattrlistforATTR_CMNEXT_CLONEID/ATTR_CMNEXT_EXT_FLAGS. Files flaggedEF_SHARES_ALL_BLOCKSare identified by clone ID, others by device + inode, so full clone groups and hard links count once per scanned tree.ScanEngine,LanguageFilesScannerandFileSizeCalculatorintoFileSizeCalculator.directorySize(of:includeHidden:onEntry:);StorageExplorerandAppleStorageServiceuse the sharedFileAllocationmetadata.Limitation
A partially modified clone gets a new clone ID and is counted in full. APFS exposes no per-extent sharing info through this API, so partial clones may still overcount, but they never undercount.
Test plan
testDirectorySizeCountsFullAPFSClonesOnceAndModifiedClonesSeparately(usesclonefile(), skips on non-APFS temp dirs)StorageExplorerTests,AppleStorageServiceTests,LocalizationFilesTests,AppStateTestspassEF_SHARES_ALL_BLOCKSmatch acrosscp -ccopies; a modified clone gets a new ID🤖 Generated with Claude Code