Repository navigation
Keep the Seeded State When a Renamed File Has a Sidecar - #1121
Conversation
A rename seeds the new SidecarFile with the in-memory state plus FileReNamed, and the sidecar load replaced it. OR the seeded flags back in after the load settles the state. Co-Authored-By: Claude Sonnet 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 34 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 QodoPreserve seeded state when a renamed file has a sidecar
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
Code Review by Qodo
1. Changed files can bypass verification
|
There was a problem hiding this comment.
🟡 Changes recommended
The new test has two critical Windows-compatibility issues: it runs shell scripts without the required platform skip and performs a case-only rename without the temporary path used by production code.
2 open issues
What changed in this PR
This pull request preserves state seeded during file renames when an existing sidecar is loaded, while retaining FileModified for stale media. It also adds regression coverage for matching and stale sidecars.
Changes:
- Merge caller-seeded state back after sidecar loading and validation.
- Preserve seeded flags when a sidecar hash is stale.
- Add tests for matching and stale sidecar scenarios.
| File | Summary |
|---|---|
PlexCleanerTests/SidecarRenameStateTests.cs |
Adds regression tests. Critical [P1] findings: skip the shell-script case on Windows (2 votes), and use the production temporary-name sequence for the case-only rename (3 votes). |
PlexCleaner/SidecarFile.cs |
Preserves caller-seeded state across existing-sidecar loads and media validation. |
Review effort: Lite
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
A recorded local strict-review pass covers head |
|
Answering Qodo's finding "1. Changed files can bypass verification" (SidecarFile.cs:233), declined with evidence. The merge restores the state the caller seeded, and that is the same state the no-sidecar path already keeps. When no sidecar exists under the new name, |
Declined: the seeded flags are the state the caller carries, and |

Summary
ProcessFile.Refresh(string)seeds a newSidecarFilewith the in-memory state plusFileReNamed. When a sidecar already exists under the new name, the sidecar load replaced that state, soFileReNamedand any flag the step had just set were lost.SidecarFile.Open()now keeps the state it was seeded with on the first open and ORs it back in after the sidecar load settles the state, including the hash-mismatch reset toFileModified. One rule covers both rename paths (MakeExtensionLowercaseandRemuxByExtension), with no per-step branch and no sidecar delete, per the maintainer decision on the issue.Tests
PlexCleanerTests/SidecarRenameStateTests.cscovers both shapes with constructed files:name.MKVover a matchingname.PlexCleaner: seeded flags and the stored flag are both kept.name.PlexCleaner: the stale stored flag is cleared, the seeded flags andFileModifiedare kept.Both fail without the change. The full suite passes.
Deferred
HISTORY.mdlines and theARCHITECTURE.mdSuspect Branches entry removal are deferred to one final docs pull request by the maintainer's choice, so this pull request does not edit them.Closes on promotion: #1082
🤖 Generated with Claude Code