Skip to content

PPTX export: index animation targets, cache build roles, serialize run properties once per text run - #1788

Merged
dylanmtaylor merged 2 commits into
mainfrom
fix/sec-pptx-export-timing
Nov 4, 2026
Merged

dylanmtaylor merged 2 commits into
mainfrom
fix/sec-pptx-export-timing

Conversation

@dylanmtaylor

@dylanmtaylor dylanmtaylor commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

What was wrong: the timing exporter searched the shape tree for each animation; by-paragraph builds recomputed paragraph roles per animation and expanded into an effect per paragraph with no overall limit; run_text serialized the same rPr again for every line break and piece of one text run.

Changed: shapes are indexed by id once per slide (first in document order, as find_shape returned); roles are cached per shape; a slide writes at most 100,000 effects (the rest are logged and left out; the existing 10,000-animation cap stays); run_text builds its rPr once and copies the string.

Blast radius: crates/pptx write/timing.rs and write/dml.rs. Behavior change: slides with more than 100,000 effects (only reachable from hostile input) are truncated. The paragraph() path for separate Break runs is unchanged (each carries its own props).

Checks run: cargo fmt --check, clippy -p deckcraft-pptx --all-targets -D warnings, cargo test -p deckcraft-pptx (all pass). Not run: new hostile-size tests, workspace tests.

Summary by CodeRabbit

  • Performance
    • Text-heavy presentations and slides with many animations are processed more efficiently.
  • Reliability
    • Animation processing is bounded: slides with more than 10,000 animations are limited to the first 10,000, and processing stops after 100,000 generated effects.
    • Animations targeting shapes nested more than 64 levels deep may not be included.

…, serialize run properties once per text run
@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Walkthrough

The changes cache serialized text-run properties and update timing serialization to index shapes, cache paragraph build roles, and limit generated animation effects.

Changes: Text run serialization

Layer / File(s) Summary
Reuse serialized run properties
crates/pptx/src/write/dml.rs
run_text serializes run properties once and reuses the XML for each text piece and line break.

Timing serialization

Layer / File(s) Summary
Index shapes and bound effects
crates/pptx/src/write/timing.rs
Timing serialization builds a shape-ID index, caches paragraph build roles, and stops beyond depth 64 when indexing shapes. It retains the 10,000-animation input limit and stops generating effects at 100,000.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: echelon

Merge Risk: Minimal · up to c531b

No actionable merge-blocking risk is established in the reviewed changes.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and specifically summarizes the main changes: indexing animation targets, caching build roles, and serializing run properties once per text run.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 3 functions across 2 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between fba5e8c and c531b64.

Files selected for processing: 1
  • crates/pptx/src/write/timing.rs

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 2 remain after this review.

@coderabbitai coderabbitai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Fix comments: Fix CodeRabbit comments on this PR

Comment thread crates/pptx/src/write/timing.rs Resolved
@dylanmtaylor
dylanmtaylor merged commit 42108d0 into main Nov 4, 2026
9 of 10 checks passed
@dylanmtaylor
dylanmtaylor deleted the fix/sec-pptx-export-timing branch November 4, 2026 00:53
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