Turning a season's tracking off clears its episodes' wanted #171

Closed
opened 2026-08-24 16:12:28 +01:00 by naps62-yolo · 0 comments
Owner

Implements the §4.1 reversal from #169: turning a season's tracking off clears
wanted on every episode of that season.

Depends on: #169

PATCH /api/series/{series_id}/seasons/{number} with {"tracked": false} must
clear wanted on that season's episodes, in the same transaction as the flag
write. The tracked: true direction keeps its current behaviour unchanged.

The clear must be idempotent, and must run even when the season is already
untracked.
This is the part that matters and the easy part to miss. Production
already holds seasons whose tracked is false while their episodes are all still
wanted — that is the state the old ruling made reachable and gave no way out of.
If the handler short-circuits on "the flag already has this value, nothing to do",
those rows stay stranded forever and the issue is not fixed. Sending
{"tracked": false} to an already-untracked season is the operator's way to clear
it, so it has to do the work.

Season 0 is included. It is skipped by the auto-track rules, but an operator
untracking it means the same thing there as anywhere else.

Deliberately not doing: a migration that clears wanted on every untracked season.
§4.1 explicitly supports marking individual episodes wanted on a season that was
never tracked, and a blanket sweep would destroy exactly that intent. Existing
rows are cleared by the operator acting on them, one season at a time.

Where the logic goes: the decision belongs in arr-core next to the other §4.1
rules in tracking.rs if it can be expressed without IO, with arr-api supplying
the rows and persisting the result. arr-core must not gain a sqlx dependency.

Tests: an already-untracked season with wanted episodes gets them cleared; a
tracked season being turned off gets them cleared; turning tracking on is
unaffected; a season with no episodes is a no-op rather than an error. Regenerate
and commit .sqlx/ if the queries change.

Implements the §4.1 reversal from #169: turning a season's tracking off clears `wanted` on every episode of that season. Depends on: #169 `PATCH /api/series/{series_id}/seasons/{number}` with `{"tracked": false}` must clear `wanted` on that season's episodes, in the same transaction as the flag write. The `tracked: true` direction keeps its current behaviour unchanged. **The clear must be idempotent, and must run even when the season is already untracked.** This is the part that matters and the easy part to miss. Production already holds seasons whose `tracked` is false while their episodes are all still wanted — that is the state the old ruling made reachable and gave no way out of. If the handler short-circuits on "the flag already has this value, nothing to do", those rows stay stranded forever and the issue is not fixed. Sending `{"tracked": false}` to an already-untracked season is the operator's way to clear it, so it has to do the work. Season 0 is included. It is skipped by the auto-track rules, but an operator untracking it means the same thing there as anywhere else. Deliberately not doing: a migration that clears wanted on every untracked season. §4.1 explicitly supports marking individual episodes wanted on a season that was never tracked, and a blanket sweep would destroy exactly that intent. Existing rows are cleared by the operator acting on them, one season at a time. Where the logic goes: the decision belongs in `arr-core` next to the other §4.1 rules in `tracking.rs` if it can be expressed without IO, with `arr-api` supplying the rows and persisting the result. `arr-core` must not gain a sqlx dependency. Tests: an already-untracked season with wanted episodes gets them cleared; a tracked season being turned off gets them cleared; turning tracking on is unaffected; a season with no episodes is a no-op rather than an error. Regenerate and commit `.sqlx/` if the queries change.
naps62-yolo added this to the Removal and navigation milestone 2026-08-24 16:12:28 +01:00
naps62-yolo added the area/apiphase/6-tvdifficulty/moderatetype/feature labels 2026-08-24 16:12:28 +01:00
naps62-yolo added a new dependency 2026-08-24 16:13:22 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: yolo/arr#171