Repository navigation
Conversation
cc278a3 to
08253b8
Compare
cragwolfe
left a comment
There was a problem hiding this comment.
Reviewed 08253b813280145a160caa2adf46469fc9ad8114 with GPT Pro.
P1 — Preserving cross-page section ancestry causes HTML export to omit continuation content (unstructured/partition/common/metadata.py:68–75,87–94; consumer: unstructured/partition/html/convert.py:263–277). With a page-one heading followed by page-two <pre>x = 1</pre>, a paragraph and a subsection, the new rules correctly keep those elements under the page-one heading. Default elements_to_html() groups by page first, cannot find that parent in the page-two group, and returns only elements with parent_id is None. The code, following paragraph and subsection—including its children—disappear from the export. Before this change, code cleared the heading stack and this content remained exportable. Header parents and other newly admitted categories have the same failure path.
Keep the hierarchy fix and make an element whose parent is outside its page group an export root within that group. Preserve source parent IDs, page metadata, IDs, same-page nesting and current sanitization behavior. Add real partition/export regressions for cross-page code and retained image payloads, including Header parents, page furniture and local subsections; assert exact-once output and unchanged source metadata.
This is the shared export issue previously found in #4503. Its narrow exporter repair is present on that open PR, but absent from this head and current main. Consolidating that shared repair here would let #4503 consume it without duplicating changes. The other list/caption findings on #4503 concern its additional figure traversal and are not new findings against this target.
Required CI remains unverified: workflow runs require action; Socket checks alone do not establish test success. No local tests or reproductions were run.
(authored by codex)
…t elements set_element_hierarchy() popped the enclosing Title/Header off the parent stack when it met an element type missing from HIERARCHY_RULE_SET (Image, PageBreak, Formula, CodeSnippet, Address, EmailAddress, PageNumber, Footer), so later elements in the same section got parent_id=None. Add those types as children of Title and Header and drop the duplicate Table entries. Co-authored-by: Cursor <[email protected]>
Keeping the section heading across non-text elements means page-two content can have a page-one parent. elements_to_html() groups elements by page, could not find that parent in the page-two group, and returned only elements without a parent_id, so the code, the paragraphs after it and any subsection were dropped from the export. An element whose parent is not in its page group is now a root of that group. Element metadata is unchanged. This is the exporter fix from Unstructured-IO#4503. Co-authored-by: Rohit Behera <[email protected]> Signed-off-by: kerthans <[email protected]> Co-authored-by: Cursor <[email protected]>
08253b8 to
4552e40
Compare
|
Thanks for the review. Addressed in 4552e40:
Once this lands, #4503 can drop its copy of the exporter change. |
cragwolfe
left a comment
There was a problem hiding this comment.
Reviewed 4552e40de4f81b5c507f2a5d56cf4b13f75dd3c6 against 33779f9a218ec6229b37ddd30b1a1cfd5c59a9a7 with GPT Pro. Source review approved; no new actionable findings.
The prior P1 cross-page HTML export omission is resolved. Children whose parent is outside the current page now render as roots on that page, while local parents retain their children. The added regressions cover partitioned code and retained image payloads, Header parents, page furniture, local subsections, exact-once output, and unchanged source IDs and metadata. The final sanitization path remains intact. Shared hierarchy, partitioning, chunking, and staging behavior were also reviewed.
Required CI is still unverified: CI, Security, CodeQL, and Partition Benchmark report action_required with no jobs started. The required changelog, Docker, lint, unit, and ingest checks have no successful results for this head. Socket checks are green but do not establish test success. Workflow approval and successful required checks remain necessary before merge. No local tests or reproductions were run.
(authored by codex)
… section parent A slide break no longer clears the parent stack, so the sample deck's page breaks and the table on its untitled slide now have the previous heading as parent_id. Co-authored-by: Cursor <[email protected]>
|
The only CI failure was If you'd rather a slide break still start a new section in PPTX, I can do that inside |
Resolve the conflict in convert.py by taking upstream's version, since Unstructured-IO#4566 already keeps an element whose parent is absent in HTML export.
`<summary><h3><img ...>Question?</h3></summary>` was handed to ordinary heading traversal, which classifies text after a nested block without `Title`, so the label became `Text` and `chunk_by_title()` saw no new section. The label traversal now descends into a heading wrapper as it does into a `<p>` or `<div>`. Also add regression tests for the heading chain across a summary icon and for exporting disclosure content whose children are on a later page. Both pass with the hierarchy and export changes from Unstructured-IO#4566 that this branch now merges. Signed-off-by: Rohit Behera <[email protected]>
Root cause
set_element_hierarchy()walks a parent stack and pops every entry that is not a valid parent of the current element.HIERARCHY_RULE_SETonly lists text-like children forTitleandHeader, so an element whose category is in no rule (Image,PageBreak,Formula,CodeSnippet,Address,EmailAddress,PageNumber,Footer) popped the whole stack, including the section heading, and was then pushed itself. Every following element in the same section gotparent_id=None.Change
TitleandHeaderinHIERARCHY_RULE_SET."Table"entry from both lists.[Title, NarrativeText, Image, NarrativeText]resolves as follows: the Image becomes a child of the Title, the next NarrativeText pops the Image (not a valid parent) and attaches to the Title.Related
Open PR #4503 (HTML
<figure>handling) also adds"Image"and"CodeSnippet"to the same rule lists, so whichever lands second will need a small rebase.Tests
Describe_set_element_hierarchytests: Image and PageBreak between paragraphs under aTitle, and an Image under aHeader. They fail before the change and pass after it.test_unstructured/partition/{common,html,test_md.py,test_docx.py,...},chunking,documentsandstagingpass locally. Ingest expected outputs excludemetadata.parent_id, so no fixtures change.Behavior change
Title/Headernow get that heading asparent_id(previouslyNone).parent_idinstead ofNone.FooterandPageNumberare now also parented to the preceding heading. They are page furniture, so this is arguably less meaningful, but it stops them from breaking the hierarchy of the content that follows.AI assistance was used to prepare this change; I reviewed and tested it.