Skip to content

fix: cancelVerification spinner, silent scan-persist, KeeperSheet reveal errors, indentation#109

Merged
RasputinKaiser merged 2 commits into
mainfrom
fix/code-review-bugs
Jun 23, 2026
Merged

fix: cancelVerification spinner, silent scan-persist, KeeperSheet reveal errors, indentation#109
RasputinKaiser merged 2 commits into
mainfrom
fix/code-review-bugs

Conversation

@RasputinKaiser

Copy link
Copy Markdown
Owner

Summary

  • cancelVerification(forGroupID:) leaves spinner active — the method cancelled the Swift Task and ScanCancellation but never removed the group from verifyingGroupIDs. The spinner stayed visible until the task's deferred MainActor.run block eventually ran. Fix: remove the group from all three tracking dicts immediately at the call site.

  • Scan-time hash-cache persist failures are silent — the post-scan Task.detached called persist() (which swallows errors via try?). Disk-full or permission-denied failures reached only os_log; errorMessage was never set. Fix: switch to persistThrowing() and route failures to errorMessage, matching the pattern already used in OnDemandVerificationStore.persistAsync.

  • KeeperComparisonSheet drops reveal/revealAll errors — both calls used _ = and the sheet had no way to route errors back to ScanStore. Fix: add onRevealError: (String) -> Void parameter; DuplicateCandidatesView passes { store.errorMessage = $0 }.

  • Indentation regressions — three column-0 statements (errorMessage = … in ScanStore, let data: Data in DuplicateHashCache, Array(items.sorted … in FileSystemScanner) left by earlier diff hunks. No runtime impact; fixed for consistency.

Test plan

  • swift build — clean, no warnings
  • swift test — 172 tests, all green
  • Manual: verify "Verify Now" spinner clears immediately on cancel
  • Manual: trigger a disk-write failure (e.g. read-only volume) and confirm errorMessage fires after scan completes
  • Manual: delete a file from a verified duplicate group and confirm the Keeper sheet shows an error when you tap Reveal

🤖 Generated with Claude Code

RasputinKaiser and others added 2 commits June 23, 2026 18:06
…rsist, reveal errors

- cancelVerification(forGroupID:) now immediately removes the group from
  verifyingGroupIDs, verifyTasksByID, and verifyCancellationsByID so the
  spinner clears the moment the user cancels, rather than waiting for the
  task's deferred MainActor.run block to run.

- Scan-time hash-cache persist failures now surface through errorMessage.
  The post-scan Task.detached now calls persistThrowing() and routes any
  write failure to the main actor, matching the behaviour already present
  in OnDemandVerificationStore.persistAsync.

- KeeperComparisonSheet: add onRevealError callback so reveal/revealAll
  failures are passed back to the caller (DuplicateCandidatesView routes
  them to ScanStore.errorMessage). Previously both results were discarded
  with _ = and the user got no feedback when a file had been moved/deleted.

- Fix three indentation regressions (column-0 statements) in ScanStore,
  DuplicateHashCache, and FileSystemScanner left by earlier diff hunks.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… store over callback

- cancelVerification(forGroupID:): use removeValue(forKey:) which returns
  the removed value, collapsing 3 dict hash/probe operations per dict to 1
  and eliminating the separate wasActive nil-check pass.

- ScanStore.scan(_:) catch block: hoist error.localizedDescription to `desc`
  so the os_signpost call and the errorMessage string share one evaluation.
  Same fix in OnDemandVerificationStore.persistAsync where `errorMessage` was
  already hoisted but then error.localizedDescription was called again on the
  reportError line anyway.

- KeeperComparisonSheet: replace onRevealError: (String) -> Void with
  @ObservedObject var store: ScanStore, matching every other view in the
  codebase. The sheet now writes store.errorMessage directly instead of
  routing a string through a callback that every future caller must wire.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@RasputinKaiser RasputinKaiser merged commit adfdd50 into main Jun 23, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant