fix(parser/mineru): log items the text fallback drops without a trace - #3789
fix(parser/mineru): log items the text fallback drops without a trace#3789boeschbenjamin-jpg wants to merge 1 commit into
Conversation
The fallback discards any content_list item whose `_coerce_text` is empty without a single log line. That is why the dropped `chart` items (HKUDS#3774) stayed invisible until a 342-page book was audited by hand, and the next picture-like type MinerU adds — or a v2-shaped payload that nests the path under `content.image_source.path` — would vanish the same way. Emit a debug breadcrumb for those, but stay silent for text-typed items whose emptiness is ordinary layout noise (blank running head, unreadable heading); `_KNOWN_EMPTY_TYPES` lists them. The types with their own branch (text/list/code/equation/table/drawings, page_number) never reach here. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GqSL71EiBLCnvv7VnvKCDj
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Review of
|
Follow-up to the review of #3775 (Finding 2), kept separate so that PR stays small.
Problem
The text fallback in
lightrag/parser/external/mineru/ir_builder.pydrops anycontent_listitem whose_coerce_textis empty without a single log line. That is exactly why the silently droppedchartitems in #3774 stayed invisible until a 342-page book was audited by hand — an emptytablebody at least gets alogger.debug. The next picture-like type MinerU adds (or a v2-shaped payload nesting the path undercontent.image_source.path) would disappear the same way.Fix
One
elifin the fallback: emit alogger.debugbreadcrumb withtypeandpage_idxfor items that carry no usable text and are not known-empty-by-nature._KNOWN_EMPTY_TYPESholds the text-typed items whose emptiness is ordinary layout noise (blank running head, a heading the model could not read) — logging those would be per-page spam. The types with their own dispatch branch (text/list/code/equation/table/ the drawing types) andpage_numbernever reach the fallback, so they are not listed.No behaviour change beyond the log line: the item is still skipped, no position is recorded.
Test
test_adapter_logs_structural_item_dropped_without_text— an unhandled picture-like item (header_imagewithimg_path, no text) produces exactly one message; a blankheaderon the same page stays silent. Fails without the change (assert set() == {...}).🤖 Generated with Claude Code
https://claude.ai/code/session_01GqSL71EiBLCnvv7VnvKCDj