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. 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" } } } 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/Sources/ChronoframeAppCore/Stores/DeduplicateSessionStore.swift b/ui/Sources/ChronoframeAppCore/Stores/DeduplicateSessionStore.swift index 0150494b..1a90e574 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( @@ -601,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 cfaaa64b..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. @@ -1804,6 +1763,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() 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" )) }