derive_series_status trusts callers to pass every season #131

Closed
opened 2026-08-23 16:41:23 +01:00 by naps62-yolo · 0 comments
Owner

derive_series_status(series, seasons, episodes, now) decides which episodes
are specials by looking them up in the seasons slice it is handed. A caller
that passes an incomplete or empty slice silently gets the old behaviour —
specials count again, and the series pins at incomplete. #118's own test
asserts this: "without knowing the seasons, the special pins the series".

#118 asked for the opposite — "extend the input so the function decides rather
than trusting every caller to filter first. A caller that forgets is the failure
this is meant to prevent." Passing two parallel slices still lets a caller get
it wrong; the only current caller (arr-api's tv_by_series) happens to be
correct, and #121 and #129 both add new callers.

Make it unrepresentable rather than documented. Options, cheapest first:

  • Give Episode the season number alongside season_id, so the function needs
    no second slice at all.
  • Take a single grouped input — seasons each owning their episodes — so a
    caller cannot supply episodes whose season is absent.

arr-api's with_status carries the same shape for its episode counters and
should follow whichever is chosen.

`derive_series_status(series, seasons, episodes, now)` decides which episodes are specials by looking them up in the `seasons` slice it is handed. A caller that passes an incomplete or empty slice silently gets the old behaviour — specials count again, and the series pins at `incomplete`. #118's own test asserts this: `"without knowing the seasons, the special pins the series"`. #118 asked for the opposite — "extend the input so the function decides rather than trusting every caller to filter first. A caller that forgets is the failure this is meant to prevent." Passing two parallel slices still lets a caller get it wrong; the only current caller (`arr-api`'s `tv_by_series`) happens to be correct, and #121 and #129 both add new callers. Make it unrepresentable rather than documented. Options, cheapest first: - Give `Episode` the season number alongside `season_id`, so the function needs no second slice at all. - Take a single grouped input — seasons each owning their episodes — so a caller cannot supply episodes whose season is absent. `arr-api`'s `with_status` carries the same shape for its episode counters and should follow whichever is chosen.
naps62-yolo added this to the TV tracking milestone 2026-08-23 16:41:23 +01:00
naps62-yolo added the area/corephase/6-tvdifficulty/moderatetype/bug labels 2026-08-23 16:41:23 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: yolo/arr#131