Report the latest failed suggestion batch on the deck
CI / ci (push) Successful in 3m3s
CI / ci (pull_request) Successful in 2m45s

The deck reported only a pending or running batch, so a Discover page
opened after a batch failed (or was interrupted by a restart) had no job
to follow and showed "All caught up" or the remaining cards with no
error. GET /api/v1/suggestions/deck now also returns failed_batch: the
newest batch when it failed, read in the same snapshot after orphaned
batches are failed, so at most one of active_batch and failed_batch is
set and a later batch supersedes the failure. The page follows the
failed batch's job like the active one, so its failure shows with the
existing Retry, which asks for a new batch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-07 05:29:10 -04:00
co-authored by Claude Opus 5.5
parent 6d36a7a10c
commit b611d1bbce
11 changed files with 213 additions and 44 deletions
+7 -4
View File
@@ -311,10 +311,13 @@ automatic** (D-021).
`GET /api/v1/suggestions/deck` returns `{suggestions: [{id, dinner_id,
name, photo_url, difficulty, method, minutes_total, cuisine, reason,
cited_regular_ids, status, dinner_status, decided_at, created_at}],
active_batch}`: the `pending` suggestions whose dinner is still
`suggested`, oldest first, and the batch `pending` or `running`
(`{batch_id, job_id, trigger, status}`, or null), read in one snapshot,
so a client that did not start the batch can follow its job. `POST /api/v1/suggestions/{id}/accept` (Try it) sets the
active_batch, failed_batch}`: the `pending` suggestions whose dinner is
still `suggested`, oldest first; the batch `pending` or `running`
(`{batch_id, job_id, trigger, status}`, or null); and the newest batch
when it `failed` (same shape, or null; a later batch, done or under
way, supersedes the failure), read in one snapshot, so a client that
did not start the batch can follow its job and learns of a failure it
was not following. At most one of the two is set. `POST /api/v1/suggestions/{id}/accept` (Try it) sets the
suggestion `accepted` and moves its dinner to `quest_log`; `POST
/api/v1/suggestions/{id}/decline` (Pass) sets it `declined` and archives
the dinner; every later batch, and the household context's passed list,