Skip to content

fix: extract pptx text in presentation order - #14876

Merged
iamwhatever merged 1 commit into
mainfrom
fix/pptx-presentation-order-inrepo
Sep 29, 2026
Merged

iamwhatever merged 1 commit into
mainfrom
fix/pptx-presentation-order-inrepo

Conversation

@iamwhatever

@iamwhatever iamwhatever commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: PPTX text previews come out in the deck's real presentation order, not ZIP filename order.

doc_parser.extract_text sorted ppt/slides/slideN.xml by the numeric N in the
filename. A deck that has been reordered keeps its old filename numbers, so a
reordered presentation was previewed in the wrong (stale filename) order.

Why it matters

Users pasting or previewing a reordered .pptx saw slides in the wrong sequence,
which misrepresents the document. Any downstream consumer of the preview text
(search, summaries) inherited the wrong order.

Not a goal

  • Does not change extraction for non-PPTX office formats.
  • Does not add new slide-content parsing beyond what is needed to read order.

What changed (motivation → approach → change)

  • Symptom: reordered decks previewed in filename order.
  • Root cause: slide order was derived from the slideN.xml filename number.
  • Change: read presentation order from ppt/presentation.xml's p:sldIdLst,
    resolved through the deck's internal slide relationships, so ZIP filenames no
    longer determine positions. Blank/unresolved slides keep their positions,
    unreferenced parts are omitted, each resolved part is extracted at most once,
    and the text budget stops in presentation order. Ordering metadata uses the
    same bounded ZIP reads and hardened XML parser as slide content. Containers
    without ppt/presentation.xml retain numeric-filename best-effort extraction;
    a present-but-unreadable manifest does not fall back to it.

Backwards compatibility

Compatible: extraction output is reordered to match true presentation order; no
input previously accepted is rejected, and decks without an ordering manifest
retain the prior numeric-filename behavior.

Tests

test/test_doc_parser_pptx_order.py (new): reordered decks use presentation
positions (with and without a pre-opened archive), relationship targets need not
have numeric filenames, unreferenced slide parts are excluded, a blank slide
keeps the following presentation number, and the budget keeps the actual first
slide without reading later slides. 19 cases pass locally against fresh main.

Manual verification

N/A — unit coverage sufficient; the change is a pure text-extraction reordering
exercised deterministically by the new tests.

Related Issues

Supersedes #9235 (in-repo replacement of the fork PR by @leonlaiyc, rebased onto
current main; authorship preserved, credited via Co-authored-by).

Pattern harvest

Not generalizable: this is a single ordering-source bug (filename order vs
declared presentation order) specific to the PPTX branch of doc_parser.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@iamwhatever
iamwhatever requested a review from a team as a code owner September 29, 2026 00:16
@iamwhatever iamwhatever added the drive-to-green PR claimed by drive-to-green pipeline label Sep 29, 2026
@iamwhatever iamwhatever self-assigned this Sep 29, 2026
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Sep 29, 2026
@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — ✅ PASS

Design-level review of 355bdf0fe7456c44ef894880a0d57551dadf192b — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Verify against one real PowerPoint-saved reordered deck; every test fixture here is hand-built minimal XML, never a genuine Office container.

[DESIGN-REVIEWED] 355bdf0

Description read

[DESCRIPTION-READ] 330f96e2d04ccf3a0e88b9daa2a4c510e21a81c56a291aee48d52e72921bc395

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — ✅ PASS

Premise-level review of 355bdf0fe7456c44ef894880a0d57551dadf192b — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: PASS

All items justified; no real PowerPoint-saved deck is in the tests — verify one genuinely reordered .pptx previews correctly, since every fixture is synthetic.

What this change ships

Inventory (8 items) — 8 justified

Intent: FIX — PPTX previews should show slides in the deck's real presentation order, not stale ZIP filename order (supersedes #9235; the reordered-deck test fails on base).

  1. Reordered decks now preview in true presentation order — justified
  2. Slide N labels are presentation positions, not filename numbers — justified
  3. Slide parts the presentation doesn't reference are omitted from previews — justified
  4. A deck whose ordering manifest is present but unreadable now previews empty instead of filename order — justified
  5. Decks with no ppt/presentation.xml keep the prior filename-order behavior — justified
  6. A part referenced repeatedly by malformed metadata is decompressed and shown once — justified
  7. Decks whose slide parts lack numeric slideN.xml names now extract (resolved via relationships) — justified
  8. Owning spec paragraph updated in the same commit (learn-cron-dashboard.md) — justified

Consumer counts: no new public surface; _pptx_slide_order is a private helper with its one caller (_extract_pptx_slides). Existing consumers of extract_text/extract_slides: 2 (messaging/attachments.py, dashboard/handlers/files.py). Siblings of the root cause: 0 — docx reads the single word/document.xml and PDF is a byte scan, so no other filename-derived ordering exists (grepped sorted/_SLIDE_RE in doc_parser.py).

[FIRST-PRINCIPLES-REVIEWED] 355bdf0

Description read

[DESCRIPTION-READ] c6ef086e3e98625287ff25bc3658f37078a02123a338136fccc23e4de7b0d3b8

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of 355bdf0fe7456c44ef894880a0d57551dadf192b and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 355bdf0

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 355bdf0fe7456c44ef894880a0d57551dadf192b: <one-sentence reason>

@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5 Review — ✅ no blocking findings

Reviewed 355bdf0fe7456c44ef894880a0d57551dadf192b — this comment is updated in place on each push.

Review details

Two advisory findings; nothing blocks the merge.

FINDING — src/kiro_crew/doc_parser.py:360 — target in names is now the only admission test for a resolved slide target, so a slide-typed relationship pointing at any archive member (e.g. Target="media/image1.png") is returned as a slide, _xml_fromstring raises ParseError on the non-XML bytes, and the exception escapes _extract_pptx_slides and discards every slide already collected — the deck previews as "" and _grep_doc_segments reports it as whole=True ("searched, no matches") where pre-PR the _SLIDE_RE filter yielded the readable slides → Fix: require target.startswith("ppt/slides/") alongside target in names.

FINDING — src/kiro_crew/dashboard/handlers/files.py:3665 — the PR redefines the slide index as the p:sldIdLst position, but _cap_slides still documents "Slide numbers are the deck's own (slideN.xml), so a gap tells the reader a slide carried no text", as do website/src/components/FileRenderers.tsx:538 and docs/system-specs/modules/learn-cron-dashboard.md:2480 ("index is the deck's own slide number"), so for any reordered deck three pieces of prose assert a provenance the code no longer has and a gap now also means blank/external/unresolved/repeat → Fix: update those three statements to say the index is the presentation position from p:sldIdLst and what a gap now means.

[OPUS-REVIEWED] 355bdf0

Verdict parsed from the review's SHA-scoped output markers for commit 355bdf0fe7456c44ef894880a0d57551dadf192b.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 355bdf0fe7456c44ef894880a0d57551dadf192b: <one-sentence reason>

@iamwhatever
iamwhatever force-pushed the fix/pptx-presentation-order-inrepo branch from cc5f7d3 to bed0a09 Compare September 29, 2026 00:54
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 29, 2026
@iamwhatever iamwhatever removed the readiness: action required A blocking check or review needs attention label Sep 29, 2026
@github-actions github-actions Bot added the readiness: action required A blocking check or review needs attention label Sep 29, 2026
Co-authored-by: leonlaiyc <276034861+leonlaiyc@users.noreply.github.com>
@iamwhatever
iamwhatever force-pushed the fix/pptx-presentation-order-inrepo branch from bed0a09 to 355bdf0 Compare September 29, 2026 06:06
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 29, 2026
@iamwhatever
iamwhatever merged commit d7919d3 into main Sep 29, 2026
90 of 91 checks passed
@iamwhatever
iamwhatever deleted the fix/pptx-presentation-order-inrepo branch September 29, 2026 06:09
@github-actions github-actions Bot removed the readiness: checking Automated validation is still running label Sep 29, 2026
@dwu96 dwu96 removed the drive-to-green PR claimed by drive-to-green pipeline label Sep 29, 2026
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.

4 participants