Repository navigation
Report Unrepaired Metadata and Stop Repeating Cleanup Edits - #1128
Conversation
RepairMetadataErrors() reports errors left by a disabled repair and continues, and a track flag set that does not stick is not retried. RemoveCoverArt() removes cover art only MediaInfo reports, re-checks every source, and warns once when it remains. DeleteFailedFile() keeps the media delete when only the sidecar delete fails. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Cover art a removal already gave up on continues the file even with ReMux off, rather than failing it on every later run. 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 1 minute. 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 QodoReport unrepaired metadata and prevent repeated cleanup edits
AI Description
Diagram
High-Level Assessment
Files changed (3)
|
Code Review by Qodo
1. Remux needs disappear behind flag repairs
|
There was a problem hiding this comment.
🔵 Needs a closer look
Defer because cleanup paths involving MkvPropEdit, MkvMerge, MediaInfo, sidecar replacement, and FFprobe have only fake-tool unit-test coverage, leaving real-media and external-tool integration behavior unverified.
No open issues 🎉
What changed in this PR
This pull request improves cleanup processing by reporting unrepaired metadata, preventing repeated non-converging edits, handling MediaInfo-only cover art, and preserving deletion state when sidecar cleanup fails.
Changes:
- Reports metadata left behind when repair options are disabled without incorrectly failing the file.
- Tracks persistent flag and cover-art repair failures to avoid repeating edits across cleanup passes and later runs.
- Separates media and sidecar deletion handling and expands regression coverage.
- Minor follow-up: add coverage for FfProbe-only cover art after tag removal.
| File | Description |
|---|---|
PlexCleanerTests/DeleteFailedFileTests.cs |
Verifies that media deletion succeeds and records FileDeleted when sidecar deletion fails. |
PlexCleanerTests/CleanupStepRepeatTests.cs |
Tests repeated flag and cover-art cleanup behavior across passes and subsequent runs. |
PlexCleaner/ProcessFile.cs |
Implements metadata reporting, non-repeating cleanup state, MediaInfo cover-art handling, and independent sidecar deletion. |
This pull request is ready to be approved.
Review effort: Lite
A successful flag set leaves SetFlags unset, so a rewrite that later drops a flag is not read as a flag that did not stick. The remux error predicate is shared by the remux trigger, its re-check, and the report. A skipped repeat logs at Information. Tests cover the report per option and the cleanup re-run setting flags a rewrite dropped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…1116-cleanup-steps
|
A recorded local strict-review pass covers head |
|
Answers to the Qodo review findings:
Deferred to #1127, filed with the
Declined, because the title has no capitalized conjunction. It reads
Fixed in 21322b9. |
SetFlags is set on every flag set again, per the maintainer decision on #1074. A later run that finds SetFlags with flag errors left skips the repeat and logs at Information. The narrow window where a rewrite drops the flags and the run ends before the cleanup re-run is accepted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
A recorded local strict-review pass covers head |
A correction to my earlier answer, which said this was fixed in 21322b9. 7121ecd reverts that change by maintainer decision. That decision is recorded on #1074 (2026-10-31): The window is narrow. Within a run, every FfMpeg or HandBrake rewrite happens after the first |
Summary
Three cleanup-step fixes in
ProcessFile, fixed together because they share the cleanup re-run afterVerifyAndRepair().RepairMetadataErrors()used to pass silently when the repair a leftover error needs was turned off. It now reports what is left and continues, and the file is not failed:ReMuxoff: a warning naming the remainingRemove,ReMuxandSetLanguageerrors.SetIetfLanguageTagsoff: logged at Information, since that opt-out is deliberate.SetTrackFlagsoff: a warning.RepairMetadataFlags()re-checks after setting flags. When they did not stick, it warns once and does not set them again, on this run or a later one.SetFlagskeeps its meaning, "flags were set", per the maintainer decision on Fail or Report RepairMetadataErrors When Errors Remain After Repair #1074. A later run readsSetFlagswith flag errors still present as flags that did not stick. The cleanup re-run relies on what this run saw instead, so flags that a FfMpeg or HandBrake rewrite drops are still set again. A skipped repeat logs at Information.RemoveCoverArtMediaInfo()first removes attachments in place with MkvPropEdit. If MediaInfo still reports cover art, it remuxes with MkvMerge only (Convert.ReMux(), whose default input options include--no-attachments). It never uses the FfMpeg fallback, which maps everything.RemoveCoverArt()then re-checks every source, which also covers the FfProbe path afterRemoveTags(). When cover art remains, it warns once and setsRemovedCoverArt, so later runs do not remove it again. MkvMerge-reported cover art is still removed by track as before. The first call in a run infers what is left fromRemovedCoverArt, the same way the flags fix does. So a file that an earlier version markedRemovedCoverArtand that still shows cover art only in FfProbe or MediaInfo is not retried.DeleteFailedFile()(Set FileDeleted When Only the Sidecar Delete Fails in DeleteFailedFile #1116). The media delete and the sidecar delete have separatetryblocks.FileDeletedis set once the media file is gone, and a sidecar delete failure is logged on its own. So the deleted media path is no longer added toFileIgnoreList.Tests
PlexCleanerTests/CleanupStepRepeatTests.csuses fake tools that log every edit:ReMuxandSetTrackFlagsoff, the step continues without editing and withoutVerifyFailed.DeleteFailedFileTests.SidecarDeleteThrows_ReturnsFalsebecomesSidecarDeleteThrows_ReturnsTrueAndSetsFileDeleted, to match the new contract.dotnet format style --verify-no-changes.Deferred
HISTORY.mdand theARCHITECTURE.md"Suspect Branches" prose (S7, S10) are deferred by the maintainer to one final docs pull request.ArchitectureDiagramTestspasses without a diagram edit, since every method named in the diagrams still exists and the step order is unchanged.Closes on promotion: #1074, #1077, #1116
Local Review
local-strict-reviewpasses ran over the full diff at each pushed head. The review of the first head led to these changes:ReMux-off error, so turningReMuxoff later does not fail the file on every run.GetRemuxErrors()helper feeds the remux trigger, its re-check, and the report.Declined, each on evidence:
UseSidecarFilesoff no state persists, so the MediaInfo-only remux and the warnings repeat every run. Interlace and caption scans repeat the same way, sinceScannedInterlaceandScannedCaptionspersist only in the sidecar.--no-attachmentsoptions, the same remuxRemoveCoverArtMediaInfo()runs. So a retry of MediaInfo-only cover art left behind that way fails the same way. Old sidecars hold for the same reason.SetFlags, then a rewrite drops them, and the run ends before the cleanup re-run. Later runs then read that as flags that did not stick, and log the skip at Information. The maintainer accepted this window on Fail or Report RepairMetadataErrors When Errors Remain After Repair #1074, matching theRemovedCoverArtdecision on Remove Cover Art That Only MediaInfo Reports, and Re-Check the FfProbe Path #1077.FakeTools.WriteSampleToolData()with a calls log added, andFakeTools.csis outside this change's files. The test log-capture sink is a third copy of one that lives in other test files, filed as Share One Log Capture Helper Across Test Classes #1129.Doc drift, deferred to the final docs pull request:
ARCHITECTURE.md"Process Command Logic": theRemoveCoverArt()diagram (theReMuxfail edge, D7 and D9 with their S10 notes, and no MediaInfo branch).RepairMetadataErrors()diagram (F1 and F2 with the S7 note, and no report step).Pre-existing findings, filed
PlexCleaner/TrackProps.cssingleStateper track: a track needing both a remux and flags reports only the flags while both options are off. Correctness, filed as Report Every Repair a Track Needs When Its State Holds One #1127.PlexCleanerTestslog-capture sink copies: design, one shared helper, filed as Share One Log Capture Helper Across Test Classes #1129.Dropped findings
PlexCleaner/ProcessFile.csDeleteFailedFile(): a second Error line afterLogAndHandle. Style, kept because it names the sidecar path.🤖 Generated with Claude Code