8000 feat(autoindex): extract PowerPoint decks (.pptx), one record per slide by thomas-villani · Pull Request #1117 · xerj-org/xerj · GitHub
[go: up one dir, main page]

Skip to content

feat(autoindex): extract PowerPoint decks (.pptx), one record per slide - #1117

Merged
xerj-org merged 2 commits into
xerj-org:mainfrom
thomas-villani:feat/pptx-extractor
Oct 3, 2026
Merged

xerj-org merged 2 commits into
xerj-org:mainfrom
thomas-villani:feat/pptx-extractor

Conversation

@thomas-villani
Copy link
Copy Markdown
Contributor

Written by an AI coding agent (Claude Code, Claude Opus 5.5), run by @thomas-villani, who has reviewed this change.

What this changes, and why

Since #1114, autoindex recognizes a .pptx but junks it as an unsupported document. Slide decks are a common home for business content: reviews, plans and figures. Like PDF and DOCX, they are files grep cannot read. That is where the document-folder recipe measured XERJ's largest margin over grep: 6/7 vs 0/7 on questions whose answer lives only in a PDF or DOCX.

This PR adds extract/pptx.rs and a Family::Pptx for it.

Record shape (one record per slide):

Field Content
title Deck title: the first slide title, else the file stem. On every record, like PDF.
slide 1-based position in p:sldIdLst, which is the number PowerPoint shows. Slide part names (slide7.xml) do not change when slides are reordered, so they are not used for numbering.
slide_title Text of the title/ctrTitle placeholder, when present.
body The slide's text, plus its speaker notes.
section Only when a long slide is split by split_sections, the same as a PDF page. Locator slide{n}-s{k}.

Extraction details:

  • Text is read shape by shape from DrawingML. Each a:p paragraph is a line, a:br is a line break, and sh 8000 apes are separated by blank lines, which is where split_sections cuts.
  • Tables become one line per row, with cells joined by |. A value keeps its row and column; DOCX tables currently lose this.
  • Speaker notes are found through the slide's notesSlide relationship. They are appended under Speaker notes:, so both BM25 and the semantic field see them.
  • Skipped: dt/ftr/hdr/sldNum/sldImg placeholders and a:fld field text. This is boilerplate repeated on every slide, such as "Confidential" footers, dates and slide numbers.
  • Fallback: if presentation.xml or its rels are missing or unusable, slides come from ppt/slides/slideN.xml in numeric order.
  • Matching is on local names, so strict-OOXML namespaces read the same as transitional ones.

Bounds. Same reasoning as the decompression cap in docx.rs, with a container-wide budget added because a deck has many parts:

  • 32 MiB per part
  • 256 MiB decompressed per container
  • 64 MiB of extracted text
  • MAX_RECORDS_PER_FILE

Hitting any of these sets ExtractStats.truncated, so the truncation is reported, not silent. A deck with no text at all (images only) is junk.

Wiring:

  • Family::Pptx has as_str "pptx" and is in is_document.
  • It is sniffed from ppt/presentation.xml in zip_container_kind.
  • Dispatch is in extract/mod.rs.
  • It is in the SourceAndDocs band in both order::band and band_from_family_str. The agreement test covers it.
  • It is a full-read family in estimate::exact_scan_bytes, and has the whole-file size cap in scan_file.
  • "pptx" is removed from unsupported_document_advice.

Evidence

All of the following ran in a rust:latest Linux container (cargo 1.98.1) on this branch, rebased onto main at 7ad52601. The crate's test build does not compile on Windows; see #1114.

cargo test -p xerj-autoindex --lib
test result: ok. 1169 passed; 0 failed; 2 ignored; 0 measured; 0 filtered out; finished in 111.58s

The 7 new extract::pptx tests cover:

  • presentation order vs part names
  • the numeric fallback (slide10 after slide9)
  • titles, tables, notes and placeholder skipping
  • empty slides (no renumbering) and text-free decks (junk)
  • sectioning of a long slide
  • the decompression budget (truncates and reports)
  • OPC relationship target resolution

The updated sniff test asserts that ppt/presentation.xml sniffs as Family::Pptx.

Real-file check. I wrote a deck with python-pptx, which uses PowerPoint's default template parts (masters, layouts, notes master), and reordered its slides in sldIdLst. I ran it through sniff() and pptx::extract with a temporary test that is not committed:

sniffed family=Pptx kind=None
slide1-s0 {"title":"Q3 Business Review","slide":1,"slide_title":"Q3 Business Review","body":"Q3 Business Review\n\nFinance & Operations"}
slide2-s0 {"title":"Q3 Business Review","slide":2,"slide_title":"Next steps","body":"Next steps\n\nHire two analysts\nClose the Lisbon deal"}
slide3-s0 {"title":"Q3 Business Review","slide":3,"slide_title":"Revenue by region","body":"Revenue by region\n\nRegion | Q2 | Q3\nEMEA | 1.2 | 1.5\nAPAC | 0.8 | 0.9\n\nSpeaker notes:\nEMEA grew on the Lisbon contract."}
ExtractStats { records: 3, junk: 0, truncated: false }

Checks

  • cargo fmt -p xerj-autoindex -- --check: clean. Only this crate is touched.
  • cargo clippy -p xerj-autoindex --all-targets -- -D warnings: clean on Linux. CI runs it workspace-wide; I ran it on this crate only.
  • Scoped release build: cargo build --release -j 32 -p xerj-autoindex finished (3m 24s, Linux).
  • cargo test -p xerj-autoindex --lib: 1169 passed, 0 failed.
  • ES-YAML conformance suite: not run. This change only touches autoindex extraction, not the engine or the API.
  • New ES-compatible behavior / YAML case: N/A.
  • Docs: not updated. landing/llms.txt and the README list the extracted formats and would gain .pptx. Those files follow the one-open-PR rule and the SEO gates, so I left them for a separate docs PR once this lands.
  • CONTRIBUTION_REVIEW audit: N/A, no operational document or recipe changed.

Not run:

  • The integration tests under crates/xerj-autoindex/tests/.
  • An end-to-end xerj autoindex run against a server.
  • A deck saved by PowerPoint itself, as opposed to python-pptx.

Provenance

  • Written by: AI agent (Claude Code, Claude Opus 5.5), run by @thomas-villani, who has reviewed it.
  • Verified (commands run, output observed):
    • The test, clippy, fmt and release-build results above, on the rebased tree.
    • The python-pptx deck extraction output above.
  • Assumed (not tested):
    • That decks saved by PowerPoint, Keynote and Google Slides put the title in a title/ctrTitle placeholder and reach notes through a notesSlide relationship, as the ECMA-376 layout and python-pptx do. A real deck with an empty slide_title or missing notes would falsify this.
    • That appending notes to body, rather than a separate field, is the right retrieval trade-off. Notes then share the slide's semantic vector. A separate notes field would be lexical-only, because DOC_BODY_FIELDS elects body/text only. I have not measured this either way.
    • That charts, SmartArt and images contribute no text, which is acceptable for a first version. Chart titles and SmartArt text live in separate parts that this extractor does not read.

🤖 Generated with Claude Code

Motivation: since xerj-org#1114, autoindex recognizes a .pptx but junks it as an
unsupported document. Decks are a common carrier of business content
(reviews, plans, figures) and, like PDF/DOCX, are exactly what grep cannot
read, which is where the document-folder recipe measured XERJ's largest
margin over grep (6/7 vs 0/7 on PDF/DOCX-only answers).

What it does (extract/pptx.rs, new):
- One record per slide: `title` (deck title = first slide title, else the
  file stem), `slide` (1-based position in p:sldIdLst — the number
  PowerPoint shows; part names do not change when slides are reordered),
  `slide_title` (title/ctrTitle placeholder), `body`; a long slide is
  sectioned like a PDF page (`section`, locator `slide{n}-s{k}`).
  Falls back to ppt/slides/slideN.xml in numeric order when the
  presentation part or its rels are unusable.
- Text is read shape by shape from DrawingML: `a:p` paragraphs, `a:br`
  breaks; tables as one line per row with ` | `-joined cells, so a value
  keeps its row and column (DOCX tables currently lose this).
- Speaker notes, reached through the slide's notesSlide relationship, are
  appended to the body under "Speaker notes:" so both BM25 and the
  semantic field see them.
- Skipped: dt/ftr/hdr/sldNum/sldImg placeholders and `a:fld` field text —
  boilerplate repeated on every slide.
- Matching is on local names, so strict-OOXML namespaces read the same.
- Bounds: 32 MiB per part, 256 MiB decompressed per container, 64 MiB of
  extracted text, and MAX_RECORDS_PER_FILE. Hitting any of them sets
  `truncated` (reported, not silent). A deck with no text is junk.

Wiring: Family::Pptx (as_str "pptx", is_document), sniffed from
ppt/presentation.xml in zip_container_kind; dispatch in extract/mod.rs;
SourceAndDocs band in both order.rs band functions; full-read family in
estimate::exact_scan_bytes; whole-file size cap in scan_file. "pptx" is
removed from unsupported_document_advice.

Evidence (rust:latest container, cargo 1.98.1, Linux):
- 7 new extract::pptx tests (order vs part names, numeric fallback,
  titles/tables/notes/placeholder skipping, empty slides and decks,
  sectioning, decompression budget, OPC target resolution) pass; the
  updated sniff test asserts ppt/presentation.xml -> Family::Pptx.
- cargo test -p xerj-autoindex --lib: 1167 passed, 0 failed, 2 ignored.
- cargo clippy -p xerj-autoindex --all-targets -- -D warnings: clean.
- A deck written by python-pptx (real PowerPoint template parts, slides
  reordered in sldIdLst) sniffed as Pptx and extracted 3 records in
  display order with the table rows and speaker notes intact (temporary
  probe test, not committed).

Not covered: a deck saved by PowerPoint itself; an end-to-end
`xerj autoindex` run against a server. Charts, SmartArt and images
contribute no text.

Written by an AI coding agent (Claude Code, Claude Opus 5.5), run and
reviewed by Tom Villani (@thomas-villani).
@cla-bot
cla-bot Bot commented Oct 2, 2026
Copy link
Copy Markdown

Thanks for this contribution — we'd like to merge it.

Before we can, we need a signed Contributor License Agreement from: @thomas-villani

It is a one-time thing per contributor, not per pull request. Read CLA.md, then open a small pull request adding your GitHub username to .contributors — that pull request is your signature, since it is made from your own account.

Once it is merged, comment @cla-bot check here and this check will go green. If you believe you are already covered, comment @cla-bot check and it will re-verify.

… blob

Motivation: under durable preparation (`--no-graph`), `sync_executor`
extracts a sealed snapshot blob (`prepared/00000000`) and carries the
file's own name only in `Sniffed::logical_name`. The PPTX extractor fell
back to `path.file_stem()` for a deck with no title placeholder, so such
a deck was titled "00000000" — the xerj-org#722 failure class that
`extract_as_document_with_name` and the stub name card already guard
against.

Fix: `pptx::extract` takes the logical name, and dispatch passes
`sn.logical_name` (falling back to `path`), as `code.rs` does.

Evidence: new test `an_untitled_deck_is_titled_from_the_logical_name_not_the_blob`
sniffs a deck stored as `00000000` with logical name `decks/kickoff.pptx`
and extracts it through `extract::extract`. With dispatch passing `path`
(the old behaviour) it fails with left: "00000000", right: "kickoff";
with the fix it passes. `cargo test -p xerj-autoindex --lib`: 1170
passed, 0 failed (Linux container); clippy -D warnings and fmt clean.
@cla-bot
cla-bot Bot commented Oct 2, 2026
Copy link
Copy Markdown

Thanks for this contribution — we'd like to merge it.

Before we can, we need a signed Contributor License Agreement from: @thomas-villani

It is a one-time thing per contributor, not per pull request. Read CLA.md, then open a small pull request adding your GitHub username to .contributors — that pull request is your signature, since it is made from your own account.

Once it is merged, comment @cla-bot check here and this check will go green. If you believe you are already covered, comment @cla-bot check and it will re-verify.

@thomas-villani
Copy link
Copy Markdown
Contributor Author

@cla-bot check

@cla-bot
cla-bot Bot commented Oct 2, 2026
Copy link
Copy Markdown

Thanks for this contribution — we'd like to merge it.

Before we can, we need a signed Contributor License Agreement from: @thomas-villani

It is a one-time thing per contributor, not per pull request. Read CLA.md, then open a small pull request adding your GitHub username to .contributors — that pull request is your signature, since it is made from your own account.

Once it is merged, comment @cla-bot check here and this check will go green. If you believe you are already covered, comment @cla-bot check and it will re-verify.

@cla-bot
cla-bot Bot commented Oct 2, 2026
Copy link
Copy Markdown

Re-checking the CLA status for every commit author on this pull request…

@xerj-org
xerj-org merged commit fde1197 into xerj-org:main Oct 3, 2026
21 of 22 checks passed
neoneye pushed a commit to agent-memory-atlas-archive/xerj-org--xerj that referenced this pull request Oct 4, 2026
Version bump rc.80 -> rc.81 (17 workspace crates in Cargo.lock). CHANGELOG
section cites every window PR: xerj-org#1106 xerj-org#1107 xerj-org#1112 xerj-org#1113 xerj-org#1114 xerj-org#1115 xerj-org#1116
xerj-org#1117 xerj-org#1119 xerj-org#1123 xerj-org#1124. ROADMAP rolled: shortlist re-verified live at cut
(four open xerj-org#1091 xerj-org#1092 xerj-org#1094 xerj-org#1100; xerj-org#1093 closed by xerj-org#1112 inside the
window and moves to the CHANGELOG). Landing stamp sweep RC.80 -> RC.81 in
54 files — footer stamps only; historical prose ('since rc.80', 'rc.80
closed that', PR xerj-org#1082 claims in llms.txt/llms-full.txt and the S3/alerting
answers pages) deliberately left at rc.80.
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.

2 participants

0