Never show ideas for a failed ideas job, however it failed
CI / ci (push) Successful in 5m34s
CI / ci (pull_request) Successful in 5m26s

A failed ideas_from_ingredients job could still show ideas through
GET /api/v1/jobs/{id}: a job failed at boot as interrupted by restart
keeps its last partial result, and when the write clearing the ideas
itself failed the runner recorded internal_error over the uncleared
result. Neither path can be fixed by a write.

The jobs package gains an opt-in per-kind hook, Kind.FailedResult,
which Runner.Get applies to a failed job's stored result on every read.
The ideas kind registers withoutIdeas, which empties the ideas and keeps
the rest of the result. Kinds that do not call FailedResult are
unchanged. The write-side clear stays as a tidy-up of what is stored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-08 19:36:04 -04:00
co-authored by Claude Opus 5.5
parent 4146f31275
commit 9ed6c305cb
5 changed files with 273 additions and 58 deletions
+6 -2
View File
@@ -332,8 +332,12 @@ automatic** (D-021).
taking its place before those shown. It fails with `no_ideas_found`
(every idea was dropped), `ai_failed` (the skill or `normalize_recipe`
failed; no idea is made up instead, D-017), `search_not_configured` or
`search_failed`. Before it fails it publishes its result again with no
ideas, so a failed job shows none, even those kept before the failure.
`search_failed`. A failed job shows no ideas, even those kept before the
failure: the kind registers a `FailedResult` view, so `GET
/api/v1/jobs/{id}` empties the `ideas` of any failed job's result on
read, however it failed (including `interrupted by restart` and an
`internal_error` whose clearing write failed). Before it fails it also
publishes its result again with no ideas, to tidy what is stored.
`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}],