fix(subs): retry a capped language next day
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:
@@ -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 =
|
||||
|
||||
Reference in New Issue
Block a user