Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.
Swift cache-cleanercleanerclideveloper-toolsdisk-cleanupdisk-spaceduplicate-finderhomebrewliquid-glassmac-cleanermacosmacos-appmacos-golden-gatemacos-tahoemacos-tweaksswiftswiftuiterminal-themesuninstalluninstaller
Drop the unreadable list of exclusions that only the tests still used
Țugui Dragoș082d04f86cb2
diff --git a/Packages/PeelCore/Sources/PeelCore/Support/Exclusions.swift b/Packages/PeelCore/Sources/PeelCore/Support/Exclusions.swiftindex 8844cef5..898f59dc 100644--- a/Packages/PeelCore/Sources/PeelCore/Support/Exclusions.swift+++ b/Packages/PeelCore/Sources/PeelCore/Support/Exclusions.swift@@ -28,8 +28,6 @@ public struct Exclusions: Sendable, Codable, Hashable {public var isKnown: Bool { hasBeenRead && !isUnreadable }public static let none = Exclusions()- public static let unreadable = Exclusions.unreadable(because: nil)-public static func unreadable(because why: FileProblem?) -> Exclusions {var exclusions = Exclusions()exclusions.isUnreadable = true@@ -374,8 +372,8 @@ public struct ExclusionStore: Sendable {case notSaved(Exclusions, FileProblem)}- /// Loads the saved list. No file means an empty list. A file that cannot be read or reached gives `.unreadable`,- /// never an empty list, so what the user excluded stays protected.+ /// Loads the saved list. No file means an empty list. A file that cannot be read or reached gives an unreadable+ /// list, never an empty one, so what the user excluded stays protected.@concurrentpublic func load() async -> Exclusions {read()diff --git a/Packages/PeelCore/Tests/PeelCoreTests/AppResetTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/AppResetTests.swiftindex 5b481007..9a403a89 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/AppResetTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/AppResetTests.swift@@ -431,7 +431,7 @@ struct AppResetTests {let environment = home(directory)let trash = try directory.directory("Trash")let services: [(TrashService, TrashFailure.Reason)] = [- (.unreadable, nil, .guarded(.exclusionsNotKnown)),+ (.unreadable(because: nil), nil, .guarded(.exclusionsNotKnown)),(.notYetRead, nil, .guarded(.exclusionsNotKnown)),(.none, RemovalJournal(beside: history), .historyUnreadable),].map { exclusions, journal, reason indiff --git a/Packages/PeelCore/Tests/PeelCoreTests/BackgroundItemActionsTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/BackgroundItemActionsTests.swiftindex 65406706..77d10e0f 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/BackgroundItemActionsTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/BackgroundItemActionsTests.swift@@ -259,7 +259,7 @@ struct BackgroundItemActionsTests {@Test func nothingIsControlledWhileTheExclusionsAreNotKnown() {let job = item(state: .running(pid: 42), plist: URL(filePath: "/Users/me/Library/LaunchAgents/job.plist"))- for exclusions in [Exclusions.unreadable, .notYetRead] {+ for exclusions in [Exclusions.unreadable(because: nil), .notYetRead] {let row = BackgroundItems.rows([job], exclusions: exclusions)[0]#expect(!row.canBeControlled)diff --git a/Packages/PeelCore/Tests/PeelCoreTests/CleanupTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/CleanupTests.swiftindex c23e9497..316d5191 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/CleanupTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/CleanupTests.swift@@ -81,7 +81,7 @@ struct CleanupTests {@Test func movesNothingAndBlamesNoItemWhileTheExclusionsCannotBeRead() async throws {let directory = try TemporaryDirectory()let cache = try directory.file("home/Library/Caches/com.example.editor/blob", bytes: 20)- let service = try service(in: directory, exclusions: .unreadable)+ let service = try service(in: directory, exclusions: .unreadable(because: nil))let refusals = RefusalLog(url: directory.url.appending(path: "Peel/refusals.json"))let removals = RemovalLog(url: directory.url.appending(path: "Peel/removals.json"))let plan = cleanup(items: [(cache, 20)], service: service)@@ -101,7 +101,7 @@ struct CleanupTests {@Test func aDryRunSaysEachItemStaysWhileTheExclusionsCannotBeRead() async throws {let directory = try TemporaryDirectory()let cache = try directory.file("home/Library/Caches/com.example.editor/blob", bytes: 20)- let service = try service(in: directory, exclusions: .unreadable)+ let service = try service(in: directory, exclusions: .unreadable(because: nil))let removals = RemovalLog(url: directory.url.appending(path: "Peel/removals.json"))let collected = Output.Collected()diff --git a/Packages/PeelCore/Tests/PeelCoreTests/CloudStorageTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/CloudStorageTests.swiftindex 5632e943..2851135f 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/CloudStorageTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/CloudStorageTests.swift@@ -119,7 +119,8 @@ struct CloudStorageTests {#expect(await CloudStorage.free([scanned], exclusions: offline).refused.map(\.reason) == [.excluded])#expect(await CloudStorage.free([scanned], exclusions: .notYetRead).refused.map(\.reason) == [.excluded])- #expect(await CloudStorage.free([scanned], exclusions: .unreadable).refused.map(\.reason) == [.excluded])+ let unreadable = Exclusions.unreadable(because: nil)+ #expect(await CloudStorage.free([scanned], exclusions: unreadable).refused.map(\.reason) == [.excluded])}@Test func callsEachFolderWhatTheUserCallsIt() {diff --git a/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swiftindex 821add61..da9654f8 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swift@@ -358,7 +358,7 @@ struct CommandLineTests {}}#expect(throws: AppLookup.Failure.exclusionsUnreadable("/tmp/exclusions.json", nil)) {- try AppLookup.refuseIfExcluded(editor, by: .unreadable, savedAt: URL(filePath: "/tmp/exclusions.json"))+ try AppLookup.refuseIfExcluded(editor, by: .unreadable(because: nil), savedAt: URL(filePath: "/tmp/exclusions.json"))}}@@ -367,7 +367,7 @@ struct CommandLineTests {@Test func aListingSaysWhenTheExclusionsCannotBeRead() throws {#expect(UnreadableExclusions.note(for: .none) == nil)#expect(UnreadableExclusions.note(for: Exclusions(bundleIdentifiers: ["com.example.editor"])) == nil)- let note = try #require(UnreadableExclusions.note(for: .unreadable, savedAt: URL(filePath: "/tmp/exclusions.json")))+ let note = try #require(UnreadableExclusions.note(for: .unreadable(because: nil), savedAt: URL(filePath: "/tmp/exclusions.json")))#expect(note.contains("/tmp/exclusions.json"))let damaged = UnreadableExclusions.note(for: .unreadable(because: .damaged))#expect(damaged?.hasSuffix("Settings > Exclusions. The file's contents aren't in a form Peel can read.") == true)@@ -375,7 +375,8 @@ struct CommandLineTests {@Test func aSearchDoesNotSayItListsWhatItLeavesOut() throws {let saved = URL(filePath: "/tmp/exclusions.json")- let note = try #require(UnreadableExclusions.note(for: .unreadable, savedAt: saved, listsEverything: false))+ let unreadable = Exclusions.unreadable(because: nil)+ let note = try #require(UnreadableExclusions.note(for: unreadable, savedAt: saved, listsEverything: false))#expect(note.contains("/tmp/exclusions.json"))#expect(note.contains("Start Over"))#expect(!note.contains("may list"))diff --git a/Packages/PeelCore/Tests/PeelCoreTests/DigestMemoryTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/DigestMemoryTests.swiftindex 70b7b0e1..29c69775 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/DigestMemoryTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/DigestMemoryTests.swift@@ -87,7 +87,8 @@ struct DigestMemoryTests {try directory.file("home/Documents/Taxes copy/2025.bin", contents: contents)let home = directory.url.appending(path: "home", directoryHint: .isDirectory)- let result = try await DuplicateFinder(homeDirectory: home, exclusions: .unreadable, digestMemory: memory)+ let unreadable = Exclusions.unreadable(because: nil)+ let result = try await DuplicateFinder(homeDirectory: home, exclusions: unreadable, digestMemory: memory).scan(.everySize(in: [home]))#expect(result.exclusionsNotKnown)diff --git a/Packages/PeelCore/Tests/PeelCoreTests/ExclusionsTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/ExclusionsTests.swiftindex 5b187b2c..9aded9f9 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/ExclusionsTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/ExclusionsTests.swift@@ -98,7 +98,7 @@ struct ExclusionsTests {#expect(Exclusions(bundleIdentifiers: ["com.example.app"]).excludes(cask, apps: [], installation: installation) == true, "the identifier it quits names it too")#expect(Exclusions(paths: [URL(filePath: "/opt/homebrew/Caskroom/example")]).excludes(cask, apps: [], installation: installation) == true)#expect(Exclusions(paths: [URL(filePath: "/opt/homebrew")]).excludes(formula, apps: [], installation: installation) == true)- #expect(Exclusions.unreadable.excludes(formula, apps: [], installation: installation) == true, "a list that cannot be read keeps everything")+ #expect(Exclusions.unreadable(because: nil).excludes(formula, apps: [], installation: installation) == true, "a list that cannot be read keeps everything")#expect(Exclusions.notYetRead.excludes(formula, apps: [], installation: installation) == true, "a list not read yet keeps everything")let unrelated = Exclusions(paths: [URL(filePath: "/Applications/Other.app")], bundleIdentifiers: ["com.other.app"])@@ -482,7 +482,7 @@ struct ExclusionsTests {homeDirectory: directory.url.appending(path: "home"),rootDirectory: directory.url.appending(path: "root"))- let service = TrashService(environment: environment, exclusions: .unreadable) { $0 }+ let service = TrashService(environment: environment, exclusions: .unreadable(because: nil)) { $0 }let result = await service.trash([item])#expect(result.trashed.isEmpty)@@ -521,7 +521,7 @@ struct ExclusionsTests {#expect(result.trashed.isEmpty)#expect(result.failures.map(\.reason) == [.guarded(.exclusionsNotKnown)])#expect(!Exclusions.notYetRead.isKnown && !Exclusions.notYetRead.isUnreadable)- #expect(Exclusions.none.isKnown && !Exclusions.unreadable.isKnown)+ #expect(Exclusions.none.isKnown && !Exclusions.unreadable(because: nil).isKnown)}@Test func refusesToRemoveAnExcludedItem() async throws {diff --git a/Packages/PeelCore/Tests/PeelCoreTests/FileCommandTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/FileCommandTests.swiftindex fc938a09..e18b1af6 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/FileCommandTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/FileCommandTests.swift@@ -874,7 +874,7 @@ struct FileCommandTests {@Test func duplicatesComparesNothingWhileTheExclusionsCantBeRead() {let saved = URL(filePath: "/Users/me/Library/Application Support/Peel/exclusions.json")- let refusal = DuplicatesCommand.refusal(for: .unreadable, savedAt: saved)+ let refusal = DuplicatesCommand.refusal(for: .unreadable(because: nil), savedAt: saved)#expect(refusal?.description.hasPrefix("Peel couldn't read your exclusions at /Users/me/Library/Application Support/Peel/exclusions.json, so it compares nothing"diff --git a/Packages/PeelCore/Tests/PeelCoreTests/HistoryCommandTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/HistoryCommandTests.swiftindex a02cf523..721892e5 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/HistoryCommandTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/HistoryCommandTests.swift@@ -525,7 +525,7 @@ struct HistoryCommandTests {await #expect(throws: AppLookup.Failure.self) {try await (command(["restore", String(removal.record.batch.uuidString.prefix(8)), "-y"]) as RestoreCommand)- .run(in: logs.removals, using: TrashService(exclusions: .unreadable))+ .run(in: logs.removals, using: TrashService(exclusions: .unreadable(because: nil)))}}diff --git a/Packages/PeelCore/Tests/PeelCoreTests/HomebrewTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/HomebrewTests.swiftindex 992a8cfa..5745ee07 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/HomebrewTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/HomebrewTests.swift@@ -116,7 +116,7 @@ struct HomebrewTests {#expect(names(Exclusions()) == ["sample", "other"])#expect(names(Exclusions(paths: [app])) == ["other"])#expect(names(Exclusions(bundleIdentifiers: ["org.example.sample"])) == ["other"])- #expect(names(.unreadable).isEmpty)+ #expect(names(.unreadable(because: nil)).isEmpty)#expect(names(.notYetRead).isEmpty)}@@ -381,7 +381,8 @@ struct HomebrewTests {let kept = try exclusions.keptFormulae(inCellar: directory.url.appending(path: "Cellar")).get()#expect(kept == ["jq", "[email protected]"])- #expect(Exclusions.unreadable.keptFormulae(inCellar: directory.url.appending(path: "Cellar")) == .success(["jq", "[email protected]", "wget"]))+ let unreadable = Exclusions.unreadable(because: nil)+ #expect(unreadable.keptFormulae(inCellar: directory.url.appending(path: "Cellar")) == .success(["jq", "[email protected]", "wget"]))let attempt = try await Homebrew.execute(["-c", "printf %s \"$HOMEBREW_NO_CLEANUP_FORMULAE\""], autoUpdate: false, keeping: kept, timeout: 10,diff --git a/Packages/PeelCore/Tests/PeelCoreTests/RemovalHygieneTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/RemovalHygieneTests.swiftindex 93c66d31..587104ca 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/RemovalHygieneTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/RemovalHygieneTests.swift@@ -588,7 +588,7 @@ struct RemovalHygieneTests {return Self.exporting(arguments)}- for exclusions in [Exclusions.notYetRead, .unreadable] {+ for exclusions in [Exclusions.notYetRead, .unreadable(because: nil)] {let restored = await PreferenceBackup.restore(from: folder,of: "com.example.app",diff --git a/Packages/PeelCore/Tests/PeelCoreTests/SelfRemovalTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/SelfRemovalTests.swiftindex 38962651..1c15de48 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/SelfRemovalTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/SelfRemovalTests.swift@@ -188,7 +188,7 @@ struct SelfRemovalTests {homeDirectory: directory.url.appending(path: "home", directoryHint: .isDirectory),rootDirectory: directory.url.appending(path: "root", directoryHint: .isDirectory)),- exclusions: state == "exclusions unreadable" ? .unreadable+ exclusions: state == "exclusions unreadable" ? .unreadable(because: nil): state == "exclusions not yet read" ? .notYetRead : .none,journal: RemovalJournal(beside: history)) { url indiff --git a/PeelTests/FileSearchLibraryTests.swift b/PeelTests/FileSearchLibraryTests.swiftindex 96797e80..832a818f 100644--- a/PeelTests/FileSearchLibraryTests.swift+++ b/PeelTests/FileSearchLibraryTests.swift@@ -110,7 +110,7 @@ struct FileSearchLibraryTests {@Test func aSearchAllLeftOutForUnreadableExclusionsRunsAgainOnceTheyAreRead() async throws {let calls = OSAllocatedUnfairLock(initialState: 0)- var exclusions = Exclusions.unreadable+ var exclusions = Exclusions.unreadable(because: nil)let library = FileSearchLibrary(run: { _, _ incalls.withLock { $0 += 1 }