Clear subtitle attempts when a language is dropped #224

Closed
opened 2026-08-25 04:55:03 +01:00 by naps62-yolo · 1 comment
Owner

Narrowing wanted_languages in /settings leaves the subtitle_attempts
rows for the dropped language behind. Nothing deletes them, and nothing marks
them irrelevant.

Today the consequences are hidden because both readers bound their output by
the current wanted set — #201's missing_for on title detail and #202's
queue both filter dropped languages out. The rows are still there, so:

  • Re-adding a language later resurrects its old attempt history, including its
    backoff counter and last_failure, as though the attempts had just happened.
    A language dropped a month ago and re-added comes back already backed off.
  • The table grows without bound as the wanted set is edited.

Clear the attempt rows for a language when it leaves wanted_languages, in
the settings-update handler that already writes the row. Subtitle files for
that language must stay — they are on disk and §15's no-upgrade rule still
applies to them; it is only the attempt bookkeeping that should go.

Found while implementing #202.

Depends on: #186, #198, #202

Narrowing `wanted_languages` in `/settings` leaves the `subtitle_attempts` rows for the dropped language behind. Nothing deletes them, and nothing marks them irrelevant. Today the consequences are hidden because both readers bound their output by the current wanted set — #201's `missing_for` on title detail and #202's queue both filter dropped languages out. The rows are still there, so: - Re-adding a language later resurrects its old attempt history, including its backoff counter and `last_failure`, as though the attempts had just happened. A language dropped a month ago and re-added comes back already backed off. - The table grows without bound as the wanted set is edited. Clear the attempt rows for a language when it leaves `wanted_languages`, in the settings-update handler that already writes the row. Subtitle *files* for that language must stay — they are on disk and §15's no-upgrade rule still applies to them; it is only the attempt bookkeeping that should go. Found while implementing #202. Depends on: #186, #198, #202
naps62-yolo added this to the Subtitles milestone 2026-08-25 04:55:03 +01:00
naps62-yolo added the difficulty/easyarea/apiphase/9-subtitlestype/bug labels 2026-08-25 04:55:04 +01:00
Author
Owner

Implemented as scoped. PUT /api/settings/subtitles now diffs the previous
wanted_languages against the new payload before writing the row, and — in
the same transaction as the settings update — deletes every subtitle_attempts
row whose language left the wanted set. Subtitle files themselves are
untouched; only the attempt bookkeeping (backoff counter, last_failure,
state) is cleared, so re-adding a language later starts its attempts fresh
instead of resurrecting a stale backoff. Added a test seeding attempts for a
kept and a dropped language and asserting only the kept one survives the PUT.

Branch: subtitles/224-clear-attempts

just ci passed (fmt, clippy, cargo nextest — 686 passed, web check).

Findings

None outside this issue's scope.

Implemented as scoped. `PUT /api/settings/subtitles` now diffs the previous `wanted_languages` against the new payload before writing the row, and — in the same transaction as the settings update — deletes every `subtitle_attempts` row whose language left the wanted set. Subtitle files themselves are untouched; only the attempt bookkeeping (backoff counter, `last_failure`, state) is cleared, so re-adding a language later starts its attempts fresh instead of resurrecting a stale backoff. Added a test seeding attempts for a kept and a dropped language and asserting only the kept one survives the PUT. Branch: `subtitles/224-clear-attempts` `just ci` passed (fmt, clippy, cargo nextest — 686 passed, web check). ## Findings None outside this issue's scope.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: yolo/arr#224