fix(chunking): preserve semantic headers in carried table chunks#4313
Open
fix(chunking): preserve semantic headers in carried table chunks#4313
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Second-Round Problem Statement
The first round restored carried-header semantics (
<thead>/<th>) for continuation chunks, but follow-up analysis found a reconstruction edge case: canonical<thead>synthesis during merged-table reconstruction could still trigger when carried header rows did not correspond to chunk-0 leading rows. In those mismatched scenarios, reconstruction could over-normalize header structure and risk row-order/semantic drift.Boundary Rationale
Boundary decisions were intentionally kept narrow:
HtmlCell.html,HtmlRow.html,HtmlTable.html, header-count semantics).<thead>reconstruction to cases where carried rows match chunk-0 leading rows.Why this boundary:
Implementation Summary
Follow-up commits on this branch (
ba8241cf,eb39dacf,c33e6bce,14b947c9) do the following:unstructured/common/html_table.pysource_row_htmls) and thread it intoHtmlRow(source_html=...)as additive metadata.unstructured/chunking/base.pyrow.source_html(fallbackrow.html).<td>tags to<th>for carried headers, preserving attributes and nested subtree content.unstructured/chunking/dispatch.py<thead>synthesis guardrails so reconstruction uses carried rows only when they match chunk-0 leading-row signatures.test_unstructured/chunking/test_base.pyfor attribute preservation, non-text cell preservation, canonical<thead>gating, and carried-header stability.test_unstructured/common/test_html_table.pycoverage for preserved source-row HTML plumbing.Validation Evidence
Executed for the second-round follow-up:
Observed results:
./init.sh: pass (7 passed,6 passed)make check: pass3 passed,203 deselected)e2e-table-header-smoke: ok)authored by codex