What's wrong
Scan's step 4 (ImageDescriber/Verbs/Scan.cs:77-99) only ever adds a path to an existing record's KnownPaths. Nothing in the project removes one: the only writers of KnownPaths are Scan.cs:89, Scan.cs:216 (new record) and Import.MergeKnownPaths, and none of them removes entries. The only File.Exists check is in Import.
Failure scenario
- Scan describes
photo.jpg, whose content hashes to H1. Record H1 gets KnownPaths = [photo.jpg].
- The user crops or edits
photo.jpg. Its content now hashes to H2.
- Scan again. H2 gets a new record with
[photo.jpg], but H1 still lists photo.jpg.
Search for words from the old description returns photo.jpg with a description of content it no longer has.
Stats over-counts "Total known paths" and "Images found at multiple paths", and Export writes the same path under two hashes.
Files that are deleted or renamed also stay in KnownPaths forever, so Search keeps returning paths that no longer exist.
Suggested fix
After hashing, reconcile each record against the scan:
- For every known path under the scanned root, drop it if the scan did not find it, or if it now hashes to a different value.
- Remove records left with no paths, or keep them and report them in the scan summary (e.g. "N descriptions no longer match any file").
Only paths under the scanned root should be touched, so scanning one folder never prunes paths from another.
Acceptance criteria
- Scan a file, change its bytes, and scan again: the path appears under exactly one hash, the new one.
- Scan a file, delete it, and scan the same root again: the path is no longer listed.
- Paths outside the scanned root are untouched.
- Tests cover all three cases.
What's wrong
Scan's step 4 (
ImageDescriber/Verbs/Scan.cs:77-99) only ever adds a path to an existing record'sKnownPaths. Nothing in the project removes one: the only writers ofKnownPathsareScan.cs:89,Scan.cs:216(new record) andImport.MergeKnownPaths, and none of them removes entries. The onlyFile.Existscheck is in Import.Failure scenario
photo.jpg, whose content hashes to H1. Record H1 getsKnownPaths = [photo.jpg].photo.jpg. Its content now hashes to H2.[photo.jpg], but H1 still listsphoto.jpg.Searchfor words from the old description returnsphoto.jpgwith a description of content it no longer has.Statsover-counts "Total known paths" and "Images found at multiple paths", andExportwrites the same path under two hashes.Files that are deleted or renamed also stay in
KnownPathsforever, so Search keeps returning paths that no longer exist.Suggested fix
After hashing, reconcile each record against the scan:
Only paths under the scanned root should be touched, so scanning one folder never prunes paths from another.
Acceptance criteria