Skip to content

fix(render): the PDF manifest's complete flag must mean something too - #152

Merged
ASuresh0524 merged 2 commits into
mainfrom
fix/pdf-manifest-complete
Aug 30, 2026
Merged

fix(render): the PDF manifest's complete flag must mean something too#152
ASuresh0524 merged 2 commits into
mainfrom
fix/pdf-manifest-complete

Conversation

@ASuresh0524

Copy link
Copy Markdown
Collaborator

#141 made complete derived in both URL backends. The PDF backend writes the same key into the same filename and still hardcodes it, so the claim #139 makes about the manifest contract still holds on this path: a consumer cannot tell a whole document from a fragment of one.

render_pdf takes a pages selection. When it is given, only those pages are written — and the manifest still said complete: true, with total_pages reporting the size of the subset, so nothing in the directory distinguished "this three-page document" from "three pages of some longer document".

  • complete is now pages is None: only a whole-document render may claim it. An explicit range counts as a selection even when it happens to cover every page, because the backend has not checked it against the document's length.
  • requested_pages records the selection, so a consumer can see what was asked for instead of being told out of band — the same move as recording tile_height in the URL manifests.

Scope

No in-repo caller passes pages today; it is reachable through the public render_pdf API, which is exported from pixelrag_render and documents the parameter. So this is a public-API contract fix, not a live in-repo failure.

Tests

Three new tests in tests/test_pdf_manifest.py, written against the old backend first and red on all three. The 9 existing render tests, including #141's manifest tests, still pass.

#141 made `complete` derived in both URL backends. The PDF backend writes the
same key into the same filename and still hardcodes it, so the claim #139
makes about the manifest contract still holds on this path: a consumer cannot
tell a whole document from a fragment of one.

render_pdf takes a `pages` selection. When it is given, only those pages are
written — and the manifest still said `complete: true`, with `total_pages`
reporting the size of the subset, so nothing in the directory distinguished
"this three-page document" from "three pages of some longer document".

- `complete` is now `pages is None`: only a whole-document render may claim it.
  An explicit range counts as a selection even when it happens to cover every
  page, because the backend has not checked it against the document's length.
- `requested_pages` records the selection, so a consumer can see what was asked
  for instead of being told out of band — the same move as recording
  `tile_height` in the URL manifests.

No in-repo caller passes `pages` today; it is reachable through the public
render_pdf API, which is exported from pixelrag_render.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Aug 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
web Ready Ready Preview Aug 30, 2026 1:44am

CI runs `uv sync --extra dev`, and pdf2image ships in the optional `pdf`
extra, so the three new tests raised ImportError on the runner rather than
exercising anything. They passed locally only because this machine happens to
have pdf2image and poppler installed.

Guard with importorskip plus a pdftoppm check, the way the suite already
treats the serve and index extras. With the extra present the tests run; with
it absent they skip instead of failing.

Trade-off worth naming: on CI as configured they now skip, so they do not gate
the backend. Making them gate means syncing `--extra pdf` and putting poppler
on the runner — a CI change beyond this fix.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@ASuresh0524
ASuresh0524 merged commit a9b9bc3 into main Aug 30, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant