library: denormalize the PDF parse lifecycle onto documents; surface it with retry

↗ view on GitHub · Eli Ziff · 2026-07-30 · a0baf300

P0.8 remainder, local lane. localDocumentResponse hardcoded status:
"ready" for every document, so the Library could not tell a parsing,
degraded, or failed structural parse from a clean one without a
per-document round trip.

Backend: new peekLocalPdfParseState reads the durable job's state file
only - no artifact validation, no diagnostics load, no writes - so a
listing of N documents costs N stat-reads. localDocumentResponse
becomes async and carries parse_state (status, error, attempts,
timestamps, engine_status, cache_hit, page_count, diagnostic_count,
structural_repair_available) for PDF versions; null means no parse lane
(non-PDF / flat text). `status` keeps its storage-readiness meaning -
the parse lifecycle is a separate field, and flat text remains
available in every parse state.

Frontend: Document.parse_state typed; DocTable renders a lifecycle chip
beside the filename (spinner while queued/parsing, amber Degraded with
diagnostic count in the title, red Parse failed with the error in the
title and a Retry action). Retry posts the existing
actions/retry-pdf-parse route via the new retryLibraryPdfParse API and
refreshes the collection; clean ready parses and non-PDF rows render no
chip. LibraryWorkspace wires retryPdfParse per library kind.

Deliberately deferred, per the plan's own ordering ("cloud lane last"):
the cloud/Supabase lane still reports storage status only - its
documents carry no parse_state and the chip stays absent there.

Suites: localDocumentStore, localLibraryPdfParse, localPdfIngestion
(33), DocTable interaction/removal + LibraryWorkspace + FileDirectory
(29, incl. 3 new chip/retry tests); tsc clean both ends. types.ts
staged hunk-selectively - the unrelated in-flight assistant-event hunk
stays uncommitted.

Integration plan item 5 (task #28), local lane.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012AgUm5EcRKbT3duVFMbrQD
Repository eliziff/Beaver
Author Eli Ziff <eliasziff@gmail.com>
Authored
Parents f96adec0
Stats 9 files changed , +237 , -11
Part of PDF pinpoint evidence and parse-lifecycle hardening

Capture this commit into my fork

Download a Markdown prompt that tells Claude how to port this exact commit into your working tree. Run it via claude -p < capture-commit-a0baf300.md from inside the repo you want the change in.

⬇ Download capture-commit-a0baf300.md