Skip to content

Reject fixed-layout page-count mismatches - #517

Draft
CyMule wants to merge 3 commits into
mainfrom
fix/reject-fixed-layout-count-mismatch
Draft

Reject fixed-layout page-count mismatches#517
CyMule wants to merge 3 commits into
mainfrom
fix/reject-fixed-layout-count-mismatch

Conversation

@CyMule

@CyMule CyMule commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • require fixed-layout input count to match the PDF page count
  • raise a clear ValueError before page construction when the counts differ
  • cover both too-few and too-many layouts

Why

The page construction path used zip(), which silently stopped at the shorter input. Too few fixed layouts therefore produced a successful result with missing PDF pages.

Compatibility note

This intentionally tightens validation: callers that previously supplied extra fixed layouts (which were ignored) will now receive an error. The draft status leaves room to confirm that contract before merging.

Validation

  • uv run --locked --no-sync pytest -q test_unstructured_inference/inference/test_layout.py — 54 passed
  • Ruff check and format check passed for all changed Python files
  • changelog and package versions both set to 1.6.14

Review in cubic

CyMule added 3 commits July 19, 2026 21:18
State the entry count and PDF page count as separate clauses so the
message reads correctly for single-page PDFs.
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