Seed a series without tracking its back catalogue #160

Closed
opened 2026-08-24 11:23:46 +01:00 by naps62-yolo · 0 comments
Owner

Adding a series with auto_track on tracks every season it already has.
apply_auto_track is correct in isolation — it only touches seasons flagged
is_new — but the first metadata refresh of a newly added series flags all of
them, because the library has never seen any of them before.

Observed on the deployed build: Rick and Morty was added and came back with
S01–S09 tracked and 91 episodes wanted, and the daemon began grabbing the back
catalogue.

What to change

Per the amended §4.1: seasons revealed by a series' first refresh are never
tracked by auto_track. The rule applies from the second refresh onward.

series.metadata_refreshed_at (migration 0018_series_metadata_refresh)
already distinguishes the two — it is NULL until a refresh has stamped it. Pass
that fact into the decision rather than re-deriving it from row counts, which
would misclassify a series whose seasons had all been removed.

The decision belongs in arr-core::tracking alongside the rest of the rule.
arr-core has no IO and must not gain any: the caller supplies the fact, the
core decides.

Both callers need it:

  • crates/arr-daemon/src/series_refresh.rs — the daily refresh, the path that
    produced the bug.
  • crates/arr-api/src/series.rs — the add-a-season endpoint, which runs the
    same rule through the same function.

Done looks like

  • A series added with auto_track: true has no tracked seasons and no wanted
    episodes until a season appears that did not exist when it was added.
  • A season appearing on a later refresh of that same series is tracked, and its
    episodes arrive wanted.
  • Season 0 stays excluded on every path, as it is now.
  • Tests cover both: the seeding refresh tracking nothing, and the next refresh
    tracking a genuinely new season.

Non-goals

  • Do not change what Season.tracked does once set. Turning it on marks
    revealed episodes wanted; turning it off withdraws nothing (§4.1). That rule
    is unchanged.
  • Do not correct the existing Rick and Morty rows from code. That is a one-off
    operator action, not a migration.
  • No new column — metadata_refreshed_at is enough.

Depends on: #159

Adding a series with `auto_track` on tracks every season it already has. `apply_auto_track` is correct in isolation — it only touches seasons flagged `is_new` — but the first metadata refresh of a newly added series flags all of them, because the library has never seen any of them before. Observed on the deployed build: Rick and Morty was added and came back with S01–S09 tracked and 91 episodes wanted, and the daemon began grabbing the back catalogue. ## What to change Per the amended §4.1: seasons revealed by a series' *first* refresh are never tracked by `auto_track`. The rule applies from the second refresh onward. `series.metadata_refreshed_at` (migration `0018_series_metadata_refresh`) already distinguishes the two — it is NULL until a refresh has stamped it. Pass that fact into the decision rather than re-deriving it from row counts, which would misclassify a series whose seasons had all been removed. The decision belongs in `arr-core::tracking` alongside the rest of the rule. `arr-core` has no IO and must not gain any: the caller supplies the fact, the core decides. Both callers need it: - `crates/arr-daemon/src/series_refresh.rs` — the daily refresh, the path that produced the bug. - `crates/arr-api/src/series.rs` — the add-a-season endpoint, which runs the same rule through the same function. ## Done looks like - A series added with `auto_track: true` has no tracked seasons and no wanted episodes until a season appears that did not exist when it was added. - A season appearing on a later refresh of that same series is tracked, and its episodes arrive wanted. - Season 0 stays excluded on every path, as it is now. - Tests cover both: the seeding refresh tracking nothing, and the next refresh tracking a genuinely new season. ## Non-goals - Do not change what `Season.tracked` does once set. Turning it on marks revealed episodes wanted; turning it off withdraws nothing (§4.1). That rule is unchanged. - Do not correct the existing Rick and Morty rows from code. That is a one-off operator action, not a migration. - No new column — `metadata_refreshed_at` is enough. --- Depends on: #159
naps62-yolo added this to the Feedback pass milestone 2026-08-24 11:23:46 +01:00
naps62-yolo added the area/coredifficulty/hardtype/bugphase/6-tv labels 2026-08-24 11:23:46 +01:00
naps62-yolo added a new dependency 2026-08-24 11:23:53 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: yolo/arr#160