fix(subs): retry a capped language next day
ci / web (push) Successful in 1m49s
e2e / e2e (push) Failing after 2m58s
ci / rust (push) Successful in 3m1s
ci / image (push) Successful in 3m47s

A `capped` row was excluded from the work list outright, and nothing
ever moved it back, so a language that hit a daily allowance was never
attempted again. §15 says budgets drain a backlog over days, which only
holds if the cap expires.

`pending` now returns a capped row once the UTC day it was capped in has
passed — the same boundary `subtitle_budget_spend.day` uses. The day
rule is in the query rather than the caller because `limit` is a window
over the whole list: a hundred newest files capped this morning would
otherwise hold every slot and hide the older gaps until tomorrow.

Capping no longer bumps `attempts`. That counter is the failure ladder,
and a budget that refused to spend never asked a provider.

Two reporting fixes alongside, both found chasing the same bug:

- The subtitle queue dropped `last_failure` on a capped row, so all four
  limits that write `capped` rendered identically. The sentence is the
  only thing that tells a provider budget from a 429.
- A translation engine with no API key reported itself as "not compiled
  into this binary", sending the operator to rebuild an image that was
  already correct.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Miguel Palhas
2026-09-20 18:43:08 +01:00
co-authored by Claude
parent dab3c06dd7
commit 70ba6ac376
7 changed files with 255 additions and 66 deletions
+5 -2
View File
@@ -141,13 +141,16 @@ const REASON_LABELS: Record<string, string> = {
sync_rejected: "sync flagged",
};
/** How long a `failed` detail rides in the chip text before it is title-only. */
/** How long a detail rides in the chip text before it is title-only. */
const DETAIL_CHARS = 60;
/** The reasons that carry a sentence worth putting on the chip. */
const DETAILED_REASONS = new Set(["failed", "capped"]);
/** A missing language's chip label: language and why, in §201's own words. */
export function missingChipLabel(missing: MissingSubtitle): string {
const reason = REASON_LABELS[missing.reason] ?? missing.reason;
if (missing.reason !== "failed" || missing.detail === null) {
if (!DETAILED_REASONS.has(missing.reason) || missing.detail === null) {
return `${missing.language} · ${reason}`;
}
const detail =