fix(automations): preserve cross-seeds for season pack and episode subpaths - #2308
fix(automations): preserve cross-seeds for season pack and episode subpaths#2308MaKTaiL wants to merge 1 commit into
Conversation
…bpaths Expand detectCrossSeeds and findCrossSeedGroup to recognize parent-child directory containment between season pack directories and episode files. Previously, detectCrossSeeds checked only for exact string equality of ContentPath. When deleting a season pack torrent with preserve-cross-seeds mode, nested episode torrents were missed, causing shared data files to be deleted from disk.
|
An admin can assign one in Ito team settings. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
WalkthroughCross-seed detection now supports exact and safe parent-child content-path matches. Group discovery filters candidates with these rules, includes the target, excludes unrelated paths, and deduplicates torrents by hash. Tests cover season-pack and episode subpath matching in both directions. ChangesCross-seed matching
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Description
Fixes an issue in the automations service where deleting a torrent using
deleteWithFilesPreserveCrossSeeds("Preserve cross-seeds") failed to detect cross-seed relationships between season pack directories and individual episode files.Previously,
detectCrossSeedsandfindCrossSeedGrouponly checked for exact string equality ofContentPath. When evaluating a season pack torrent (e.g./downloads/Show.S01) against an episode file torrent inside it (e.g./downloads/Show.S01/Show.S01E01.mkv),detectCrossSeedsreturnedfalse, causing the automation to fall back toDeleteModeWithFilesand delete the season pack directory and its files from disk.Changes Included:
isPathSubpathhelper to evaluate parent-child directory containment between content paths.isCrossSeedMatchhelper to identify cross-seeds sharing exact paths or non-ambiguous parent-child directory relationships.detectCrossSeedsandfindCrossSeedGroupininternal/services/automations/service.goto support parent-child subpath matching while protecting ambiguous root paths (ContentPath == SavePath).How has this been tested?
internal/services/automations/service_test.gocovering:go test -count=1 ./internal/services/automations/...) pass with 0 errors.go build ./cmd/qui).Checklist
make precommitand the tests pass locallyAI disclosure
Assisted by Antigravity (Gemini 3.6 Flash) for root-cause analysis, subpath cross-seed logic implementation, and unit tests.
Summary by CodeRabbit
Bug Fixes
Tests