Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Torznab Download Redirect and Acquisition Attempt Coverage

  • Status: Accepted
  • Date: 2026-02-25
  • Context:
    • torznab_download_prepare already implemented ERD-compliant redirect selection and acquisition-attempt writes, but coverage only validated missing-instance failures.
    • ERD acceptance requires successful redirect behavior (magnet preferred over download_url) and guaranteed acquisition attempt persistence, including explicit no-target failures.
  • Decision:
    • Added stored-procedure integration coverage in crates/revaer-data/src/indexers/torznab.rs to validate:
      • magnet URI is preferred when both magnet_uri and download_url exist.
      • download_url is used when magnet is absent.
      • missing redirect target returns NULL and writes a failed acquisition attempt with failure_class=client_error and failure_detail=no_download_target.
    • Test fixtures create Torznab scope and canonical sources through existing stored-procedure wrappers (search_profile_create, torznab_instance_create, search_request_create, search_result_ingest) with minimal setup SQL limited to required indexer test rows.
    • Dependency rationale: no new dependencies were added.
    • Alternatives considered:
      • API-only E2E validation for successful redirects: rejected for this increment because the existing E2E fixture layer does not expose deterministic source seeding for positive redirect paths.
      • Leave coverage at handler-level negative paths only: rejected because it would not prove acquisition-attempt semantics required by ERD.
  • Consequences:
    • Positive outcomes:
      • Redirect precedence and acquisition-attempt side effects are now explicitly asserted in automated tests.
      • ERD download acceptance behavior is now validated at the stored-procedure boundary used by runtime paths.
    • Risks or trade-offs:
      • Positive redirect behavior is currently validated at the data/procedure layer, not yet end-to-end via Torznab HTTP in Playwright.
  • Follow-up:
    • Add API E2E positive redirect coverage once deterministic source seeding is available through test helpers or dedicated setup endpoints.