Skip to content

[codex] Add PresentationDocument typed representation#1023

Draft
mimeding wants to merge 1 commit into
osaurus-ai:mainfrom
mimeding:codex/presentation-document
Draft

[codex] Add PresentationDocument typed representation#1023
mimeding wants to merge 1 commit into
osaurus-ai:mainfrom
mimeding:codex/presentation-document

Conversation

@mimeding
Copy link
Copy Markdown
Contributor

@mimeding mimeding commented May 4, 2026

Business rationale

PPTX files are a core business-document format for strategy, finance, sales, and planning workflows. Osaurus needs a typed presentation representation before later high-fidelity conversion, analysis, and agent tooling can preserve slide structure and speaker notes instead of flattening decks into undifferentiated text.

Coding rationale

This adds a narrow Sendable value model for presentation documents plus a read-only PPTX adapter that extracts slide text and speaker notes from selected OpenXML zip entries. The adapter stays inside the existing DocumentFormatAdapter API, honors size limits, and returns a StructuredDocument with both typed representation and plain-text fallback.

What changed

  • Added PresentationDocument value types with slide, element, speaker-note, theme, and SourceProvenance markers.
  • Added PPTXAdapter for .pptx/PPTX UTI handling, selected zip-entry reads, OpenXML text extraction, size-limit checks, and corrupt zip/read error handling.
  • Added focused tests that generate tiny PPTX fixtures at runtime and cover canHandle, slide text extraction, speaker notes, size-limit refusal, and corrupt zip failure.

Validation

  • PASS: git fetch origin && git rebase origin/main
  • PASS: swift build --package-path Packages/OsaurusCore
  • PASS: swift build -c release --package-path Packages/OsaurusCore
  • PARTIAL: swift test --package-path Packages/OsaurusCore failed twice in unrelated ModelPickerItemCacheTests.notificationBurst_doesNotTransientlyEmptyItems (final.count dropped during full-suite parallel run). The same test passes in isolation with swift test --package-path Packages/OsaurusCore --filter ModelPickerItemCacheTests/notificationBurst_doesNotTransientlyEmptyItems.
  • PASS: swift test --package-path Packages/OsaurusCore --filter PPTXAdapter
  • PASS: xcrun swift-format lint --strict Packages/OsaurusCore/Models/Documents/PresentationDocument.swift Packages/OsaurusCore/Services/Documents/PPTXAdapter.swift Packages/OsaurusCore/Tests/Documents/PPTXAdapterTests.swift
  • PASS: swiftlint --strict --config .swiftlint.yml --no-cache --use-script-input-files for touched non-test Swift files; repo SwiftLint config excludes Packages/OsaurusCore/Tests, so PPTXAdapterTests.swift was also checked with a temporary no-exclude config matching the repo's disabled rules.
  • PASS: git diff --check && git diff --check origin/main...HEAD

Non-scope

  • No PPTX writer/emitter.
  • No media, chart, table, layout, theme, relationship graph, or OOXML AST extraction beyond stable placeholders in the typed model.
  • No built-in adapter bootstrap registration because DocumentAdaptersBootstrap.registerBuiltIns() is not present on current origin/main; this PR avoids inventing a parallel registry.
  • No new third-party dependencies.

Residual risks

  • Speaker notes are associated by notesSlideN.xml numbering rather than slide relationship traversal.
  • Text extraction is intentionally plain paragraph text only and may omit rich text semantics, hidden text distinctions, comments, and non-textual content.
  • Full-suite validation is blocked by an unrelated ModelPickerItemCacheTests race that reproduces only in the full parallel suite and passes in isolation.

Business rationale:\nPPTX files are a core business document format, and Osaurus needs a typed presentation representation before later high-fidelity conversion, analysis, and tool workflows can preserve slide structure and speaker notes. This slice gives downstream document flows a narrow, traceable presentation model instead of relying only on plain text.\n\nCoding rationale:\nAdd Sendable value types for a presentation read model with source provenance markers, plus a read-only PPTX adapter that enforces the existing size-limit API and extracts only slide text and speaker notes from selected OpenXML zip entries. Tests generate tiny PPTX fixtures at runtime to avoid binary fixture churn and cover canHandle, text, notes, size limits, and corrupt zip failures.
@mimeding
Copy link
Copy Markdown
Contributor Author

mimeding commented May 4, 2026

CI note: current test-core red is the shared ModelPickerItemCache / RemoteProviderManagerRefreshTests singleton race, not this branch's implementation. PPTXAdapter/PresentationDocument tests are passing in the failed run. The race is isolated and fixed in #1025; after that lands, this branch should just need a rebase/rerun.

@mimeding
Copy link
Copy Markdown
Contributor Author

mimeding commented May 4, 2026

@tpae PR-specific CI note / next step:

This branch is failing test-core because of the shared provider/model-picker race currently present on main, not because of the PresentationDocument/PPTX adapter work. The PresentationDocument/PPTX-focused tests passed in the failed run; the red tests are the provider/model-picker cluster.

Required next step: merge the green base fix in #1025 first, then I will rebase/rerun this PR and update its draft/readiness status once CI is meaningful again.

Why: this PR should not be debugged as a presentation-file failure until the known red base is fixed.

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