fix(queue): respect torrent preservation when removing downloads - #171
Open
EasyAsABC123 wants to merge 1 commit into
Open
EasyAsABC123 wants to merge 1 commit into
EasyAsABC123 wants to merge 1 commit into
Conversation
EasyAsABC123
marked this pull request as ready for review
September 22, 2026 15:16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Queue removal currently deletes a torrent and its files directly, bypassing the existing download preservation policy. A completed download that fails import matching can therefore be deleted when removed and blocklisted through the queue, even when its indexer has Keep seeding permanently (
NeverMoveOnImport) enabled. Automatic cleanup already checks this policy; the queue endpoints do not.Use
IDownloadImportModeResolverto enforce the same policy for individual and bulk queue removal. A protected deletion returns HTTP 400 with instructions to choose Ignore Download or useremoveFromClient=false. Bulk requests check every tracked download before changing any pending releases or client items, preventing partial deletion when a protected item appears later in the selection.Ignoring, blocklisting, and changing category without client deletion remain available. Unprotected downloads retain their existing behavior. The guard also honors the resolver's existing protection for unmanaged torrents on clients configured with
CopyUnmanagedDownloads.Intentional behavior change: explicit queue deletion no longer overrides these opt-in preservation settings. Users who intend to delete a protected torrent and its files can still do so directly in their download client. This does not change client-side ratio/time limits or enable preservation settings by default.
Related: #129 clarifies preservation setting labels/help text; this PR adds enforcement to queue removal and does not depend on that wording change.
Database Migration
NO.
How was this tested?
Native Linux, .NET 10, based directly on current upstream
develop(7a06004).dotnet test src/Chaptarr.Core.Test/Chaptarr.Core.Test.csproj -c Release -p:WarningsNotAsErrors=NU1902Full suite: 3,027 passed, 0 failed; the production-reader fixture is skipped by the test runner.
NU1902is demoted for the existingMicrosoft.Build.Tasks.Git8.0.0 advisory; no dependencies are changed.Seven new regression cases exercise:
Reproduction:
The same guard was also deployed and checked in a live Chaptarr instance: the queue/system APIs remained healthy, preservation settings persisted across restart, and the health endpoint reported no issues. No homelab configuration or deployment artifacts are included here.