Skip to content

NZB season-pack coalescing should be version-aware #485

Description

@aiknight-labs

Summary

The in-flight NZB season-pack coalescing lookup in queues/scraping_queue.py matches a sibling by show, season, state, and nzb: job ID, but it does not include the requested version. This can allow an episode requesting one version to inherit a sibling season-pack job for a different version.

Reproduction

  1. Enable granular versions such as 1080p and 2160p.
  2. Have one episode in a season already bound to an in-flight NZB season-pack job with version 1080p or 1080p*.
  3. Process another episode from the same show and season with requested version 2160p.
  4. The sibling lookup can select the 1080p row and reuse its NZB job for the 2160p request because the query matches only IMDb ID and season.

Expected behavior

Season-pack reuse should require the normalized requested version to match the normalized sibling version. A decorated value such as 1080p* should remain compatible with 1080p, but 1080p should never satisfy 2160p.

Suggested fix

Normalize the current item version by removing *, then include equivalent normalization in the sibling query:

AND REPLACE(COALESCE(version, ''), '*', '') = ?

This follows the normalized-version comparisons already used elsewhere in the queue/database code.

Regression criteria

  • An in-flight 1080p* season-pack job may be reused by a 1080p episode.
  • An in-flight 1080p job must not be reused by a 2160p episode.
  • Existing same-version season-pack coalescing behavior remains unchanged.

A focused local SQLite regression test confirmed the mismatch before the filter and the expected separation after adding normalized version equality. The change is isolated to the sibling NZB coalescing lookup.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions