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
Space empties the caches of shared group containers and apps' temporary files
Țugui Dragoș4de7e74ca037
diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstringsindex 68cb5695..6ed1bc2d 100644--- a/Localization/Peel/Localizable.xcstrings+++ b/Localization/Peel/Localizable.xcstrings@@ -132027,108 +132027,108 @@}}},- "What sandboxed apps, such as those from the App Store, cached in their own containers. An app that is open keeps its caches, and those of Apple’s own apps are listed but never selected." : {+ "What sandboxed apps, such as those from the App Store, cached or left as temporary files in their own containers, and cached in the ones they share with apps from the same maker. What an open app uses stays, and the caches of Apple’s own apps are listed but never selected." : {"localizations" : {"cs" : {"stringUnit" : {"state" : "translated",- "value" : "Co izolované aplikace, například ty z App Storu, uložily do mezipaměti ve svých vlastních kontejnerech. Otevřená aplikace si své mezipaměti ponechá a mezipaměti vlastních aplikací společnosti Apple se zobrazují, ale nikdy se nevybírají."+ "value" : "Co izolované aplikace, například ty z App Storu, uložily do mezipaměti nebo zanechaly jako dočasné soubory ve svých vlastních kontejnerech, a co uložily do mezipaměti v kontejnerech, které sdílejí s aplikacemi od stejného výrobce. Co používá otevřená aplikace, zůstává na místě, a mezipaměti vlastních aplikací společnosti Apple se zobrazují, ale nikdy se nevybírají."}},"de" : {"stringUnit" : {"state" : "translated",- "value" : "Was Sandbox-Apps, etwa die aus dem App Store, in ihren eigenen Containern zwischengespeichert haben. Eine geöffnete App behält ihre Caches, und die von Apples eigenen Apps werden angezeigt, aber nie ausgewählt."+ "value" : "Was Sandbox-Apps, etwa die aus dem App Store, in ihren eigenen Containern zwischengespeichert oder als temporäre Dateien hinterlassen haben, und was sie in den Containern zwischengespeichert haben, die sie mit Apps desselben Herstellers teilen. Was eine geöffnete App verwendet, bleibt erhalten, und die Caches von Apples eigenen Apps werden angezeigt, aber nie ausgewählt."}},"es" : {"stringUnit" : {"state" : "translated",- "value" : "Lo que las apps aisladas, como las de App Store, han guardado en caché en sus propios contenedores. Una app que está abierta conserva sus cachés, y las de las propias apps de Apple se muestran pero nunca se seleccionan."+ "value" : "Lo que las apps aisladas, como las de App Store, han guardado en caché o dejado como archivos temporales en sus propios contenedores, y lo que han guardado en caché en los que comparten con apps del mismo fabricante. Lo que usa una app abierta se queda donde está, y las cachés de las propias apps de Apple se muestran pero nunca se seleccionan."}},"fr" : {"stringUnit" : {"state" : "translated",- "value" : "Ce que les apps en sandbox, comme celles de l’App Store, ont mis en cache dans leurs propres conteneurs. Une app ouverte conserve ses caches, et ceux des apps d’Apple sont listés mais jamais sélectionnés."+ "value" : "Ce que les apps en sandbox, comme celles de l’App Store, ont mis en cache ou laissé sous forme de fichiers temporaires dans leurs propres conteneurs, et mis en cache dans ceux qu’elles partagent avec les apps du même éditeur. Ce qu’utilise une app ouverte reste en place, et les caches des apps d’Apple sont listés mais jamais sélectionnés."}},"it" : {"stringUnit" : {"state" : "translated",- "value" : "Ciò che le app in sandbox, come quelle scaricate da App Store, hanno messo in cache nei propri contenitori. Un’app aperta conserva le sue cache, e quelle delle app di Apple sono elencate ma mai selezionate."+ "value" : "Ciò che le app in sandbox, come quelle scaricate da App Store, hanno messo in cache o lasciato come file temporanei nei propri contenitori, e messo in cache in quelli che condividono con le app dello stesso produttore. Ciò che usa un’app aperta resta al suo posto, e le cache delle app di Apple sono elencate ma mai selezionate."}},"ja" : {"stringUnit" : {"state" : "translated",- "value" : "App Storeのアプリなど、サンドボックス化されたアプリが自身のコンテナにキャッシュしたものです。開いているアプリのキャッシュはそのまま残り、Apple製のアプリのキャッシュは一覧には表示されますが、自動で選択されることはありません。"+ "value" : "App Storeのアプリなど、サンドボックス化されたアプリが自身のコンテナにキャッシュしたものや一時ファイルとして残したもの、そして同じ開発元のアプリと共有するコンテナにキャッシュしたものです。開いているアプリが使用しているものはそのまま残り、Apple製のアプリのキャッシュは一覧には表示されますが、自動で選択されることはありません。"}},"ko" : {"stringUnit" : {"state" : "translated",- "value" : "App Store에서 받은 앱 등 샌드박스가 적용된 앱이 자체 컨테이너에 캐시한 항목입니다. 열려 있는 앱은 캐시를 그대로 유지하며, Apple 자체 앱의 캐시는 목록에 표시되지만 절대 미리 선택되지 않습니다."+ "value" : "App Store에서 받은 앱 등 샌드박스가 적용된 앱이 자체 컨테이너에 캐시하거나 임시 파일로 남긴 항목과, 같은 제작자의 앱과 공유하는 컨테이너에 캐시한 항목입니다. 열려 있는 앱이 사용하는 항목은 그대로 유지되며, Apple 자체 앱의 캐시는 목록에 표시되지만 절대 미리 선택되지 않습니다."}},"nl" : {"stringUnit" : {"state" : "translated",- "value" : "Wat apps in een sandbox, zoals die uit de App Store, in hun eigen containers in de cache hebben gezet. Een app die open is, behoudt zijn caches, en die van de eigen apps van Apple worden getoond maar nooit geselecteerd."+ "value" : "Wat apps in een sandbox, zoals die uit de App Store, in hun eigen containers in de cache hebben gezet of als tijdelijke bestanden hebben achtergelaten, en in de cache hebben gezet in de containers die ze delen met apps van dezelfde maker. Wat een geopende app gebruikt, blijft staan, en de caches van de eigen apps van Apple worden getoond maar nooit geselecteerd."}},"pl" : {"stringUnit" : {"state" : "translated",- "value" : "To, co aplikacje działające w piaskownicy, takie jak te z App Store, zapisały w pamięci podręcznej we własnych kontenerach. Otwarta aplikacja zachowuje swoją pamięć podręczną, a pamięć podręczna własnych aplikacji Apple jest na liście, ale nigdy nie jest zaznaczana."+ "value" : "To, co aplikacje działające w piaskownicy, takie jak te z App Store, zapisały w pamięci podręcznej lub pozostawiły jako pliki tymczasowe we własnych kontenerach, a także zapisały w pamięci podręcznej w tych, które współdzielą z aplikacjami tego samego producenta. To, czego używa otwarta aplikacja, zostaje na miejscu, a pamięć podręczna własnych aplikacji Apple jest na liście, ale nigdy nie jest zaznaczana."}},"pt" : {"stringUnit" : {"state" : "translated",- "value" : "O que os apps em sandbox, como os da App Store, guardaram em cache nos próprios contêineres. Um app aberto mantém os seus caches, e os dos apps da própria Apple são listados, mas nunca selecionados."+ "value" : "O que os apps em sandbox, como os da App Store, guardaram em cache ou deixaram como arquivos temporários nos próprios contêineres, e guardaram em cache nos que compartilham com apps do mesmo fabricante. O que um app aberto usa permanece, e os caches dos apps da própria Apple são listados, mas nunca selecionados."}},"ro" : {"stringUnit" : {"state" : "translated",- "value" : "Ce au păstrat aplicațiile izolate, cum sunt cele din App Store, în memoria tampon din propriile containere. O aplicație deschisă își păstrează memoriile tampon, iar cele ale aplicațiilor Apple sunt listate, dar nu sunt niciodată selectate."+ "value" : "Ce au păstrat aplicațiile izolate, cum sunt cele din App Store, în memoria tampon sau au lăsat ca fișiere temporare în propriile containere și ce au păstrat în memoria tampon din containerele pe care le partajează cu aplicații de la același producător. Ce folosește o aplicație deschisă rămâne pe loc, iar memoriile tampon ale aplicațiilor Apple sunt listate, dar nu sunt niciodată selectate."}},"ru" : {"stringUnit" : {"state" : "translated",- "value" : "Все, что приложения в песочнице, например из App Store, кэшировали в своих контейнерах. Кэши открытого приложения остаются на месте, а кэши собственных приложений Apple показываются в списке, но никогда не выбираются."+ "value" : "Все, что приложения в песочнице, например из App Store, кэшировали или оставили в виде временных файлов в своих контейнерах, а также кэшировали в контейнерах, общих с приложениями того же производителя. То, что использует открытое приложение, остается на месте, а кэши собственных приложений Apple показываются в списке, но никогда не выбираются."}},"sv" : {"stringUnit" : {"state" : "translated",- "value" : "Det som appar i sandlåda, till exempel de från App Store, har cachat i sina egna behållare. En app som är öppen behåller sina cachar, och cacharna för Apples egna appar visas i listan men markeras aldrig."+ "value" : "Det som appar i sandlåda, till exempel de från App Store, har cachat eller lämnat som tillfälliga filer i sina egna behållare, och har cachat i de behållare de delar med appar från samma tillverkare. Det som en öppen app använder stannar kvar, och cacharna för Apples egna appar visas i listan men markeras aldrig."}},"tr" : {"stringUnit" : {"state" : "translated",- "value" : "App Store’dan gelenler gibi Sandbox kullanan uygulamaların kendi kapsayıcılarında önbelleğe aldıkları. Açık olan bir uygulamanın önbellekleri yerinde kalır; Apple’ın kendi uygulamalarının önbellekleri ise listelenir ama hiçbir zaman seçilmez."+ "value" : "App Store’dan gelenler gibi Sandbox kullanan uygulamaların kendi kapsayıcılarında önbelleğe aldıkları veya geçici dosya olarak bıraktıkları ve aynı üreticinin uygulamalarıyla paylaştıkları kapsayıcılarda önbelleğe aldıkları. Açık bir uygulamanın kullandıkları yerinde kalır; Apple’ın kendi uygulamalarının önbellekleri ise listelenir ama hiçbir zaman seçilmez."}},"uk" : {"stringUnit" : {"state" : "translated",- "value" : "Те, що ізольовані програми, як-от програми з App Store, кешували у власних контейнерах. Відкрита програма зберігає свої кеші, а кеші власних програм Apple показуються, але ніколи не вибираються."+ "value" : "Те, що ізольовані програми, як-от програми з App Store, кешували або залишили як тимчасові файли у власних контейнерах, а також кешували в контейнерах, спільних із програмами того самого виробника. Те, чим користується відкрита програма, лишається, а кеші власних програм Apple показуються, але ніколи не вибираються."}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "沙盒App(例如来自App Store的App)在各自容器中缓存的内容。已打开的App会保留其缓存;Apple自己的App的缓存会列出,但绝不会被选择。"+ "value" : "沙盒App(例如来自App Store的App)在各自容器中缓存或作为临时文件留下的内容,以及在与同一厂商的App共享的容器中缓存的内容。已打开的App正在使用的内容会保留;Apple自己的App的缓存会列出,但绝不会被选择。"}},"zh-Hant" : {"stringUnit" : {"state" : "translated",- "value" : "沙盒App(例如來自App Store的App)在自己的容器中快取的內容。已打開的App會保留其快取,而Apple自家App的快取會列出,但絕不會選取。"+ "value" : "沙盒App(例如來自App Store的App)在自己的容器中快取或留作暫存檔案的內容,以及在與同一廠商的App共用的容器中快取的內容。已打開的App正在使用的內容會保留,而Apple自家App的快取會列出,但絕不會選取。"}}}diff --git a/Packages/PeelCore/Sources/PeelCore/Apps/AppInspector.swift b/Packages/PeelCore/Sources/PeelCore/Apps/AppInspector.swiftindex 4b8bd4db..9f84816b 100644--- a/Packages/PeelCore/Sources/PeelCore/Apps/AppInspector.swift+++ b/Packages/PeelCore/Sources/PeelCore/Apps/AppInspector.swift@@ -108,16 +108,25 @@ public enum AppInspector {private static func signingInformation(for url: URL) -> (teamIdentifier: String?, developer: String?, applicationGroups: [String]) {guard let information = CodeSignature.information(at: url) else { return (nil, nil, []) }- let entitlements = information[kSecCodeInfoEntitlementsDict as String] as? [String: Any]let team = information[kSecCodeInfoTeamIdentifier as String] as? Stringlet leaf = (information[kSecCodeInfoCertificates as String] as? [SecCertificate])?.firstreturn (team,leaf.flatMap { SecCertificateCopySubjectSummary($0) as String? }.flatMap { CodeSignature.developer(fromLeaf: $0, team: team) },- entitlements?["com.apple.security.application-groups"] as? [String] ?? []+ applicationGroups(in: information))}+ /// The application groups the bundle's checked signature claims.+ static func applicationGroups(at url: URL) -> [String] {+ CodeSignature.information(at: url).map(applicationGroups(in:)) ?? []+ }++ private static func applicationGroups(in information: [String: Any]) -> [String] {+ let entitlements = information[kSecCodeInfoEntitlementsDict as String] as? [String: Any]+ return entitlements?["com.apple.security.application-groups"] as? [String] ?? []+ }+private static func embeddedBundleIdentifiers(in contents: URL) -> [String] {let fileManager = FileManager.defaultvar identifiers: [String] = []diff --git a/Packages/PeelCore/Sources/PeelCore/Space/SpaceRemoval.swift b/Packages/PeelCore/Sources/PeelCore/Space/SpaceRemoval.swiftindex 369c831c..74977431 100644--- a/Packages/PeelCore/Sources/PeelCore/Space/SpaceRemoval.swift+++ b/Packages/PeelCore/Sources/PeelCore/Space/SpaceRemoval.swift@@ -32,23 +32,24 @@ public enum SpaceRemoval {}}+ /// The plan while the apps in `running` are open, whose names and groups are read here, away from the main actor.@concurrentpublic static func plan(for item: SpaceItem,environment: SearchEnvironment = .current,exclusions: Exclusions = .none,- running: [String: String] = [:]+ running: [RunningCopies.Process]) async -> Plan {- await plan(for: item, environment: environment, exclusions: exclusions, running: running, measure: LeftoverScanner.walk)+ await plan(for: item, environment: environment, exclusions: exclusions, running: namesOfRunningApps(running))}@concurrentstatic func plan(for item: SpaceItem,environment: SearchEnvironment,- exclusions: Exclusions,- running: [String: String],- measure: LeftoverScanner.Measure+ exclusions: Exclusions = .none,+ running: [String: String] = [:],+ measure: LeftoverScanner.Measure = LeftoverScanner.walk) async -> Plan {let children = children(of: item, environment: environment, exclusions: exclusions, running: running)let systemCaches = SystemCaches(environment: environment)@@ -72,6 +73,18 @@ public enum SpaceRemoval {in item: SpaceItem,environment: SearchEnvironment = .current,exclusions: Exclusions = .none,+ running: [RunningCopies.Process]+ ) async -> [URL] {+ await removable(+ in: item, environment: environment, exclusions: exclusions, running: namesOfRunningApps(running)+ )+ }++ @concurrent+ static func removable(+ in item: SpaceItem,+ environment: SearchEnvironment,+ exclusions: Exclusions = .none,running: [String: String] = [:]) async -> [URL] {children(of: item, environment: environment, exclusions: exclusions, running: running).removable@@ -119,8 +132,9 @@ public enum SpaceRemoval {/// Maps each name an open app answers to, normalized, to the app's display name. The names are the bundle/// identifier, its last part, and the bundle's file name, since many cache and log folders carry the app's- /// name rather than its identifier (`Firefox`, `Zed`).- public static func namesOfRunningApps(_ running: [RunningCopies.Process]) -> [String: String] {+ /// name rather than its identifier (`Firefox`, `Zed`), and the application groups its signature claims, whose+ /// group containers it shares with other apps of its maker.+ static func namesOfRunningApps(_ running: [RunningCopies.Process]) -> [String: String] {var names: [String: String] = [:]for process in running {let bundle = process.bundleURL?.deletingPathExtension().lastPathComponent@@ -130,7 +144,7 @@ public enum SpaceRemoval {process.bundleIdentifier,process.bundleIdentifier.split(separator: ".").last.map(String.init),bundle,- ].compactMap(\.self)+ ].compactMap(\.self) + (process.bundleURL.map(AppInspector.applicationGroups) ?? [])for spelling in spellings where Naming.isSignificant(spelling) {names[Naming.normalized(spelling)] = displayed}@@ -138,8 +152,4 @@ public enum SpaceRemoval {return names}- @MainActor- public static func namesOfRunningApps() -> [String: String] {- namesOfRunningApps(RunningCopies.current)- }}diff --git a/Packages/PeelCore/Sources/PeelCore/Space/SpaceReport.swift b/Packages/PeelCore/Sources/PeelCore/Space/SpaceReport.swiftindex 7284e931..7e52d8d9 100644--- a/Packages/PeelCore/Sources/PeelCore/Space/SpaceReport.swift+++ b/Packages/PeelCore/Sources/PeelCore/Space/SpaceReport.swift@@ -1,4 +1,5 @@public import Foundation+internal import PeelPrivileged/// An area of the disk that can take up a lot of room, such as simulators or virtual machines. Most areas are/// read-only here: their own app or tool is the right place to remove them. Peel never adds them up into a@@ -55,8 +56,11 @@ public enum SpaceInventory {let category: SpaceItem.Categorylet paths: [String]let handling: SpaceItem.Handling- /// The folder inside every app's container (`Library/Containers/<identifier>`) that belongs to this area too.- var containerFolder: String?+ /// The folders inside every app's container (`Library/Containers/<identifier>`) that belong to this area too.+ var containerFolders: [String] = []+ /// The folder inside every group container not Apple's own (`Library/Group Containers/<group>`) that belongs+ /// to this area too.+ var groupContainerFolder: String?var heldBack: HoldBack?/// Each of `paths` on this Mac: one that starts with `/` is under `root`, the rest are in `home`.@@ -202,7 +206,7 @@ public enum SpaceInventory {category: .library,paths: ["Library/Logs"],handling: .trash,- containerFolder: "Data/Library/Logs"+ containerFolders: ["Data/Library/Logs"]),Definition(id: "caches",@@ -215,7 +219,8 @@ public enum SpaceInventory {category: .library,paths: [],handling: .trash,- containerFolder: "Data/Library/Caches"+ containerFolders: ["Data/Library/Caches", "Data/tmp"],+ groupContainerFolder: "Library/Caches"),// Sandboxed, Mail writes only the second folder. The first is what an older Mail left in the Library itself.Definition(@@ -248,9 +253,18 @@ public enum SpaceInventory {/// Every app's container, listed rather than matched with `glob`, which stops at 128 paths.static func appContainers(in home: URL) -> [URL] {- let containers = home.appending(path: "Library/Containers", directoryHint: .isDirectory)- let names = (try? FileManager.default.contentsOfDirectory(atPath: containers.path(percentEncoded: false))) ?? []- return names.sorted().map { containers.appending(path: $0, directoryHint: .isDirectory) }.filter(\.isRealFolder)+ folders(in: home.appending(path: "Library/Containers", directoryHint: .isDirectory))+ }++ /// Every group container but Apple's own, which hold what macOS keeps for its apps and are never emptied.+ static func groupContainers(in home: URL) -> [URL] {+ folders(in: home.appending(path: "Library/Group Containers", directoryHint: .isDirectory))+ .filter { !ProtectedData.isApplesName($0.lastPathComponent) }+ }++ private static func folders(in parent: URL) -> [URL] {+ let names = (try? FileManager.default.contentsOfDirectory(atPath: parent.path(percentEncoded: false))) ?? []+ return names.sorted().map { parent.appending(path: $0, directoryHint: .isDirectory) }.filter(\.isRealFolder)}/// Anything smaller than this is noise in a report about space.@@ -270,11 +284,15 @@ public enum SpaceInventory {measure: @escaping FileSize.Measure) async -> SpaceReport {let containers = appContainers(in: home)+ let groups = groupContainers(in: home)let wanted = definitions.compactMap { definition -> (Definition, [URL])? inlet urls = definition.urls(home: home, root: root).filter { FileManager.default.fileExists(atPath: PathPattern.comparablePath(of: $0)) }- + (definition.containerFolder.map { folder in+ + definition.containerFolders.flatMap { folder incontainers.map { $0.appending(path: folder, directoryHint: .isDirectory) }.filter(\.isRealFolder)+ }+ + (definition.groupContainerFolder.map { folder in+ groups.map { $0.appending(path: folder, directoryHint: .isDirectory) }.filter(\.isRealFolder)} ?? [])return urls.isEmpty ? nil : (definition, urls)}diff --git a/Packages/PeelCore/Sources/PeelCore/Space/SystemCaches.swift b/Packages/PeelCore/Sources/PeelCore/Space/SystemCaches.swiftindex 82658e5a..c580c966 100644--- a/Packages/PeelCore/Sources/PeelCore/Space/SystemCaches.swift+++ b/Packages/PeelCore/Sources/PeelCore/Space/SystemCaches.swift@@ -25,13 +25,13 @@ struct SystemCaches {}private let cachesFolders: Set<String>- private let containers: [String]+ private let containerFolders: [[String]]init(environment: SearchEnvironment) {let locations = environment.locationscachesFolders = Set(locations.filter { $0.kind == .caches }.map { PathPattern.comparablePath(of: $0.url) })- let folder = locations.first { $0.kind == .containers }?.url- containers = folder.map { PathComponents.of(PathPattern.comparablePath(of: $0)) } ?? []+ containerFolders = locations.filter { $0.kind == .containers || $0.kind == .groupContainers }+ .map { PathComponents.of(PathPattern.comparablePath(of: $0.url)) }}/// Whether macOS keeps `url` for itself: a folder in a Caches folder named for macOS, or anything in the container@@ -43,9 +43,12 @@ struct SystemCaches {return container(holding: url).map(ProtectedData.isApplesName) ?? false}+ /// The identifier of the app container or the group container `url` is in: the name of that container's folder.func container(holding url: URL) -> String? {let names = PathComponents.of(PathPattern.comparablePath(of: url))- guard !containers.isEmpty, names.count > containers.count, names.starts(with: containers) else { return nil }- return names[containers.count]+ guard let folder = containerFolders.first(where: { names.count > $0.count && names.starts(with: $0) }) else {+ return nil+ }+ return names[folder.count]}}diff --git a/Packages/PeelCore/Tests/PeelCoreTests/SpaceInventoryTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/SpaceInventoryTests.swiftindex 1f84d35e..9a8bbbf2 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/SpaceInventoryTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/SpaceInventoryTests.swift@@ -141,10 +141,26 @@ struct SpaceInventoryTests {#expect(attachments.heldBack == .openedFromMail)}+ @Test func findsTheCachesOfEveryGroupContainerButApplesAndTheTemporaryFilesOfEveryContainer() async throws {+ let directory = try TemporaryDirectory()+ try directory.file("Library/Group Containers/ABCDE12345.org.example.shared/Library/Caches/blob", bytes: 8_000)+ try directory.file("Library/Group Containers/group.com.apple.notes/Library/Caches/blob", bytes: 8_000)+ try directory.file("Library/Containers/org.example.chat/Data/tmp/upload.part", bytes: 8_000)++ let report = await SpaceInventory.scan(+ home: directory.url, root: directory.url, minimumSize: 1, measure: FileSize.measure+ )++ let folders = report.items.first { $0.id == "container-caches" }?.urls+ .map { $0.pathComponents.suffix(3).joined(separator: "/") } ?? []+ #expect(Set(folders) == ["ABCDE12345.org.example.shared/Library/Caches", "org.example.chat/Data/tmp"])+ }+@Test func everyDefinitionSaysWhatItIsAndWhoOwnsIt() {for definition in SpaceInventory.definitions {#expect(!definition.id.isEmpty)- #expect(!definition.paths.isEmpty || definition.containerFolder != nil)+ let containers = !definition.containerFolders.isEmpty || definition.groupContainerFolder != nil+ #expect(!definition.paths.isEmpty || containers)}#expect(Set(SpaceInventory.definitions.map(\.id)).count == SpaceInventory.definitions.count)}diff --git a/Packages/PeelCore/Tests/PeelCoreTests/SpaceRemovalTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/SpaceRemovalTests.swiftindex fa9bc763..3a53ac58 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/SpaceRemovalTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/SpaceRemovalTests.swift@@ -162,6 +162,43 @@ struct SpaceRemovalTests {#expect(plan.appsToQuit == ["Spotify"])}+ @Test func leavesAGroupContainersCachesAloneWhileAnAppSharingItIsOpen() async throws {+ let directory = try TemporaryDirectory()+ let groups = "home/Library/Group Containers"+ try directory.file("\(groups)/ABCDE12345.org.example.shared/Library/Caches/blob/data", bytes: 4_096)+ try directory.file("\(groups)/ABCDE12345.org.example.other/Library/Caches/blob/data", bytes: 4_096)+ let item = SpaceItem(+ id: "container-caches",+ category: .library,+ urls: ["shared", "other"].map { name in+ let caches = "\(groups)/ABCDE12345.org.example.\(name)/Library/Caches"+ return directory.url.appending(path: caches, directoryHint: .isDirectory)+ },+ size: 8_192,+ handling: .trash+ )++ let plan = await SpaceRemoval.plan(+ for: item, environment: environment(directory),+ running: [Naming.normalized("ABCDE12345.org.example.shared"): "Chat Example"]+ )++ let group = { (url: URL) in url.pathComponents.dropLast(3).last ?? "" }+ #expect(plan.removable.map(group) == ["ABCDE12345.org.example.other"])+ #expect(plan.appsToQuit == ["Chat Example"])+ }++ @Test func anOpenAppAnswersToTheGroupsItsSignatureClaims() {+ let notes = RunningCopies.Process(+ identifier: 1, bundleIdentifier: "com.apple.Notes",+ bundleURL: URL(filePath: "/System/Applications/Notes.app")+ )++ let names = SpaceRemoval.namesOfRunningApps([notes])++ #expect(names[Naming.normalized("group.com.apple.notes")] != nil)+ }+@Test func leavesEveryAttachmentMailKeptForThePersonToChoose() async throws {let directory = try TemporaryDirectory()let downloads = [diff --git a/Peel/Model/SpaceLibrary.swift b/Peel/Model/SpaceLibrary.swiftindex f28a6abd..b9330d1c 100644--- a/Peel/Model/SpaceLibrary.swift+++ b/Peel/Model/SpaceLibrary.swift@@ -33,7 +33,7 @@ final class SpaceLibrary: RowSelection {let plan = await SpaceRemoval.plan(for: item,exclusions: ExclusionsStore.shared.exclusions,- running: SpaceRemoval.namesOfRunningApps()+ running: RunningCopies.current)// A plan cut short measured only part of the area, and would read the rest as unknown.guard !Task.isCancelled else { return }@@ -95,7 +95,7 @@ extension SpaceLibrary: CarriesSelection {isRemoving = truedefer { isRemoving = false }let exclusions = ExclusionsStore.shared.exclusions- let removable = await SpaceRemoval.removable(in: item, exclusions: exclusions, running: SpaceRemoval.namesOfRunningApps())+ let removable = await SpaceRemoval.removable(in: item, exclusions: exclusions, running: RunningCopies.current)return await TrashService(exclusions: exclusions).trash(removable.filter { selectedURLs.contains($0) && part.sizes.keys.contains($0) })}diff --git a/Peel/Views/Space/SpaceText.swift b/Peel/Views/Space/SpaceText.swiftindex a031ab46..531b8aea 100644--- a/Peel/Views/Space/SpaceText.swift+++ b/Peel/Views/Space/SpaceText.swift@@ -139,7 +139,7 @@ extension SpaceItem {),"container-caches": Words(title: "Sandboxed App Caches",- detail: "What sandboxed apps, such as those from the App Store, cached in their own containers. An app that is open keeps its caches, and those of Apple’s own apps are listed but never selected."+ detail: "What sandboxed apps, such as those from the App Store, cached or left as temporary files in their own containers, and cached in the ones they share with apps from the same maker. What an open app uses stays, and the caches of Apple’s own apps are listed but never selected."),"mail-downloads": Words(title: "Mail Downloads",