Record why a document's index attempt failed and say so

A content-index attempt that failed (raster failure, a scan with no
text layer, a provider error) recorded its reason only in the server's
observability stream. In the vault, hasContentIndex false looked
identical for a document nobody ever tried and one that failed three
times, and the detail sheet had nothing to say about either.

Apply the summaryState pattern to the index. Two additive columns on
InboundDocument (migration 0333) record when the last attempt finished
and why it produced no index, as a closed reason set: local-empty,
local-unsupported, decrypt-error, raster-failed, provider-error,
pdf-needs-anthropic, empty-transcription. The writer sits at the choke
point the auto job and the corpus backfill share, and in the manual
index route; a success clears the reason. The provider path's specific
failure now survives the local fallback, since "no text" is less
actionable than "the PDF would not render". rasterizePdf names its
failure class so a build that cannot rasterize at all is distinguished
from a PDF that would not render. New guard in both index paths: an
empty provider transcription never becomes a successful empty index.

The detail sheet renders the reason in plain words (muted, six
locales). The DTO and OpenAPI carry the two fields; the disaster
recovery backup and restore carry them verbatim like their summary
siblings.

Refs #776
This commit is contained in:
Marc-André Bombeck committed 2026-08-13 12:40:50 +02:00
1 parent 45dc93932a
commit 893db887e9
29 files changed
+786 -33

No files matched your search

+39 -1
View File
@@ -37857,6 +37857,22 @@ components:
- local-pdf
- local-ocr
- type: "null"
lastIndexAttemptAt:
anyOf:
- type: string
- type: "null"
lastIndexOutcome:
anyOf:
- type: string
enum:
- local-empty
- local-unsupported
- decrypt-error
- raster-failed
- provider-error
- pdf-needs-anthropic
- empty-transcription
- type: "null"
hasThumbnail:
type: boolean
createdAt:
@@ -37882,6 +37898,8 @@ components:
- servingClass
- hasContentIndex
- contentIndexSource
- lastIndexAttemptAt
- lastIndexOutcome
- hasThumbnail
- createdAt
- updatedAt
@@ -37893,7 +37911,9 @@ components:
download-only (`attachment`); render/download by it, never by MIME guess. `hasContentIndex` is true when the
document has a content-search index (auto-indexed on upload); `contentIndexSource` says how that index was
produced — `vision` means an AI provider read the original, the other values are provider-free local
extractions, and it is null when `hasContentIndex` is false. `hasThumbnail` is true when a preview thumbnail has
extractions, and it is null when `hasContentIndex` is false. `lastIndexAttemptAt` is when the most recent index
attempt finished (successful or not; null when none ran); `lastIndexOutcome` says why that attempt produced no
index, and is null when the attempt succeeded or none ran. `hasThumbnail` is true when a preview thumbnail has
been rendered in the background (fetch it from `/api/documents/inbound/{id}/thumbnail`); false means no preview
yet or an unsupported type — show a placeholder. Treat an unknown `kind` value as OTHER when decoding.
DocumentConditionLink:
@@ -38205,6 +38225,22 @@ components:
- local-pdf
- local-ocr
- type: "null"
lastIndexAttemptAt:
anyOf:
- type: string
- type: "null"
lastIndexOutcome:
anyOf:
- type: string
enum:
- local-empty
- local-unsupported
- decrypt-error
- raster-failed
- provider-error
- pdf-needs-anthropic
- empty-transcription
- type: "null"
hasThumbnail:
type: boolean
createdAt:
@@ -38250,6 +38286,8 @@ components:
- servingClass
- hasContentIndex
- contentIndexSource
- lastIndexAttemptAt
- lastIndexOutcome
- hasThumbnail
- createdAt
- updatedAt