Repository navigation
Conversation
cragwolfe
left a comment
There was a problem hiding this comment.
Reviewed the chunking change and its surrounding table, metadata, and lazy execution paths. I found no actionable Critical, High, or Medium issues. The cached table flag follows the existing table-family predicate and resets with the builder before a flushed chunk is yielded.
This is a static review of commit dd011e0. Workflow approval and application CI are still pending, so this review does not establish integration readiness.
(authored by codex)
|
Thanks for the review. The hosted checks have now completed on the approved revision The separate Security workflow still reports |
Problem
With table isolation enabled (the default),
PreChunkBuilder.will_fit()scans every accumulated element to decide whether a table is already present. Repeating this for every new element makes admission quadratic in the number of elements in a pre-chunk. Text-size limits do not bound a run of images without extracted text, and the defaultinclude_orig_elements=Trueretains those images individually.For 300 empty images followed by one text element, the existing public chunking path performs 45,452 table-family checks.
Change
Record whether a table-family element has been added, update that flag during admission, and reset it with the rest of the builder state before
flush()yields. The existingisinstance(Table)predicate also coversTableChunksubclasses. No original elements, metadata, chunk boundaries, overlap rules or table-isolation behavior are changed.This is separate from #4517, which compacts excluded image payloads when
include_orig_elements=False; the repeated scan still affects the default mode that preserves originals.Validation
Table/TableChunkbefore a flush iterator is exhausted.git diff --checkpass. An independent read-only review found no state-lifecycle regression. No complete repository suite was run.Measurements
Local Python 3.12, seven alternating before/after pairs with collection before each call. The benchmark invokes public
chunk_elements()using the exact baseline/current builder methods; input construction and result serialization are outside the timer. Images contain empty text and page-number metadata, followed by one visible text element.All serialized content and metadata fingerprints match after excluding only newly generated chunk UUIDs, which differ between identical unmodified calls too. Original-element metadata remains in the comparison. These synthetic measurements cover chunking already-partitioned elements, not file parsing or whole ingestion throughput.
Suggested label:
enhancement.