A PDF never reports "no pages": index the second route, and name the gap honestly

↗ view on GitHub · Eli Ziff · 2026-07-31 · b9143a48

Eli caught this on the test fixture: "no pages" on a PDF is a false statement
about the document.

Two things were wrong.

FALL-THROUGH. Both PDF routes end at the same engine. The ingested route
yields page BLOCKS via readLocalPdfSourceDoc; the un-ingested route runs
`legalpdf parse` and renders `[page N]` markers into the text it returns. The
map builder took the artifact when `parsed` existed and never tried the
markers, so a rendition that carried text but no page blocks was indexed as
pageless even though its own text was full of page markers. It now falls
through artifact -> markers.

VOCABULARY. "This document carries no page structure" conflated two states
that call for opposite responses. A DOCX genuinely has no fixed pagination
until something renders it. A PDF has pages whether or not we managed to read
them, so the same message there reports a gap in our pipeline as a fact about
the document -- exactly the class of error the refusal contract exists to
prevent. PageMap.source gains `unavailable`, set only where the file type is
known, and the two refusals now say different things: one tells you the
document is not paginated, the other tells you the index could not be built
and that page numbers appearing in the text are unverified.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H9ToHYJVDxfeJcJwdzrP2H
Repository eliziff/Beaver
Author Eli Ziff <eliasziff@gmail.com>
Authored
Parents e4ede555
Stats 3 files changed , +32 , -7
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-b9143a48.md from inside the repo you want the change in.

⬇ Download capture-commit-b9143a48.md