Skip to content

Select and remove while scanning; count macOS firmlinked folders once - #8

Draft
joepio wants to merge 3 commits into
mainfrom
select-while-scanning
Draft

joepio wants to merge 3 commits into
mainfrom
select-while-scanning

Conversation

@joepio

@joepio joepio commented Oct 24, 2026

Copy link
Copy Markdown
Member

Requested by Joep

You no longer have to wait for a scan to finish before picking what to remove. This PR also stops the macOS Data volume from being counted twice when scanning /.

Select and remove while scanning

  • In the Explore list and the treemap (checkbox, Space/Backspace/Delete, context menu), and in Clean up, items can be selected and removed while a scan runs, including the live view of a first scan.
  • Clean up already shows suggestions from the scan so far, refreshed every 2 s, so it no longer waits for the scan.
  • The selection is keyed by path, and its entries are refreshed from the shown tree on every live update and when the finished scan replaces the live view.
  • Sizes of folders still being scanned are lower bounds: ≥ 12 GB in rows, the treemap, the selection bar and Clean up. The confirmation then says "This frees at least …".
  • Removing during a scan works on the live tree. Removed paths are remembered and taken out of every later live snapshot and of the scan's final result, so the scanner counting them before they vanished doesn't bring them back.
  • The scanner treats ENOENT (a folder or file removed mid-walk) as "not there" instead of an error or an unreadable folder.

Firmlinks (macOS)

/Users, /Applications, /Library, /private, /usr/local, … are firmlinks to the same folders under /System/Volumes/Data, on the same device, so same_filesystem didn't stop the second walk. core::firmlinks reads /usr/share/firmlinks (with a built-in copy as fallback). For a scan whose root contains the Data volume, it lists the Data-side copies that the scan also reaches through the firmlink, and the scanner skips those, for fresh and cached listings alike. Data-only content under /System/Volumes/Data is still counted. /System/Volumes/VM, Preboot etc. have their own device and were already skipped.

Scanning / on this Mac (Google Drive's CloudStorage left out of both runs):

files on disk time
before 19.1 M 1509 GB (the disk is 994 GB) 117 s
after 9.7 M 769 GB 62 s

df reports 821 GB used (Data volume 808 GB + system volume 13 GB), so "not scanned" is positive again.

Tests

  • Rust: firmlink duplicate rules with a fake list, a scan that counts a duplicated folder once (fresh and from cache), and removal during a scan dropped from live snapshots.
  • Dart: formatSize.
  • Not tried in the running app: clicking around during a live scan.

@joepio joepio self-assigned this Oct 24, 2026
# Conflicts:
#	rust/src/api/spaceman.rs
#	rust/src/core/scan.rs

This branch has not been deployed

No deployments
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