knowhere icon indicating copy to clipboard operation
knowhere copied to clipboard

Productionize oversized PDF sharding and 300MB upload limit

Open EricNGOntos opened this issue 6 months ago • 2 comments

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 PublishedDocumentState object 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.

EricNGOntos avatar Jun 02 '26 07:06 EricNGOntos

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_LIMIT are not rejected
  • OVERSIZED_PDF_SHARD_ENABLED=false and pages above the direct limit → standard ValidationException
  • 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 keep internal_message off the client payload

Related to #121.

Frankie-Xu avatar Sep 10 '26 15:09 Frankie-Xu

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).

Frankie-Xu avatar Sep 14 '26 18:09 Frankie-Xu