Productionize oversized PDF sharding and 300MB upload limit
Summary
Productionize the oversized PDF shard pipeline and align upload-size handling across the API worker and Notebook.
Context
Large, TOC-heavy PDFs need to be processed through the agent-driven profile and hierarchy pipeline instead of being rejected at the direct MinerU page limit. The same work also uncovered upload-size and error-propagation gaps for Notebook users.
Scope
- Enable the oversized PDF shard pipeline by default for PDFs over the direct processing limit.
- Centralize oversized PDF rejection policy for worker ingestion and parse-session routing.
- Preserve detailed processing errors when the shard pipeline fails, while surfacing a user-facing failure message instead of silently returning partial output.
- Fix debug DB publication handling for
PublishedDocumentStateobject returns. - Raise the file upload limit from 100MB to 300MB in backend config and Notebook UI/client validation.
- Surface clear English file-size errors with support contact (
[email protected]) and GitHub Issues link. - Add automated coverage for oversized PDF failure mapping and a mocked happy path that does not depend on MinerU or LLM services.
Validation Plan
- Worker contract tests for oversized PDF rejection, shard failure mapping, and mocked happy path.
- Notebook upload validation/API/UI tests for the 300MB limit and user-facing messages.
- Python compile checks and IDE lint checks for changed files.
Notes
Notebook changes live in the separate Ontos-AI/knowhere-notebook repository and should be merged through its own staging branch. The Node SDK does not need a parameter change or package release because it already passes through job error messages from the API.
Added worker contract coverage for the centralized oversized PDF rejection policy (oversized_pdf_policy.py), aligned to current main (includes #395).
Covered with mocked settings (no real oversized PDFs):
- non-PDF files are not rejected
- PDFs at or below
MAX_PDF_PAGE_LIMITare not rejected OVERSIZED_PDF_SHARD_ENABLED=falseand pages above the direct limit → standardValidationException- sharding enabled and pages at or below
OVERSIZED_PDF_SOFT_LIMIT→ admitted - pages above the soft limit → contact-support rejection
- shard/profile failures expose
user_message+reason, and keepinternal_messageoff the client payload
Related to #121.
Follow-up to the 2026-09-10 coverage note: the policy-module unit lock is now in https://github.com/Ontos-AI/knowhere/pull/416 (test-only, mocked settings, no production change).