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
Tell a project too slow to read from one too large or changed
Țugui Dragoș58337712b6df
diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstringsindex 045bf230..dbb9e279 100644--- a/Localization/Peel/Localizable.xcstrings+++ b/Localization/Peel/Localizable.xcstrings@@ -35862,6 +35862,112 @@}}},+ "Couldn’t read in time when it last changed" : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Včas se nepodařilo přečíst, kdy se naposledy změnil"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Letzte Änderung konnte nicht rechtzeitig gelesen werden"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "No se ha podido leer a tiempo cuándo cambió por última vez"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Impossible de le lire à temps pour savoir quand il a été modifié pour la dernière fois"+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Impossibile leggere in tempo quando è cambiato l’ultima volta"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "最後にいつ変更されたかを時間内に読み取れませんでした"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "마지막으로 변경된 시점을 제시간에 읽을 수 없음"+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Kon niet op tijd lezen wanneer het voor het laatst is gewijzigd"+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Nie udało się w porę odczytać, kiedy ostatnio się zmienił"+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Não foi possível saber a tempo quando mudou pela última vez"+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Nu s‑a putut citi la timp data ultimei modificări"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Не удалось вовремя определить, когда он последний раз изменялся"+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Kunde inte läsa i tid när det senast ändrades"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Son değişiklik tarihi zamanında okunamadı"+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Не вдалося вчасно прочитати, коли він востаннє змінювався"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "未能及时读取上次更改的时间"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "無法及時讀取上次變更的時間"+ }+ }+ }+ },"Couldn’t turn on" : {"localizations" : {"cs" : {@@ -107745,6 +107851,112 @@}}},+ "Not selected: Peel couldn’t read this project in time to tell when it last changed." : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Nevybráno: Peelu se nepodařilo přečíst tento projekt včas, aby poznal, kdy se naposledy změnil."+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Nicht ausgewählt: Peel konnte dieses Projekt nicht rechtzeitig lesen, um sagen zu können, wann es sich zuletzt geändert hat."+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Sin seleccionar: Peel no ha podido leer este proyecto a tiempo para saber cuándo cambió por última vez."+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Non sélectionné : Peel n’a pas pu lire ce projet à temps pour savoir quand il a été modifié pour la dernière fois."+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Non selezionato: Peel non è riuscito a leggere questo progetto in tempo per capire quando è cambiato l’ultima volta."+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "未選択: Peelはこのプロジェクトを時間内に読み取れなかったため、最後にいつ変更されたか判断できません。"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "선택되지 않음: Peel이 이 프로젝트를 제시간에 읽지 못해 마지막으로 변경된 시점을 알 수 없습니다."+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Niet geselecteerd: Peel kon dit project niet op tijd lezen om te zien wanneer het voor het laatst is gewijzigd."+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Nie zaznaczono: Peel nie mógł w porę odczytać tego projektu, by określić, kiedy ostatnio się zmienił."+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Não selecionado: o Peel não conseguiu ler este projeto a tempo de saber quando ele mudou pela última vez."+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Neselectat: Peel nu a putut citi acest proiect la timp pentru a spune când s‑a modificat ultima dată."+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Не выбрано: Peel не удалось вовремя прочитать этот проект, чтобы определить, когда он последний раз изменялся."+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Inte markerad: Peel kunde inte läsa projektet i tid för att avgöra när det senast ändrades."+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Seçilmedi: Peel, en son ne zaman değiştiğini anlamak için bu projeyi zamanında okuyamadı."+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Не вибрано: Peel не вдалося вчасно прочитати цей проєкт, щоб визначити, коли він востаннє змінювався."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "未选择:Peel未能及时读取此项目,因此无法判断它上次更改的时间。"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "未選取:Peel無法及時讀取此計畫案,因此無法判斷它上次變更的時間。"+ }+ }+ }+ },"Not selected: Xcode didn’t record when %@ was last opened, so its build data may still be needed." : {"localizations" : {"cs" : {@@ -130409,6 +130621,112 @@}}},+ "Peel couldn’t read it in time to see whether it changed after Peel looked at it. Scan again to review it." : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peelu se ji nepodařilo přečíst včas, aby zjistil, zda se změnila poté, co ji prověřil. Prohledejte znovu a zkontrolujte ji."+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel konnte es nicht rechtzeitig lesen, um zu erkennen, ob es sich geändert hat, nachdem Peel es angesehen hat. Scanne erneut, um es zu prüfen."+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel no ha podido leerlo a tiempo para ver si ha cambiado después de que lo revisara. Vuelve a analizar para revisarlo."+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel n’a pas pu le lire à temps pour voir s’il a été modifié après que Peel l’a examiné. Relancez l’analyse pour le vérifier."+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel non è riuscito a leggerlo in tempo per vedere se è cambiato dopo che Peel l’ha esaminato. Analizza di nuovo per rivederlo."+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peelは、確認した後に変更されたかどうかを時間内に読み取れませんでした。もう一度スキャンして確認してください。"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel이 제시간에 읽지 못해 살펴본 후에 변경되었는지 확인할 수 없습니다. 다시 스캔하여 검토하십시오."+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel kon het niet op tijd lezen om te zien of het is gewijzigd nadat Peel ernaar keek. Scan opnieuw om het te bekijken."+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel nie mógł tego w porę odczytać, by zobaczyć, czy zmieniło się po tym, jak to sprawdził. Przeskanuj ponownie, aby to przejrzeć."+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "O Peel não conseguiu lê-lo a tempo de ver se mudou depois que o Peel o examinou. Analise de novo para revisá-lo."+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel nu l‑a putut citi la timp pentru a vedea dacă s‑a modificat după ce l‑a examinat. Scanați din nou pentru a‑l revizui."+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel не удалось вовремя прочитать объект, чтобы узнать, изменился ли он после того, как Peel его проверил. Просканируйте снова, чтобы просмотреть его заново."+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel kunde inte läsa det i tid för att se om det ändrades efter att Peel tittade på det. Skanna igen för att granska det."+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel, baktıktan sonra değişip değişmediğini görmek için onu zamanında okuyamadı. Gözden geçirmek için yeniden tarayın."+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel не вдалося вчасно прочитати елемент, щоб зʼясувати, чи змінився він після перевірки Peel. Проскануйте знову, щоб переглянути його."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel未能及时读取它,无法确定它在Peel查看后是否发生了变化。请重新扫描以检查它。"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel無法及時讀取它,因此無法判斷它在Peel查看後是否有所變更。請重新掃描以檢查。"+ }+ }+ }+ },"Peel couldn’t read its own files." : {"localizations" : {"cs" : {diff --git a/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift b/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swiftindex c05c94cc..c87a3042 100644--- a/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift+++ b/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift@@ -690,7 +690,7 @@ struct ProjectsCommand: AsyncParsableCommand {move: { service, urls in// The question takes time, and work may have started in a project meanwhile.let changed = await ProjectArtifacts.changedSinceScan(suggested, among: artifacts)- return await service.trash(urls, refusing: { changed.contains($0) ? .changedSinceScan : nil })+ return await service.trash(urls, refusing: { changed[$0] })})}@@ -719,6 +719,7 @@ struct ProjectsCommand: AsyncParsableCommand {case .genericName: "name could mean anything"case .changedRecently: "changed in the last 7 days"case .lastChangeNotKnown: "too large to tell when it last changed"+ case .lastChangeNotReadInTime: "couldn't read in time when it last changed"case nil: nil}}diff --git a/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift b/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swiftindex 1e3a889a..17b3bd04 100644--- a/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift+++ b/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift@@ -521,6 +521,7 @@ extension TrashFailure.Reason {switch self {case .guarded(let refusal): refusal?.summary ?? "protected location"case .changedSinceScan: "changed since the scan"+ case .changeNotKnown: "couldn't tell in time whether it changed since the scan"case .claimedSinceScan: "claimed by an app that is installed now"case .lastCopy: "last copy"case .notPermitted: "not permitted"diff --git a/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift b/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swiftindex d860b329..ddf8453b 100644--- a/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift+++ b/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift@@ -14,6 +14,8 @@ public struct ProjectArtifact: Sendable, Hashable, Identifiable {/// The latest change in the project's own files, its artifacts left out.public let lastActivity: Date?public var lastActivityIsCertain = true+ /// False when the read of the project's last change didn't end within its budget, which says nothing of its size.+ public var lastActivityWasReadInTime = true/// A name that says nothing on its own, like `build` or `target`: shown, never selected for the user.public let hasGenericName: Bool/// Installed packages, which a build does not make again on its own: shown, never selected for the user.@@ -33,6 +35,7 @@ public struct ProjectArtifact: Sendable, Hashable, Identifiable {case genericNamecase changedRecentlycase lastChangeNotKnown+ case lastChangeNotReadInTime}/// Why Peel doesn't suggest it, or nil when it does. What time doesn't change comes first, so a folder that will@@ -42,6 +45,7 @@ public struct ProjectArtifact: Sendable, Hashable, Identifiable {if isEnvironment { return .installedPackages }if hasGenericName { return .genericName }if isRecentlyActive { return .changedRecently }+ if !lastActivityWasReadInTime { return .lastChangeNotReadInTime }if !lastActivityIsCertain { return .lastChangeNotKnown }return nil}@@ -68,11 +72,14 @@ public enum ProjectArtifacts {case at(Date)/// The project was too large to read whole, so the newest date seen is only a sample's.case notKnown+ /// The read didn't end in time, as on a slow disk.+ case notReadInTimecase none}public static func lastChange(of artifacts: [ProjectArtifact]) -> LastChange {if artifacts.contains(where: \.isRecentlyActive) { return .recently }+ if artifacts.contains(where: { !$0.lastActivityWasReadInTime }) { return .notReadInTime }if artifacts.contains(where: { !$0.lastActivityIsCertain }) { return .notKnown }return artifacts.compactMap(\.lastActivity).max().map { .at($0) } ?? .none}@@ -840,15 +847,23 @@ public enum ProjectArtifacts {/// last 7 days, or can't be read whole anymore. A folder chosen though Peel didn't suggest it stays chosen. `all`/// is every artifact the scan found.@concurrent- public static func changedSinceScan(_ chosen: [ProjectArtifact], among all: [ProjectArtifact]) async -> Set<URL> {+ public static func changedSinceScan(+ _ chosen: [ProjectArtifact], among all: [ProjectArtifact]+ ) async -> [URL: TrashFailure.Reason] {let suggested = chosen.filter(\.isRecommended)- guard !suggested.isEmpty else { return [] }+ guard !suggested.isEmpty else { return [:] }let activities = await lastActivities(of: suggested.map(\.project), passingBy: all.map(\.url))let cutoff = Date.now.addingTimeInterval(-recentlyActive)- return Set(suggested.filter { artifact in- guard let activity = activities[key(of: artifact.project)], activity.isCertain else { return true }- return activity.date.map { $0 > cutoff } ?? false- }.map(\.url))+ var refused: [URL: TrashFailure.Reason] = [:]+ for artifact in suggested {+ let activity = activities[key(of: artifact.project)]+ if activity?.wasReadInTime != true {+ refused[artifact.url] = .changeNotKnown+ } else if activity?.isCertain != true || activity?.date.map({ $0 > cutoff }) == true {+ refused[artifact.url] = .changedSinceScan+ }+ }+ return refused}/// Each project's name as a list shows it: its folder's name, or, while another of `projects` has a folder of the@@ -1191,7 +1206,7 @@ public enum ProjectArtifacts {private static func withLastActivity(_ pending: [Pending]) async -> [ProjectArtifact] {let activities = await lastActivities(of: pending.map(\.project), passingBy: pending.map(\.url))return pending.map { artifact in- let activity = activities[key(of: artifact.project)] ?? (date: nil, isCertain: false)+ let activity = activities[key(of: artifact.project)] ?? Activity(date: nil, isCertain: false)let heldBack = HoldBack.seen(in: artifact.contents)return ProjectArtifact(url: artifact.url,@@ -1201,6 +1216,7 @@ public enum ProjectArtifacts {size: artifact.contents.flatMap { $0.couldNotBeRead ? nil : $0.size },lastActivity: activity.date,lastActivityIsCertain: activity.isCertain,+ lastActivityWasReadInTime: activity.wasReadInTime,hasGenericName: artifact.found.definition?.isGeneric ?? false,isEnvironment: artifact.found.definition?.isEnvironment ?? false,heldBack: (heldBack == .holdsRepository && artifact.found.remakesItsClones ? nil : heldBack)@@ -1209,12 +1225,21 @@ public enum ProjectArtifacts {}}+ struct Activity: Sendable {+ let date: Date?+ let isCertain: Bool+ var wasReadInTime = true+ }+/// Each project's last change, keyed by `key(of:)`, passing by every one of `artifacts` inside it, those of the- /// projects inside it included.- private static func lastActivities(+ /// projects inside it included. `read` stands in for the read in a test.+ static func lastActivities(of projects: [URL],- passingBy artifacts: [URL]- ) async -> [String: (date: Date?, isCertain: Bool)] {+ passingBy artifacts: [URL],+ within budget: TimeInterval = FileSize.budget,+ reading read: @escaping @Sendable (URL, Set<String>, @escaping @Sendable () -> Bool)+ -> (date: Date?, isCertain: Bool) = { lastActivity(in: $0, ignoring: $1, isGivenUp: $2) }+ ) async -> [String: Activity] {let projects = Dictionary(projects.map { (key(of: $0), $0) }, uniquingKeysWith: { first, _ in first })var inside: [String: Set<String>] = [:]for artifact in artifacts {@@ -1229,13 +1254,14 @@ public enum ProjectArtifacts {above = above.deletingLastPathComponent()}}- var activities: [String: (date: Date?, isCertain: Bool)] = [:]+ var activities: [String: Activity] = [:]for (project, folder) in projects {guard !Task.isCancelled else { break }let ignoring = inside[project] ?? []- activities[project] = await SlowRead.answer(within: FileSize.budget) { isGivenUp in- lastActivity(in: folder, ignoring: ignoring, isGivenUp: isGivenUp)- } ?? (date: nil, isCertain: false)+ let answer = await SlowRead.answer(within: budget) { isGivenUp in read(folder, ignoring, isGivenUp) }+ activities[project] = Activity(+ date: answer?.date, isCertain: answer?.isCertain ?? false, wasReadInTime: answer != nil+ )}return activities}diff --git a/Packages/PeelCore/Sources/PeelCore/Removal/TrashService.swift b/Packages/PeelCore/Sources/PeelCore/Removal/TrashService.swiftindex b082b9d4..ce3992a4 100644--- a/Packages/PeelCore/Sources/PeelCore/Removal/TrashService.swift+++ b/Packages/PeelCore/Sources/PeelCore/Removal/TrashService.swift@@ -68,6 +68,8 @@ public struct TrashFailure: Sendable, Hashable {/// `RemovalGuard` refuses it, for that reason. Nil for a refusal recorded before Peel kept the reason.case guarded(GuardRefusal?)case changedSinceScan+ /// Read again before it moves, and the read didn't end in time, so whether it changed isn't known.+ case changeNotKnown/// Listed as an orphan, but an app installed since the scan claims it.case claimedSinceScancase lastCopy@@ -122,7 +124,8 @@ extension TrashFailure.Reason {public var isAboutTheItem: Bool {switch self {case .historyUnreadable, .historyCannotBeWritten, .peelRemovesItself, .needsHelper: false- case .guarded, .changedSinceScan, .claimedSinceScan, .lastCopy, .notPermitted, .locked, .movedWithoutATrace,+ case .guarded, .changedSinceScan, .changeNotKnown, .claimedSinceScan, .lastCopy, .notPermitted, .locked,+ .movedWithoutATrace,.somethingElseMoved, .heldOpen, .peelRunsFromIt, .heldByAnotherAccount, .openForAnotherUser,.heldByABuildTool, .inUseAsAnInputSource, .inUseByMacOS, .attachedDiskImage, .failed: true}@@ -141,6 +144,7 @@ extension TrashFailure.Reason {switch self {case .guarded(let refusal): refusal?.name ?? "protected-location"case .changedSinceScan: "changed-since-scan"+ case .changeNotKnown: "change-not-known"case .claimedSinceScan: "claimed-since-scan"case .lastCopy: "last-copy"case .notPermitted: "not-permitted"@@ -184,6 +188,7 @@ extension TrashFailure.Reason {switch name {case "protected-location": self = .guarded(nil)case "changed-since-scan": self = .changedSinceScan+ case "change-not-known": self = .changeNotKnowncase "claimed-since-scan": self = .claimedSinceScancase "last-copy": self = .lastCopycase "not-permitted": self = .notPermitteddiff --git a/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swiftindex e4209d46..9238dfb1 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swift@@ -399,8 +399,9 @@ struct ProjectArtifactsTests {let changed = await ProjectArtifacts.changedSinceScan(scan.artifacts, among: scan.artifacts)#expect(scan.artifacts.filter(\.isRecommended).count == 2)- #expect(changed.map(\.lastPathComponent) == ["node_modules"])- #expect(changed.allSatisfy { $0.path(percentEncoded: false).contains("/app/") })+ #expect(changed.keys.map(\.lastPathComponent) == ["node_modules"])+ #expect(changed.keys.allSatisfy { $0.path(percentEncoded: false).contains("/app/") })+ #expect(changed.values.allSatisfy { $0 == .changedSinceScan })}@Test func findsWhatJavaScriptToolsBuild() async throws {@@ -1526,6 +1527,31 @@ struct ProjectArtifactsTests {#expect(scan.refusedRoots.map(\.reason) == [.notAFolder])}+ @Test func aLastChangeNotReadInTimeIsToldApartFromATooLargeProject() async throws {+ let directory = try TemporaryDirectory()+ let project = try directory.directory("app")+ let never = DispatchSemaphore(value: 0)+ defer { never.signal() }++ let activities = await ProjectArtifacts.lastActivities(of: [project], passingBy: [], within: 0.05) { _, _, _ in+ never.wait()+ return (date: nil, isCertain: false)+ }++ let activity = try #require(activities[ProjectArtifacts.key(of: project)])+ #expect(!activity.wasReadInTime && !activity.isCertain)+ var artifact = ProjectArtifact(+ url: project.appending(path: "node_modules"), project: project, name: "node_modules", tool: "npm",+ size: 1, lastActivity: nil, hasGenericName: false, isEnvironment: false+ )+ artifact.lastActivityIsCertain = false+ #expect(artifact.keptBecause == .lastChangeNotKnown)+ #expect(ProjectArtifacts.lastChange(of: [artifact]) == .notKnown)+ artifact.lastActivityWasReadInTime = false+ #expect(artifact.keptBecause == .lastChangeNotReadInTime)+ #expect(ProjectArtifacts.lastChange(of: [artifact]) == .notReadInTime)+ }+@Test func aWorktreeOrASubmoduleIsDatedByGitsMarksToo() throws {let directory = try TemporaryDirectory()try directory.file("main/.git/worktrees/feature/HEAD")diff --git a/Packages/PeelCore/Tests/PeelCoreTests/RefusalLogTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/RefusalLogTests.swiftindex 5ffabfe4..f44f6c93 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/RefusalLogTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/RefusalLogTests.swift@@ -365,7 +365,8 @@ struct RefusalLogTests {}private static let everyReason: [TrashFailure.Reason] = [- .guarded(nil), .changedSinceScan, .claimedSinceScan, .lastCopy, .notPermitted, .locked, .needsHelper,+ .guarded(nil), .changedSinceScan, .changeNotKnown, .claimedSinceScan, .lastCopy, .notPermitted, .locked,+ .needsHelper,.movedWithoutATrace, .somethingElseMoved(named: "x 2"), .historyUnreadable, .historyCannotBeWritten,.peelRemovesItself, .heldOpen(by: ["Figma Agent", "java"]), .peelRunsFromIt,.heldByAnotherAccount(by: ["CtxHelper"]), .openForAnotherUser(by: ["Spotify"]), .heldByABuildTool(by: ["Gradle"]),diff --git a/Peel/Model/ProjectLibrary.swift b/Peel/Model/ProjectLibrary.swiftindex 1ac2338f..7c4d06a3 100644--- a/Peel/Model/ProjectLibrary.swift+++ b/Peel/Model/ProjectLibrary.swift@@ -228,7 +228,7 @@ extension ProjectLibrary: CarriesSelection {let changed = await ProjectArtifacts.changedSinceScan(chosen, among: (groups ?? []).flatMap(\.artifacts))return await TrashService(exclusions: ExclusionsStore.shared.exclusions).trash(chosen.map(\.url),- refusing: { changed.contains($0) ? .changedSinceScan : nil }+ refusing: { changed[$0] })}diff --git a/Peel/Views/Presentation.swift b/Peel/Views/Presentation.swiftindex 153f7099..07f721e9 100644--- a/Peel/Views/Presentation.swift+++ b/Peel/Views/Presentation.swift@@ -173,6 +173,7 @@ extension TrashFailure.Reason {case .guarded(let refusal?): refusal.explanation.resolved(in: bundle)case .guarded(nil): String(localized: "Peel won’t move this: it is protected, or your exclusions in Settings keep it where it is.", bundle: bundle)case .changedSinceScan: String(localized: "It changed after Peel looked at it. Scan again to review it.", bundle: bundle)+ case .changeNotKnown: String(localized: "Peel couldn’t read it in time to see whether it changed after Peel looked at it. Scan again to review it.", bundle: bundle)case .claimedSinceScan: String(localized: "Peel couldn’t confirm it is still nobody’s: an installed app may claim it now. Scan again to review it.", bundle: bundle)case .lastCopy: String(localized: "The copy Peel was keeping has changed or moved since the scan, so this one may be the last.", bundle: bundle)case .notPermitted: String(localized: "macOS didn’t allow it.", bundle: bundle)diff --git a/Peel/Views/Projects/ProjectDetailView.swift b/Peel/Views/Projects/ProjectDetailView.swiftindex d22735b1..a1f7c51c 100644--- a/Peel/Views/Projects/ProjectDetailView.swift+++ b/Peel/Views/Projects/ProjectDetailView.swift@@ -154,6 +154,8 @@ struct ProjectDetailView: View {String(localized: "Not selected: something in this project changed in the last 7 days.")case .lastChangeNotKnown:String(localized: "Not selected: this project is too large for Peel to tell when it last changed.")+ case .lastChangeNotReadInTime:+ String(localized: "Not selected: Peel couldn’t read this project in time to tell when it last changed.")case nil:nil}diff --git a/Peel/Views/Projects/ProjectList.swift b/Peel/Views/Projects/ProjectList.swiftindex 5112a160..6f2b55f0 100644--- a/Peel/Views/Projects/ProjectList.swift+++ b/Peel/Views/Projects/ProjectList.swift@@ -213,6 +213,8 @@ private struct ProjectRow: View {.lineLimit(1)case .notKnown:Text("Too large to tell when it last changed")+ case .notReadInTime:+ Text("Couldn’t read in time when it last changed")case .none:EmptyView()}