Skip to content

A page or slide of text names the pictures, charts and diagrams it does not read - #301

Merged
zlareb1 merged 10 commits into
mainfrom
fix/extractor-unread-images
Nov 7, 2026
Merged

zlareb1 merged 10 commits into
mainfrom
fix/extractor-unread-images

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Related: #157

Changelog category (leave one):

  • Improvement

Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):

A PDF page or PPTX slide whose text is read but which shows a picture OCR does not read (one under a fifth of it, a picture fill or background), a chart, a diagram or an embedded object is now named in the artifact (attrs.images_unread) and in one warning, and a DOCX of text with pictures, charts, diagrams or embedded objects warns; before, such a file reported complete coverage and said nothing about the text inside them.

Why

Scoring the reference extractor on the parsing bench's corpus (bench/docparse/corpus) found silent loss on decks: PPTX slides and PDF slide exports whose text the artifact holds but whose image text (a chart's labels, a screenshot) it drops while reporting the file complete. OCR in the extractor now reads a scanned page and a picture covering a fifth of a page or slide, and makes the page or slide partial where it cannot. A smaller picture, a picture fill, a chart, a diagram and an embedded object are still not read, and nothing said so. What the extractor owes the caller is to say so.

This is the first fix the qualification gates of the issue's last workstream need; the gates themselves follow in their own pull request.

Design

  • PDF. The layout reader's drawing walk (pdflayout.drawing) already collects every picture a page draws, as an image XObject or inline, for OCR. On a page of text, a picture shown at least a point wide and a point high that is under a fifth of the page (ocr.PICTURE_SHARE), and that the page's own text does not fill (a scan's text layer), is one OCR leaves: the page is listed in attrs.images_unread. A larger picture is read with OCR, or the page is partial naming why, as before; a page whose drawing cannot be read or collected whole is partial as before, so the list needs no fallback search. A page partial for its pictures is named by that reason and not listed, as a PPTX slide is. Nothing is decoded or searched again: the list reads what the walk collected.
  • PPTX. A slide counts its pictures and the ones OCR read, and tracks a chart, diagram or embedded object (_Slide.charts). It now also tracks a picture OCR never sees (_Slide.unread_picture): a shape, a group or a table cell filled with a picture, a picture as the slide's own background (p:bg/p:bgPr/a:blipFill), and alternate content whose choice the walk does not read (ink, or an equation, whose math is no text the walk reads) when the fallback holds a picture. A background from the slide's layout, master or theme is not read. A slide of text (its speaker notes count) with a picture OCR did not read, a fill, a chart, a diagram or an embedded object is listed in attrs.images_unread, unless it already failed for what it shows (a large picture without OCR, or a chart beside text OCR read alone), whose failure names it. A slide of these and no text is a failed unit, as a slide of a picture alone already is.
  • DOCX. A document has no pages to cite, so a document of text gets the warning alone. It warns when it holds what a drawing shows and the reader does not read. That is an image: a:blip, which a picture, a group's picture and a shape's picture fill all use; v:imagedata in VML; a VML shape's v:fill naming an image part, but for a pattern fill, whose part is the pattern's tile. It is also drawn text (WordArt's v:textpath, a locked canvas's a:t), a chart or a diagram (by its a:graphicData uri), or an embedded object (w:object). One walk finds them (_pictures), over what the reader keeps: tracked deletions, and a table's deleted rows and cells, are left out. It searches an alternate-content fallback, which the text reader skips, for images, as a drawing the reader does not know, such as a 3D model, keeps its only picture there; drawn text in a fallback does not count, as the choice's text is read (WordArt as Word writes it now). It covers the body, its tables, and its footnotes and endnotes. The same walk decides the failure of a document with no text: a document of these and no text is a failed unit, and a document of a line or a plain shape and no text reads as empty, since it holds nothing to read (before, any drawing failed it). A DOCX page background is not looked at, as the docs say. The DOCX reader runs no OCR.
  • One warning per file rather than one per page, so a branded PDF with a logo on every page carries one line; the pages are in attrs.images_unread. Coverage stays complete: the text these units hold is read, and a small image's text is a capability the release does not offer, not an omitted unit. Making it a coverage.lost capability would make every file with a logo partial, refused by default without allow_partial.
  • Parser versions bump (PDF 4, PPTX 4, DOCX 4), as each artifact's content changes.

Alternatives: a warning per page (unbounded on long files); coverage.lost (refuses most real documents by default); OCR for every picture however small (an icon or a logo per page would spend the file's OCR budget on no text); leaving it to the bench's silent-loss count (the artifact still says nothing to a caller).

Scope and risk

Touches the reference extractor's PDF, PPTX and DOCX parsers and their docs. No server, wire or schema change: attrs and warnings are already free fields the server validates and carries, and knowledge.ingest_status already returns the warnings. A source extracted again gets a new artifact (new parser version), as any parser change does.

Compatibility, rollout and rollback

  • Wire: none. The artifact gains attrs.images_unread (a list of page or slide numbers) and a warning; the contract allows both.
  • Operator steps: none. Documents ingested earlier keep their artifacts until extracted again.
  • Rollback: reverting leaves artifacts with the new attr and warning, which the server reads as it does any.

Tests

  • tests/unit/test_document_extraction_office.py: a PDF page of text that draws a small image (an image XObject, one in a form, one inline, one inline in a form) is read and listed ([2]) with one warning, coverage complete; a page whose resources hold an image its content never draws is not listed; PPTX slides of text with a picture, with a chart, with a picture and speaker notes alone, and with a picture-filled shape are listed ([2, 3, 4, 5]); a PPTX table cell filled with a picture (a:tcPr/a:blipFill) is listed, a run's text fill in a cell is not, a slide with a 3D model is, as is a slide of text with ink, and one with an equation (real OMML, its fallback a picture-filled shape, as PowerPoint writes it), and a slide with a shape whose choice is read is not; a PPTX slide of text over a picture background, and one with a picture-filled group, are listed; a DOCX of text with a picture, a chart, a diagram, a grouped picture, a picture-filled shape, a VML image, a VML picture fill (named by its relationship or its Office id), a 3D model or an embedded object warns, as does one with a picture in a table cell or a footnote, and one with no drawing, a text box (bare, or in alternate content with its VML copy, as Word writes it), WordArt as Word writes it now (its text read through the choice, its VML copy in the fallback), a horizontal rule, a plain shape, a pattern-filled box, a picture inside a tracked deletion or one in a deleted table row or cell does not; a PPTX slide of only a picture background and no text is a failed unit; a DOCX of an embedded object, a chart, a 3D model or WordArt and no text is a failed unit, and one of text with a 3D model or WordArt warns. The PDF fixture builder (tests/fixtures/office_files.py) takes a page as (lines, kind), lines that also draw an image of that kind.
  • tests/unit/test_document_extraction_ocr.py: a large picture OCR read on a text page or slide is not listed, a small one is; a scan's own text layer over its image is not listed; a text page or slide partial or failed for a large picture without OCR is not listed, its reason naming it (the PDF case beside a small picture fails without the rule); a slide with a chart beside text OCR read fails and is not listed; a slide with a chart beside a picture OCR read fails with the new reason; a slide or a page with a picture OCR read and a small one is listed; a page-wide image under a point high is not listed. A small image a scan's own text layer fills (a scan in strips) is not listed.
  • On the bench corpus, with OCR off, every deck whose gold holds image text is either listed (a small picture) or partial (a large one): deck_export_0.pdf and deck_export_2.pdf listed, deck_export_1.pdf listed (page 5) and partial (page 6), deck_1/3/5.pptx and web_deck_2.pdf partial (each corpus file extracted in process with loom_extractor.extract, its attrs.images_unread and coverage read). The qualification gates that follow will run this check as a test.
  • The full unit suite passes on the final head (27,743 passed; the four CSV sniff-timing cases fail on CPU time as on main on this host, and one process-group kill case failed under that load and passes alone), as do make format lint typecheck.

AI assistance in the code (leave one; writing this description with AI is fine):

  • AI-generated (an agent wrote most of the diff): Claude Code. Checked: which corpus files the change flags against their gold, the cost of the image check, and a review at every push.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • make format-check, make lint, make typecheck and make test-unit pass; the integration suite passes if server behaviour changed.
  • Generated files are regenerated in this PR, not by hand: the SDK op tables, docs/reference/configuration.md and the docs/reference/ tables (python scripts/codegen/docs_reference.py), the reach manifest, schemas/schema.sql (make schema-dump) and the Codex plugin copies (python3 scripts/codegen/agent_plugin_sync.py).
  • A new migration is additive and numbered after the latest on main; no merged migration is edited. (Not applicable: no migration.)
  • A behaviour change to any file a plugin ships (hooks/, lib/, bin/, skills/, .mcp.json, the Codex plugin-defaults.json) bumps both plugin manifests' version, and no other open PR uses that version. (Not applicable: no plugin file changes.)
  • The frontend builds (npm --prefix frontend run build) and its tests pass, if frontend/ changed. (Not applicable.)
  • Docs under docs/ describe the system as it now is, and this description names any operator steps and wire changes.
  • Repository text has no dates, people, host names, internal namespaces, ticket or decision numbers; the history goes in this description (tests/unit/test_public_copy.py).
  • Commits are signed off (git commit -s), as CONTRIBUTING.md asks.

🤖 Generated with Claude Code

@zlareb1
zlareb1 force-pushed the fix/extractor-unread-images branch from 625160c to 149eca0 Compare November 7, 2026 07:09
@zlareb1 zlareb1 changed the title The reference extractor names the images it does not read on a page or slide of text A page or slide of text names the pictures, charts and diagrams it does not read Nov 7, 2026
zlareb1 and others added 5 commits November 7, 2026 07:21
… never dropped in silence

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…tures, fills, charts

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…, never listed as well

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…e unit, the docs say

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
@zlareb1
zlareb1 force-pushed the fix/extractor-unread-images branch from 5171179 to 54f3119 Compare November 7, 2026 07:22
zlareb1 and others added 5 commits November 7, 2026 07:28
…ys what it holds

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…trip its text fills is tested

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…what they hold

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
@zlareb1
zlareb1 merged commit 29a6d7e into main Nov 7, 2026
32 checks passed
@zlareb1
zlareb1 deleted the fix/extractor-unread-images branch November 7, 2026 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant