From b42d544c642a368a36a782ea27df5d41bdb33bba Mon Sep 17 00:00:00 2001 From: Nishith Nand Date: Sun, 29 Nov 2026 09:45:12 -0800 Subject: [PATCH 1/5] Dedupe: Keep All in a group keeps pair keep-overrides keepAllInCluster rebuilt decisions from the per-path choices alone, dropping any pairKeepOverrides the person had set. Carry them across, as acceptSuggestionsForCluster does. deleteAllInCluster is unchanged; it now carries a comment that overrides are deliberately not carried there pending a product decision. Co-Authored-By: Claude Fable 5.2 --- .../Stores/DeduplicateSessionStore.swift | 3 +- .../DeduplicateSessionStoreTests.swift | 33 +++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/ui/Sources/ChronoframeAppCore/Stores/DeduplicateSessionStore.swift b/ui/Sources/ChronoframeAppCore/Stores/DeduplicateSessionStore.swift index 0150494b..b75391bf 100644 --- a/ui/Sources/ChronoframeAppCore/Stores/DeduplicateSessionStore.swift +++ b/ui/Sources/ChronoframeAppCore/Stores/DeduplicateSessionStore.swift @@ -527,7 +527,7 @@ public final class DeduplicateSessionStore: ObservableObject { for member in cluster.members { byPath[member.path] = .keep } - decisions = DedupeDecisions(byPath: byPath) + decisions = DedupeDecisions(byPath: byPath, pairKeepOverrides: decisions.pairKeepOverrides) approvedClusterIDs.insert(cluster.id) registerUndo( oldDecisions: oldDecisions, @@ -545,6 +545,7 @@ public final class DeduplicateSessionStore: ObservableObject { // INV-31: a bulk Delete never marks a protected edited variant. byPath[member.path] = member.isProtectedEditedVariant ? .keep : .delete } + // Pair keep-overrides are deliberately not carried here pending a product decision. decisions = DedupeDecisions(byPath: byPath) approvedClusterIDs.insert(cluster.id) registerUndo( diff --git a/ui/Tests/ChronoframeAppCoreTests/DeduplicateSessionStoreTests.swift b/ui/Tests/ChronoframeAppCoreTests/DeduplicateSessionStoreTests.swift index cfaaa64b..2bf5dac7 100644 --- a/ui/Tests/ChronoframeAppCoreTests/DeduplicateSessionStoreTests.swift +++ b/ui/Tests/ChronoframeAppCoreTests/DeduplicateSessionStoreTests.swift @@ -1804,6 +1804,39 @@ final class DeduplicateSessionStoreTests: XCTestCase { XCTAssertFalse(plan.items.contains { $0.path == "/dest/live/d1.mov" }, "The plan honours the override") } + /// Keep All in a group rebuilt `decisions` from the paths alone and dropped + /// the person's pair keep-overrides. + @MainActor + // AGENTS-INVARIANT: 14 + func testKeepAllInClusterPreservesPairKeepOverrides() async throws { + var still = PhotoCandidate(path: "/dest/live/d1.heic", size: 100, modificationTime: 0) + still.pairedPath = "/dest/live/d1.mov" + still.isLivePhotoStill = true + let members = [PhotoCandidate(path: "/dest/live/keep.heic", size: 100, modificationTime: 0), still] + let cluster = DuplicateCluster( + kind: .exactDuplicate, + members: members, + suggestedKeeperIDs: [members[0].id], + bytesIfPruned: 100, + annotation: ClusterAnnotation(confidence: .high, matchReason: MatchReason(kind: .exactDuplicate)) + ) + let engine = laneEngine([cluster]) + engine.summary = DeduplicateSummary(scanSnapshot: laneSnapshot([cluster], overriding: [ + "/dest/live/d1.mov": FileIdentity(size: 100, digest: "live-movie"), + ])) + let store = laneStore(engine: engine) + store.startScan(configuration: DeduplicateConfiguration(destinationPath: "/dest")) + let ready = await waitForCondition { store.status == .readyToReview } + XCTAssertTrue(ready) + store.decisions = DedupeDecisions(byPath: store.decisions.byPath, pairKeepOverrides: ["/dest/live/d1.mov"]) + + store.keepAllInCluster(cluster) + + XCTAssertEqual(store.approvedClusterIDs, [cluster.id]) + XCTAssertEqual(store.decisions.pairKeepOverrides, ["/dest/live/d1.mov"], "Keep All keeps the person's override") + XCTAssertEqual(store.decisions.byPath["/dest/live/d1.heic"], .keep) + } + @MainActor func testOrdinaryCommitStillRemovesSavedReview() async throws { let snapshotStore = InMemoryDeduplicateReviewSnapshotStore() From 2e4cf170d21462cb90e28c310ae932dfce42c0f5 Mon Sep 17 00:00:00 2001 From: Nishith Nand Date: Sun, 29 Nov 2026 09:45:45 -0800 Subject: [PATCH 2/5] Dedupe store: remove unused triageBuckets No production caller (Sources, Xcode/UITests, CLI); only its own test referenced it. Remove the property and that test. Co-Authored-By: Claude Fable 5.2 --- .../Stores/DeduplicateSessionStore.swift | 13 ------ .../DeduplicateSessionStoreTests.swift | 41 ------------------- 2 files changed, 54 deletions(-) diff --git a/ui/Sources/ChronoframeAppCore/Stores/DeduplicateSessionStore.swift b/ui/Sources/ChronoframeAppCore/Stores/DeduplicateSessionStore.swift index b75391bf..1a90e574 100644 --- a/ui/Sources/ChronoframeAppCore/Stores/DeduplicateSessionStore.swift +++ b/ui/Sources/ChronoframeAppCore/Stores/DeduplicateSessionStore.swift @@ -602,19 +602,6 @@ public final class DeduplicateSessionStore: ObservableObject { }.map(\.id)) } - // MARK: - Confidence Triage - - public var triageBuckets: [ConfidenceLevel: [DuplicateCluster]] { - var buckets: [ConfidenceLevel: [DuplicateCluster]] = [ - .high: [], .medium: [], .low: [], - ] - for cluster in clusters { - let level = cluster.annotation?.confidence ?? .medium - buckets[level, default: []].append(cluster) - } - return buckets - } - public func pauseReview() { guard status == .readyToReview, !clusters.isEmpty else { return } saveNow() diff --git a/ui/Tests/ChronoframeAppCoreTests/DeduplicateSessionStoreTests.swift b/ui/Tests/ChronoframeAppCoreTests/DeduplicateSessionStoreTests.swift index 2bf5dac7..fa4ae531 100644 --- a/ui/Tests/ChronoframeAppCoreTests/DeduplicateSessionStoreTests.swift +++ b/ui/Tests/ChronoframeAppCoreTests/DeduplicateSessionStoreTests.swift @@ -470,47 +470,6 @@ final class DeduplicateSessionStoreTests: XCTestCase { XCTAssertEqual(store.totalRecoverableBytes, 150) } - @MainActor - func testTriageBucketsGroupAnnotatedClustersAndDefaultMissingToMedium() async throws { - let high = DuplicateCluster( - kind: .exactDuplicate, - members: [ - PhotoCandidate(path: "/dest/high-a.jpg", size: 100, modificationTime: 0, qualityScore: 0.9), - PhotoCandidate(path: "/dest/high-b.jpg", size: 100, modificationTime: 0, qualityScore: 0.4), - ], - suggestedKeeperIDs: ["/dest/high-a.jpg"], - bytesIfPruned: 100, - annotation: ClusterAnnotation(confidence: .high, matchReason: MatchReason(kind: .exactDuplicate)) - ) - let low = DuplicateCluster( - kind: .nearDuplicate, - members: [ - PhotoCandidate(path: "/dest/low-a.jpg", size: 100, modificationTime: 0, qualityScore: 0.9), - PhotoCandidate(path: "/dest/low-b.jpg", size: 100, modificationTime: 0, qualityScore: 0.4), - ], - suggestedKeeperIDs: ["/dest/low-a.jpg"], - bytesIfPruned: 100, - annotation: ClusterAnnotation(confidence: .low, matchReason: MatchReason(kind: .nearDuplicate)) - ) - let unannotated = DuplicateCluster( - kind: .burst, - members: [ - PhotoCandidate(path: "/dest/mid-a.jpg", size: 100, modificationTime: 0, qualityScore: 0.9), - PhotoCandidate(path: "/dest/mid-b.jpg", size: 100, modificationTime: 0, qualityScore: 0.4), - ], - suggestedKeeperIDs: ["/dest/mid-a.jpg"], - bytesIfPruned: 100 - ) - let store = DeduplicateSessionStore(engine: MockDeduplicateEngine(clusters: [high, low, unannotated])) - - store.startScan(configuration: DeduplicateConfiguration(destinationPath: "/dest")) - _ = await waitForCondition { store.status == .readyToReview } - - XCTAssertEqual(store.triageBuckets[.high]?.map(\.id), [high.id]) - XCTAssertEqual(store.triageBuckets[.low]?.map(\.id), [low.id]) - XCTAssertEqual(store.triageBuckets[.medium]?.map(\.id), [unannotated.id]) - } - /// Defense-in-depth: a non-exact *video* cluster annotated high confidence /// must stay review-only in every lane, because perceptual video matching is /// never auto-accepted. The exact video cluster is still accepted. From 5139b04f8c1044408c04f68959a4dab57141b38b Mon Sep 17 00:00:00 2001 From: Nishith Nand Date: Sun, 29 Nov 2026 09:46:53 -0800 Subject: [PATCH 3/5] Guided setup: a source added from the menu on the destination step is handled like a drop A drop anywhere on the setup screen sets didOnboard (SetupView.swift onDrop), including on the second question, so guided setup ends. The menu route only did so on the first question. On the second question a source that differs from the one the screen itself moved on with now ends guided setup too. The screen records that source when it enters the second question, so its own picker result is never mistaken for an outside change, whatever order SwiftUI delivers the store update in. Co-Authored-By: Claude Fable 5.2 --- .../Views/Setup/GuidedSetupModel.swift | 15 ++++++++--- .../Views/Setup/GuidedSetupView.swift | 9 +++++-- .../GuidedSetupModelTests.swift | 27 +++++++++++++++---- 3 files changed, 40 insertions(+), 11 deletions(-) diff --git a/ui/Sources/ChronoframeApp/Views/Setup/GuidedSetupModel.swift b/ui/Sources/ChronoframeApp/Views/Setup/GuidedSetupModel.swift index 022a7b0c..b9043bb5 100644 --- a/ui/Sources/ChronoframeApp/Views/Setup/GuidedSetupModel.swift +++ b/ui/Sources/ChronoframeApp/Views/Setup/GuidedSetupModel.swift @@ -86,14 +86,21 @@ struct GuidedSetupModel: Equatable { } /// True when a source appeared from outside the screen (the Library menu's Add Folders, say) while - /// the first question is up. A drop already ends guided setup; this makes the menu route do the same. - /// The screen's own picker is excluded because it advances the step itself. + /// either question is up. A drop already ends guided setup on both steps (SetupView's onDrop sets + /// didOnboard); this makes the menu route do the same. The screen's own picker is excluded: on the + /// first question by `isChoosingSource`, on the second because the picker's result is the + /// `acknowledgedSourcePath` the screen recorded when it moved on. static func sourceAddedElsewhereEndsGuidedSetup( step: GuidedSetupStep, isChoosingSource: Bool, - sourcePath: String + sourcePath: String, + acknowledgedSourcePath: String ) -> Bool { - step == .source && !isChoosingSource && !sourcePath.isEmpty + guard !isChoosingSource, !sourcePath.isEmpty else { return false } + switch step { + case .source: return true + case .destination: return sourcePath != acknowledgedSourcePath + } } var title: String { diff --git a/ui/Sources/ChronoframeApp/Views/Setup/GuidedSetupView.swift b/ui/Sources/ChronoframeApp/Views/Setup/GuidedSetupView.swift index c8a89179..d79179d2 100644 --- a/ui/Sources/ChronoframeApp/Views/Setup/GuidedSetupView.swift +++ b/ui/Sources/ChronoframeApp/Views/Setup/GuidedSetupView.swift @@ -16,6 +16,9 @@ struct GuidedSetupView: View { @ObservedObject private var setupStore: SetupStore @State private var model: GuidedSetupModel @State private var isChoosingSource = false + /// The source the store held when the screen last moved to the second question, so a later + /// change to it can only have come from outside the screen. + @State private var acknowledgedSourcePath = "" @State private var isStarting = false /// A fixed starting state for renders. While it is set nothing is measured, so the screen shows /// exactly the estimate and free space it was given. @@ -61,11 +64,12 @@ struct GuidedSetupView: View { .task(id: measurementRoot) { await measureFolder() } .task(id: freeSpaceKey) { await refreshFreeSpace() } .onChange(of: setupStore.sourcePath) { _, path in - // A source added from the menu ends guided setup, the same as a drop (SetupView's onDrop). + // A source added from the menu ends guided setup on either question, the same as a drop (SetupView's onDrop). if GuidedSetupModel.sourceAddedElsewhereEndsGuidedSetup( step: model.step, isChoosingSource: isChoosingSource, - sourcePath: path + sourcePath: path, + acknowledgedSourcePath: acknowledgedSourcePath ) { didOnboard = true } @@ -234,6 +238,7 @@ struct GuidedSetupView: View { private func enterDestinationStep(sourceKind: GuidedSourceKind) { model.sourceKind = sourceKind + acknowledgedSourcePath = setupStore.sourcePath model.estimate = nil model.clearDestinationFreeBytes() model.isMeasuring = sourceKind == .folder diff --git a/ui/Tests/ChronoframeAppTests/GuidedSetupModelTests.swift b/ui/Tests/ChronoframeAppTests/GuidedSetupModelTests.swift index bf770dce..5b1aafdd 100644 --- a/ui/Tests/ChronoframeAppTests/GuidedSetupModelTests.swift +++ b/ui/Tests/ChronoframeAppTests/GuidedSetupModelTests.swift @@ -222,22 +222,39 @@ final class GuidedSetupModelTests: XCTestCase { func testASourceAddedFromTheMenuOnTheFirstQuestionEndsGuidedSetup() { XCTAssertTrue(GuidedSetupModel.sourceAddedElsewhereEndsGuidedSetup( - step: .source, isChoosingSource: false, sourcePath: "/Photos" + step: .source, isChoosingSource: false, sourcePath: "/Photos", acknowledgedSourcePath: "" + )) + } + + /// A drop on the second question sets `didOnboard` (SetupView's onDrop), so a source added from + /// the menu there ends guided setup too. + func testASourceAddedFromTheMenuOnTheSecondQuestionEndsGuidedSetup() { + // The screen moved on with /Photos; the menu then added /Other. + XCTAssertTrue(GuidedSetupModel.sourceAddedElsewhereEndsGuidedSetup( + step: .destination, isChoosingSource: false, sourcePath: "/Other", acknowledgedSourcePath: "/Photos" + )) + // The screen moved on with Apple Photos (no folder); the menu then added a folder. + XCTAssertTrue(GuidedSetupModel.sourceAddedElsewhereEndsGuidedSetup( + step: .destination, isChoosingSource: false, sourcePath: "/Photos", acknowledgedSourcePath: "" )) } func testGuidedSetupKeepsGoingForItsOwnChoiceOrNoSource() { // The screen's own picker is advancing the step itself. XCTAssertFalse(GuidedSetupModel.sourceAddedElsewhereEndsGuidedSetup( - step: .source, isChoosingSource: true, sourcePath: "/Photos" + step: .source, isChoosingSource: true, sourcePath: "/Photos", acknowledgedSourcePath: "" )) - // On the second question a source change is not the first answer. + // On the second question the source the screen itself chose is not an outside change, even if + // the store's update is seen after the step has moved on. XCTAssertFalse(GuidedSetupModel.sourceAddedElsewhereEndsGuidedSetup( - step: .destination, isChoosingSource: false, sourcePath: "/Photos" + step: .destination, isChoosingSource: false, sourcePath: "/Photos", acknowledgedSourcePath: "/Photos" )) // A source being cleared is not an answer either. XCTAssertFalse(GuidedSetupModel.sourceAddedElsewhereEndsGuidedSetup( - step: .source, isChoosingSource: false, sourcePath: "" + step: .source, isChoosingSource: false, sourcePath: "", acknowledgedSourcePath: "" + )) + XCTAssertFalse(GuidedSetupModel.sourceAddedElsewhereEndsGuidedSetup( + step: .destination, isChoosingSource: false, sourcePath: "", acknowledgedSourcePath: "/Photos" )) } From c9c0dbabec877e5c9d2fd557cc97f73c45d1abf6 Mon Sep 17 00:00:00 2001 From: Nishith Nand Date: Sun, 29 Nov 2026 09:47:04 -0800 Subject: [PATCH 4/5] =?UTF-8?q?German:=20retired=20Rapid=20Triage=20keys?= =?UTF-8?q?=20match=20Schnellpr=C3=BCfung?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Neither "Rapid Triage" nor "Rapid triage progress" is referenced from Sources, so a stale lookup is the only way they could show. Align their German with the screen's name (Quick Review, Schnellprüfung) so a stale lookup cannot show a third name. Keys kept. Co-Authored-By: Claude Fable 5.2 --- ui/Sources/ChronoframeApp/Resources/Localizable.xcstrings | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/Sources/ChronoframeApp/Resources/Localizable.xcstrings b/ui/Sources/ChronoframeApp/Resources/Localizable.xcstrings index 192d0c6a..00134a66 100644 --- a/ui/Sources/ChronoframeApp/Resources/Localizable.xcstrings +++ b/ui/Sources/ChronoframeApp/Resources/Localizable.xcstrings @@ -8392,7 +8392,7 @@ "de" : { "stringUnit" : { "state" : "translated", - "value" : "Schnelle Bereinigung" + "value" : "Schnellprüfung" } } } @@ -13754,7 +13754,7 @@ "de" : { "stringUnit" : { "state" : "translated", - "value" : "Fortschritt der Schnellsichtung" + "value" : "Fortschritt der Schnellprüfung" } } } From 386037510213b4817da53fa34ffb36c5bd4c1a99 Mon Sep 17 00:00:00 2001 From: Nishith Nand Date: Sun, 29 Nov 2026 09:47:29 -0800 Subject: [PATCH 5/5] FRX plan docs: record the follow-up changes Co-Authored-By: Claude Fable 5.2 --- docs/plan/first-run-experience/DECISIONS.md | 1 + docs/plan/first-run-experience/PROGRESS.md | 1 + 2 files changed, 2 insertions(+) diff --git a/docs/plan/first-run-experience/DECISIONS.md b/docs/plan/first-run-experience/DECISIONS.md index bb2091ff..e7df889b 100644 --- a/docs/plan/first-run-experience/DECISIONS.md +++ b/docs/plan/first-run-experience/DECISIONS.md @@ -43,6 +43,7 @@ Keep every invariant; fewest changed lines; copy the named reference pattern; wh - Changing the layout in Settings or in Choose Folders after a preview does not mark the preview stale. - The Options-menu count for the old "Accept All Safe" item could disagree with what it applied; the item is replaced in C-13. - `acceptAllSuggestions()` and `acceptAllHighConfidence()` have no caller after M2; removing them is a follow-up. + - Follow-on (2026-11-29): the owner chose removal; both were removed in PR #310, catalog keys kept. - "never hard-deletes them" in `SharedViews.swift:895` is jargon; rewording it is the owner's call under D-FRX-12. ## Runtime decisions diff --git a/docs/plan/first-run-experience/PROGRESS.md b/docs/plan/first-run-experience/PROGRESS.md index 606b12db..d3832b31 100644 --- a/docs/plan/first-run-experience/PROGRESS.md +++ b/docs/plan/first-run-experience/PROGRESS.md @@ -104,3 +104,4 @@ Prefix `FRX`. Status values: todo, in-progress, review, done, blocked. "Compiled - G3 PNGs sent to the owner. Rendered, not verified in the running app. - 2026-11-29 after G3: owner confirmed D-FRX-11 and D-FRX-25 and asked for B-1 option 1 (D-FRX-119). `fix/dedupe-planner-rail-protects-fanout` `2f8954f` from `origin/main`: red first (`cf_swift.sh test DeduplicationPlannerGroupRailTests` exit 1, 6 failures), then `cf_swift.sh test DeduplicationPlanner` exit 0 (11 tests), `coverage` exit 0 (2518 passed; 96.17%), `guards origin/main` exit 0 (14), `xcode` exit 0, `git diff --check` exit 0. Merged into `feature/first-run-duplicates`; the "not a guarantee" sentences in QUICK_START, FAQ, README and SAFETY_AND_RECOVERY now state the skip as a fact. - 2026-11-29: the planner fix changed two premise assertions in `ChronoframeCoreFreeDedupeBatchPlannerTests.testForcedKeepThatWouldUnskipAGroupStopsTheWalk` (`:266`, `:297`): the full plan and the Y+Z plan no longer contain `y1`, because a skipped group now stays whole. The trap the test covers (a forced Keep un-skips Y) and its `XCTAssertNil` are unchanged. `cf_swift.sh test ChronoframeCoreFreeDedupeBatchPlannerTests` exit 0 (13 tests). +- 2026-11-29 follow-ups: PR #310 (`fix/first-run-followups`) fixed issues #301–#305. The `runPreviewOverAllowance` fixture histogram now sums to the plan's 18,412 files, and 2026-10 reads 212 on the bar and on the card (the earlier 21,140 and 2,420 figures above are the old fixture). The three symbols noted above as unused (`acceptAllSuggestions()`, `acceptAllHighConfidence()`, `TimelinePlurals.filesToCopy`) were removed; their catalog keys were kept. The UI suite and the accessibility audit ran in CI, not on the owner's Mac: run 46281581830 had 33 UI tests, 0 failures, and the audit passed. `A11yBaseline.json` went from 37 to 16 entries on CI-runner evidence only; it has not been checked on the owner's Mac. Leftovers (`fix/first-run-leftovers`, off `fix/first-run-followups`, one commit each): (1) `keepAllInCluster` now carries `pairKeepOverrides` across (owner decision), with a test tagged `// AGENTS-INVARIANT: 14`; `deleteAllInCluster` is unchanged apart from a comment that overrides are deliberately not carried there pending a product decision, and `applySuggestionsToDecisions` is untouched. (2) `DeduplicateSessionStore.triageBuckets` and its test removed; it had no production caller. (3) Guided setup: a drop sets `didOnboard` on either question (`SetupView.swift` `.onDrop`), so a source added from the menu on the destination question now ends guided setup too; `sourceAddedElsewhereEndsGuidedSetup` gained `acknowledgedSourcePath` so the screen's own picker result is never mistaken for an outside change; unit tests added, not run in the UI suite. (4) German for the unreferenced keys `Rapid Triage` and `Rapid triage progress` now reads Schnellprüfung and Fortschritt der Schnellprüfung; keys kept, `check_german_localization.py --baseline-ref origin/main` exit 0.