Repository navigation
Log a Consistent Reason for Every Delete and DeleteInvalidFiles Keep - #1153
Conversation
Every delete logs Deleting {What} : {Reason} : {FileName} before it acts,
a failed delete logs Failed to delete {What} : {FileName}, and a failed
file kept under DeleteInvalidFiles logs its reason. The failed media
delete names the failed operation, and the empty-folder delete logs each
folder it removes.
Fixes #1139
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The delete and failed-delete lines come from one helper, so the shape cannot drift between sites. The docs name only the keeps DeleteFailedFile logs, and a test covers the rethrow path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 31 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
A recorded local strict-review pass covers head |
PR Summary by QodoLog reasons for user-content deletes and failed-file keeps
AI Description
Diagram
High-Level Assessment
Files changed (9)
|
Code Review by Qodo
1. Sidecar deletion failures go unreported
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
A recorded local strict-review pass covers head |
|
Answering Qodo's review findings:
Declined with evidence in the ProcessFile.cs:2071 thread. The guard runs only after the media file in the same directory was deleted, so a present sidecar cannot read as missing for access reasons on Linux or Windows.
Fixed in e01ed76. TryDelete passes its [CallerMemberName] caller to LogAndHandle. |
There was a problem hiding this comment.
🟡 Changes recommended
The change still has three active nit-level issues: an inaccurate release-note claim, an ungrammatical history entry, and incomplete log coverage for the helper’s keep-reason branches.
3 open issues
What changed in this PR
This pull request standardizes logging for user-content deletions and failed-file retention, while updating related processing code, tests, and documentation.
Changes:
- Adds the
FileDeletehelper for consistent deletion, failure, and severity logging. - Records operation-specific reasons when failed files are kept.
- Updates cleanup callers, regression tests, architecture guidance, and release history.
- Logs per-folder deletion outcomes and converted-input cleanup.
This pull request requires changes.
| File | Description |
|---|---|
PlexCleanerTests/VerifyToolErrorTests.cs |
Updates failed-file cleanup calls with an operation name. |
PlexCleanerTests/ReEncodeBitrateStateTests.cs |
Updates failed-file cleanup calls with the operation name. |
PlexCleanerTests/DeleteFailedFileTests.cs |
Adds coverage for deletion, keep reasons, failures, and empty-folder logging. |
PlexCleaner/ProcessFile.cs |
Routes user-file deletions through FileDelete and logs failed-file keep reasons. |
PlexCleaner/Process.cs |
Passes failed operations and tracks per-folder deletion failures. |
PlexCleaner/FileDelete.cs |
Provides centralized deletion and failure logging behavior. |
PlexCleaner/Convert.cs |
Routes converted-input deletion through the shared helper. |
HISTORY.md |
Documents the new deletion and keep logging behavior. |
ARCHITECTURE.md |
Defines deletion logging levels, formats, and failure semantics. |
Review effort: Lite
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
A recorded local strict-review pass covers head |

Summary
Refs #1139.
FileDeletehelper. It logsDeleting {What} : {Reason} : {FileName}before it acts, andFailed to delete {What} : {FileName}as an Error when the delete fails.DeleteFailedFiletakes the failed operation, so its reason readsFailed VerifyAndRepairrather than a generic line.DeleteEmptyFoldersreturn false as before.Process.ProcessFilestill fails the file without deleting anything else, as before.DeleteInvalidFileson,DeleteFailedFilelogsKeeping failed file : {Reason} : {FileName}for each keep. The reason is one of rename collision, tool error, tool signal, cancelled, orPostDecodeTimestamps.ARCHITECTURE.md"Logging Conventions" reserves Warning for the decision to modify media and keeps it out ofConvertand sidecar bookkeeping, so the committed taxonomy decides the level. The new "Delete and keep logging" subsection records this.DeleteFailedFile, and its own Error line already says why the file is kept. The docs name only the keepsDeleteFailedFilelogs.Convert.DeleteTempFileis left alone, since a temp file is not user content.Tests
MkvFile_LogsOperationAndSidecarDeleteasserts the media Warning names the failed operation, and the sidecar delete line.ToolError_LogsKeepReasonasserts the keep line and that the file stays.SidecarDeleteThrows_LogsFailedDeleteandNonMkvDeleteThrows_LogsFailedDeleteAndPropagatesuse a directory in place of a file to fail the delete. The second asserts the Error and the rethrow.DeleteEmptyFolders_LogsEachFolderasserts one line per removed folder, innermost first.DeleteFailedFile()callers passnameof(ProcessFile.VerifyAndRepair).Local Review
Three recorded
local-strict-reviewpasses ran. The first raised threeintroducedfindings: docs promising a keep line for read-only and exception cases, the delete shape repeated per site instead of one helper, and an untested rethrow path. The second raised one: the converted-input reason carried the output path unquoted. Each is fixed on this branch.🤖 Generated with Claude Code