Skip to content

fix(parser): recover text_box and nested table/list text in office IR - #19319

Merged
yuzhichang merged 5 commits into
infiniflow:mainfrom
jay77721:fix/pptx-textbox-table-text
Sep 8, 2026
Merged

yuzhichang merged 5 commits into
infiniflow:mainfrom
jay77721:fix/pptx-textbox-table-text

Conversation

@jay77721

@jay77721 jay77721 commented Sep 7, 2026

Copy link
Copy Markdown
Member

Summary

bwbd.pptx stores all slide text in graphicFrame tables, which office_oxide emits as text_box -> table IR. The IR text flattening only recognized paragraph/heading blocks, so every slide flattened to empty text. The empty items bypassed the PlainText salvage (gated on len(items) == 0) and were later filtered by the Tokenizer, silently yielding 0 chunks for a readable deck.

Changes

  • Flatten each text_box block, table cell block, and list item block via docxElementText so nested table/list/text_box content is recovered (internal/parser/parser/docx_ir.go).
  • Extend the PPTX PlainText fallback to trigger when all items are empty, not just when there are no items (internal/parser/parser/pptx_parser.go, gate in internal/parser/parser/pptx_ir.go).
  • Add regression tests: text_box wrapping table keeps text and TestItemsAllEmpty (internal/parser/parser/pptx_ir_test.go).

Verification

  • bash build.sh --test ./internal/parser/parser/ passes.
  • New regression case fails without the docx_ir.go fix and passes with it.
  • bash build.sh --test ./internal/ingestion/component/... passes (no downstream regression).

Fixes the 0-chunk ingestion of grouped-shape PPTX decks while leaving paragraph/heading/image paths unchanged.

bwbd.pptx stores all slide text in graphicFrame tables, which
office_oxide emits as text_box -> table IR. The IR text flattening
only recognized paragraph/heading blocks, so every slide flattened
to empty text. The empty items bypassed the PlainText salvage
(gated on len(items) == 0) and were later filtered by the
Tokenizer, silently yielding 0 chunks for a readable deck.

Flatten each text_box block, table cell block, and list item
block via docxElementText so nested table/list/text_box content
is recovered. Extend the PPTX PlainText fallback to trigger when
all items are empty, not just when there are no items.

Co-authored-by: CommandCodeBot <[email protected]>
@coderabbitai

coderabbitai Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: aa7f4b8a-f20b-425b-a35f-1f1b40cd7140

📥 Commits

Reviewing files that changed from the base of the PR and between 1902e67 and cc83595.

📒 Files selected for processing (1)
  • internal/parser/parser/pptx_ir_test.go

Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

The parser now preserves nested DOCX block content through generic flattening. PPTX parsing detects structured sections with no extractable text and retains whole-document plain text.

Changes

Parser text preservation

Layer / File(s) Summary
DOCX block flattening
internal/parser/parser/docx_ir.go, internal/parser/parser/docx_ir_test.go
List items, block collections, and table cells now flatten all contained elements through docxElementText. Tests cover nested tables, lists, and text boxes.
PPTX empty-content fallback
internal/parser/parser/pptx_ir.go, internal/parser/parser/pptx_parser.go, internal/parser/parser/pptx_ir_test.go
PPTX parsing falls back to whole-document plain text when all structured items contain empty or whitespace-only text. Tests cover nested elements and all-empty detection.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to ed4f1

Nested PPTX and DOCX content is now retained during text extraction, and decks with only empty structured items fall back to plain text. The covered parser behavior is ready to merge.

Suggested reviewers: euvre, harsh23kashyap

Poem

A rabbit flattens blocks with care
Nested words emerge from everywhere
Empty slides find text anew
Tables keep their letters too
Parsers hop with content true

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description check ✅ Passed The description includes the required Summary section and clearly explains the problem, implemented changes, regression tests, and verification results.
Title check ✅ Passed The title is concise and accurately identifies the main parser fix: recovering text from text boxes and nested table/list content in office IR.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 5 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@jay77721 jay77721 added ci Continue Integration go Pull requests that update go code parsing size:M This PR changes 30-99 lines, ignoring generated files. 🐞 bug Something isn't working, pull request that fix bug. 🧪 test Pull requests that update test cases. and removed ci Continue Integration labels Sep 7, 2026
jay77721 and others added 2 commits September 7, 2026 15:39
Add fail-before-fix regression tests for the text_box/table/list
flattening recovery: list item nesting a table, table cell nesting
a list, and a text_box wrapping a table at the DOCX layer (mirrors
the PPTX bwbd.pptx shape). All three fail on the old
paragraph-only paths and pass with the docxElementText recursion.

Co-authored-by: CommandCodeBot <[email protected]>
Extend TestBuildPPTXJSONSections with the missing nesting shapes:
text_box wrapping a list, nested text_box, and a table cell
wrapping a list. All three fail on the old paragraph-only
flattening and pass with the docxElementText recursion.

Co-authored-by: CommandCodeBot <[email protected]>
@yuzhichang
yuzhichang merged commit e53e5de into infiniflow:main Sep 8, 2026
5 checks passed
@jay77721
jay77721 deleted the fix/pptx-textbox-table-text branch September 17, 2026 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration go Pull requests that update go code parsing size:M This PR changes 30-99 lines, ignoring generated files. 🧪 test Pull requests that update test cases.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants