Repository navigation
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 6 files
Shadow auto-approve: would not auto-approve because issues were found.
Re-trigger cubic
There was a problem hiding this comment.
0 issues found across 2 files (changes from recent commits).
Shadow auto-approve: would not auto-approve. Auto-approval blocked by 3 unresolved issues from previous reviews.
Re-trigger cubic
# Conflicts: # CHANGELOG.md
There was a problem hiding this comment.
0 issues found across 1 file (changes from recent commits).
Shadow auto-approve: would not auto-approve. This PR does not meet the repository auto-approval settings.
Re-trigger cubic
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
No issues found across 7 files
Shadow auto-approve: would not auto-approve. This PR does not meet the repository auto-approval settings.
Re-trigger cubic
…IO#4563) ## What `partition_xlsx()` with subtable detection (the default) needs substantially less memory on dense worksheets, and the saving grows with sheet size. Output is unchanged. On synthetic dense sheets (a ten-column sheet split into three dense subtables, half integers, half short Unicode strings), peak RSS in a fresh process drops by roughly 40–60% depending on size, with comparable runtime. Working memory per populated cell drops to roughly a third. Serialized element JSON is byte-identical before and after. ## Why Two whole-sheet intermediates dominated memory on dense sheets: 1. **Subtable detection built a NetworkX graph** with a node per populated cell and an edge per neighbor pair. It now uses an iterative four-neighbor flood fill over populated cells (the approach from Unstructured-IO#4357), with the same component admission order, cell membership, row-overlap merging, table order and bounding boxes. 2. **Table HTML was rendered for the whole table at once** (pandas `to_html` string, its parsed DOM and a full-table token list). Rows are now formatted by pandas' formatter for the whole column, so float/date/string formatting is unchanged, and each row is rendered and parsed on its own before the next. `networkx` is no longer needed at runtime by the XLSX partitioner, so it moves from the `xlsx` extra to the test dependencies (it's still used by other extras that depend on it). ## Behavior - Same elements, text, `text_as_html` and metadata; exact-output tests cover mixed types, NaN/empty cells, wide floats that switch to scientific notation in another row, dates and HTML escaping. - The renderer uses pandas' private formatter classes, as the existing reader already does for `OpenpyxlReader`. Verified on pandas 2.1.4 (renderer-parity comparisons), 2.2.3 and 2.3.3. - The worksheet cell limit, empty-row compaction, empty-sheet handling and XLS padding handling are unchanged. ## Validation - XLSX and dense-memory suites pass. New tests compare component detection and rendered HTML against the previous implementation on generated sheets. - Ruff check/format pass. ## Release Sets the release to **0.27.32** (0.27.31 was taken by Unstructured-IO#4538, which merged first). It merges after Unstructured-IO#4419, Unstructured-IO#4516, Unstructured-IO#4517 and Unstructured-IO#4562, and its CHANGELOG collects their entries and this one into a single 0.27.32 section. Unstructured-IO#4524 and Unstructured-IO#4523 are not included and will go into a later release. Supersedes Unstructured-IO#4357. <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/Unstructured-IO/unstructured/pull/4563?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="View guided diff" src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
…Unstructured-IO#4741) ## Problem After finding populated-cell components, XLSX subtable detection repeatedly unions every component that overlaps in row range. Each pairwise merge copies the accumulated cell set and discards its cached bounds, so the next comparison scans that growing set again. A wide sparse row containing many disconnected populated cells makes this phase quadratic. The earlier Unstructured-IO#4563 / Unstructured-IO#4357 work changed populated-cell discovery and HTML rendering; it retained this pairwise row-overlap merge. ## Change Accumulate one cell set for each overlapping group and track its maximum row separately. Materialize the merged component when the group ends. Component sorting, transitive row-overlap semantics, source cell sets, table order, and document rendering are preserved. ## Correctness and regression checks - A deterministic work-bound regression uses 200 disconnected cells on one row. The unchanged implementation visits 20,099 cells while recomputing component extents and fails the linear budget; the fix passes. - Compare cell membership and bounds against the previous pairwise algorithm on 100 seeded worksheets, including unchanged source component sets. - Compare complete serialized output from a real XLSX workbook under both header settings and both HTML-output settings. - New regressions and existing XLSX tests: **164 passed**, with one existing pandas future warning about a null-value comparison. Installed the lockfile's test-only `networkx==3.6.1` before the complete run. - Ruff lint, formatting, and `git diff --check` pass. No full repository suite was run. ## Measurements Local Python 3.12, seven alternating before/after pairs per case with garbage collection before each sample. Input is a synthetic row with one populated cell every other column. Every component result or serialized document result has the same SHA-256 before and after. | Operation | Populated cells | Before median | After median | | --- | ---: | ---: | ---: | | Complete component discovery and merging | 64 | 0.685 ms | 0.434 ms | | Complete component discovery and merging | 512 | 6.899 ms | 1.488 ms | | Complete component discovery and merging | 2,048 | 87.243 ms | 5.032 ms | | Complete component discovery and merging | 4,096 | 329.981 ms | 9.653 ms | | Public `partition_xlsx` on XLSX bytes | 64 | 18.573 ms | 17.390 ms | | Public `partition_xlsx` on XLSX bytes | 2,048 | 424.877 ms | 357.962 ms | The public-path measurements include workbook decoding and table/text generation, with language detection and HTML metadata disabled. Their smaller improvement is expected because those other phases are unchanged. These synthetic measurements do not establish a general speedup for all workbooks. Suggested label: `enhancement`. <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/Unstructured-IO/unstructured/pull/4741?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="View guided diff" src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
Summary
Replace worksheet-sized NetworkX graph construction with traversal over populated cells. Preserve four-neighbor connectivity, row-overlap merging, element ordering, text, HTML, and metadata. NetworkX remains a test dependency for comparison with the previous algorithm, and is removed from the XLSX runtime extra.
Compatibility
No new file-size, row, cell, or processing limit is introduced. Parsing, populated-cell semantics, and table rendering are unchanged. Exact serialized output matches the old algorithm for generated multi-sheet workbooks across header/HTML options and six existing XLSX fixtures. This is evidence of compatibility, not a guarantee for every possible workbook. Pandas still materializes worksheet data and a boolean mask; memory is reduced, not capped.
Validation
Synced with current main on October 1, 2026 (released as 0.27.15).
These measure component detection, not total API latency. Peak RSS is sampled every 5 ms, so it is a lower bound on the true peak.