Skip to content

Deduplicate never shows which specific files will be kept vs. deleted before the confirmation prompt #114

Description

@matt-edmondson

What's wrong

Scan and DryRun both print a full per-group KEEP:/DELETE: listing of every affected path before doing anything. Deduplicate.Run (FileDeduplicator/Verbs/Deduplicate.cs:63-68) instead only prints a generic count and policy statement — "Found {duplicates.Count} group(s) of duplicate files." / "Keeping the copy with the shortest filename in each group." — before asking "Proceed with deletion? (y/N): ". The actual paths to be deleted only appear (via Console.WriteLine($" Deleted: {file}")) after each file is already gone.

Failure scenario

The "keep shortest filename" heuristic is a blunt policy — e.g. two identical files report-final-DO-NOT-DELETE.pdf and r.pdf would keep r.pdf and delete the other. Because Deduplicate never lists which files fall into which bucket, a user confirming y has no way to catch a bad outcome before the deletion is irreversible, unlike DryRun/Scan which would have shown it. This undermines the confirmation step's purpose as a safety gate for a destructive operation.

Suggested fix

Before the y/N prompt, print the same per-group KEEP/DELETE listing that DryRun.Run already produces (the listing logic is essentially duplicated between Deduplicate.Run, DryRun.Run, and Scan.Run and could be shared).

Acceptance criteria

Running Deduplicate interactively shows every path to be deleted, grouped with its kept counterpart, before the confirmation prompt is presented.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions