Skip to content

Show blocked releases and let administrators unblock and resume interrupted transfers - #113

Open
selbereth wants to merge 1 commit into
logabell:mainfrom
selbereth:feat/unblock-resume-upstream
Open

selbereth wants to merge 1 commit into
logabell:mainfrom
selbereth:feat/unblock-resume-upstream

Conversation

@selbereth

@selbereth selbereth commented Nov 19, 2026 •

Copy link
Copy Markdown

Problem

A release is blocklisted when a transfer is judged failed, but:

  1. Nothing on the Sources page says a result is blocked. It silently stops qualifying, and a retry ends with "No matching download found" and no explanation.
  2. A block can only be removed from Settings -> Download clients -> Download recovery -> Release blocklist (a collapsed section).
  3. Removing a block does not continue anything. The transfer, its files and its hash claim are still on the downloader, so re-selecting the release is refused ("This transfer is already recorded; its existing files need reconciliation").

In my case the block was a false positive (see #110 and the layout change below), so a complete download was stuck until I imported it by hand.

What this does

  • Sources page and release details: a blocked result shows Blocked: <reason> (found automatically|reported <date>), its Download button is disabled with a reason, and administrators get Unblock (same as the Settings button) and, when an interrupted transfer is still on the downloader, Unblock and resume. Members see the reason but no buttons.
  • POST /api/acquisition/recovery/blocklist/{block_id}/resume (admin): removes the block and, for a held attempt whose recovery gave up (DownloadRecovery.state == "held", selection cancelled), reverses the recovery bookkeeping in one transaction: re-commits the selection and reservation, deletes the recovery row, re-runs evaluate, and queues a check of the existing attempt. It never adds a torrent and the old hash claim keeps ownership. The existing DELETE endpoint is unchanged in behaviour.
    Refused (the block is still removed and the transfer is left exactly as it was): a replacement search or download already followed the failure, a person reported the problem, another active block covers the release, the request is withdrawn/paused/already satisfied (the whole reversal rolls back), or the attempt is no longer held.
  • GET search results gain block (id, reason, automatic, blocked_at, can_resume), computed with one query per page (release_blocklist.blocks_for).
  • Layout tolerance (layout_wrapper() in domain/download_attempts.py): a single extra leading folder that the client added around the torrent's own paths (qBittorrent's "Subfolder" content layout wraps every single-file torrent) is no longer a mismatch with the inspected torrent. Same files, same sizes, exactly one added folder. The inspection path includes the wrapper. Renames, extra or missing files, different sizes, mixed prefixes and ./../backslash wrappers are still mismatches. This is what caused the false "Completed files differ from the inspected torrent" hold in [UX] From Quick add to library: six dead ends with misleading or missing guidance (language 'und', .DS_Store, disk reserve, unverified route) #110.

Tests

  • tests/unit/test_download_layout.py: wrapper detection (including every rejection case), transfer_stage with wrapped, truncated, renamed, extra-file and wrong-total transfers, inspection paths.
  • tests/integration/test_download_resume.py (PostgreSQL): resume of the same attempt through a wrapped layout to complete with an inspection and no second submit; second resume is a no-op; plain removal leaves the failed transfer alone; recoveries in queued/searching/selecting/retried/complete are not touched; a reported problem is never resumed; a second covering block keeps the release blocked; a withdrawn request rolls the whole resume back; non-held attempts are not candidates; 404 for unknown blocks; members get 403; the Sources view lists the block on exactly the blocked release (and not for another format or after removal).
  • apps/web/tests/ui/release-blocklist.spec.ts: blocked row with reason and disabled Download, plain Unblock, Unblock and resume with outcome, refused resume message, member view.
  • Full CI on my fork for this exact branch passes (backend checks, all 4 PostgreSQL integration shards, mocked and live browser journeys, both image builds): https://github.com/selbereth/dewarr/actions/runs/44445521205. One live browser test (reading-accounts.spec.ts, Goodreads onboarding, a click timeout in code this PR does not touch) failed on the first attempt and passed on a re-run of that job.
  • docs/openapi.json and apps/web/src/api/schema.d.ts regenerated.

Not included / notes

Refs #110

🤖 Generated with Claude Code

…rupted transfers

A release is blocklisted when a transfer is judged failed, but nothing on the
Sources page said so, a block could only be removed from Settings, and removing
it could not continue the transfer that was already on the downloader.

- Sources page (and release details): a blocked release shows why it is blocked,
  cannot be downloaded, and administrators can Unblock it, or Unblock and resume
  when an interrupted transfer is still on the downloader.
- POST /api/acquisition/recovery/blocklist/{id}/resume removes the block and, for a
  held attempt whose recovery gave up, reverses the recovery bookkeeping so the
  existing attempt observes the existing transfer again. It never adds a torrent.
  A replacement already in flight or finished, a problem reported by a person,
  another covering block, or a withdrawn/satisfied request refuse the resume
  (the block is still removed and the transfer is untouched).
- A single extra leading folder added by the client (qBittorrent "Subfolder"
  content layout) is no longer a mismatch with the inspected torrent, and the
  inspection path includes it. This was the false "Completed files differ from
  the inspected torrent" hold that blocklisted a complete download.

Refs logabell#110

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant