Skip to content

M2.chart-native: integrate upstream 0.9 and retain chart parts through native saves - #33

Merged
wiothemilo-lang merged 12 commits into
mainfrom
sync/upstream-chart-native-20261021
Oct 21, 2026
Merged

wiothemilo-lang merged 12 commits into
mainfrom
sync/upstream-chart-native-20261021

Conversation

@wiothemilo-lang

@wiothemilo-lang wiothemilo-lang commented Oct 21, 2026 •

Copy link
Copy Markdown
Owner

Imported charts currently lose their retained workbook/drawing parts when saved through the native format. Integrate upstream through 63831cd (0.9.0 and chart persistence storytold#851), resolving the conflicts from #31 on a fork-owned branch while retaining ChartAxis JSON, legacy .slidecraft files, control authentication, Vietnamese UI, opaque graphs and the portable updater.

Native chart metadata also creates a new producer for retained parts. Bound each chart to 256 package parts and 1,024 direct relationships across native save/load, PPTX capture and export preflight. Reject oversized native/API models explicitly; reserve payload and relationship-sidecar slots together during PPTX capture. Index normalized export companion names once to remove the quadratic lookup. Reuse the unique payload list when rewriting relationships so duplicate logical names cannot cause repeated XML parsing or buffered output; normalized names retain first-entry semantics.

Native save now preflights the same combined media/chart item and payload-byte limits and per-entry sizes as load. Manifest JSON streams into its ZIP member under the same entry cap. Recovery refuses snapshots/metadata above its reader limits before replacing either previous member. Pin the reviewed shared Nix workflow revision to make CI inputs reproducible.

Validation:

  • Local native-format library suite: 42 tests passed with one build job; formatting and git diff --check passed.
  • Added scaled aggregate/entry/manifest boundary and linked-only item tests, plus engine recovery refusal/encoded-size/metadata preservation regressions (engine tests run in cloud CI).
  • Added zero-byte/legacy chart cardinality boundaries and legacy native container/flattened axis regressions.
  • Added PPTX tests for capture limits, the relationship-sidecar slot, explicit export rejection in all chart owners and allowed-boundary payload retention.
  • A new PPTX unit regression inspects package buffers before ZIP deduplication for repeated mixed-case payload and companion names at the allowed chart boundary; it runs in cloud CI.
  • Retain upstream ZIP corruption/budget and repeated PPTX → native → PPTX/stale-workbook tests.
  • Full CI and a Windows portable build run on GitHub under the existing disk-saving workflow and must pass on the new head before merge. No live PowerPoint or large resource-exhaustion test is claimed; this does not establish the cause of Crash while inserting video followed by loss of manually saved slides storytold/deckcraft#1092.

Imported chart retention does not create workbooks for new/edited charts (storytold#1047). Upstream authorship is preserved by the merge. Readiness scores remain unchanged.

Summary by CodeRabbit

  • New Features

    • Native presentation files preserve chart package content through edits and repeated save/reopen cycles.
    • Chart data can be updated while retaining unrelated chart components.
    • Chart content is stored in bounded sidecar entries with shared resource budgets.
    • Duplicate chart payloads are consolidated during export.
  • Bug Fixes

    • Improved handling of missing, corrupt, duplicated, or invalid chart content.
    • Oversized chart data and recovery snapshots are rejected safely without replacing valid previous checkpoints.
    • Legacy inline chart data remains readable and migrates when saved.
  • Documentation

    • Updated format, architecture, parity, and roadmap documentation.
  • Chores

    • Updated the package version to 0.9.0.

dylanmtaylor and others added 9 commits October 15, 2026 23:57
* M2.1: preserve chart parts through native saves

Serialize retained chart relationships and payloads in native files.
Add native and headless file-command round-trip regressions.

Contribution on behalf of @MMexicann.

* Format: bound opaque chart parts as native ZIP entries

Address maintainer feedback on the existing PR. Preserve upstream work and document tested scope and validation limits.

* Model: track transient native chart part entries

Address maintainer feedback on the existing PR. Preserve upstream work and document tested scope and validation limits.

* PPTX: initialize native chart entry metadata

Address maintainer feedback on the existing PR. Preserve upstream work and document tested scope and validation limits.

* Engine: adapt chart native roundtrip fixtures

Address maintainer feedback on the existing PR. Preserve upstream work and document tested scope and validation limits.

* Docs: describe bounded chart sidecars and validation

Address maintainer feedback on the existing PR. Preserve upstream work and document tested scope and validation limits.

* Roadmap: record bounded chart persistence evidence

Address maintainer feedback on the existing PR. Preserve upstream work and document tested scope and validation limits.

---------

Co-authored-by: skylar taylor-barrick <hi@skylar.cc>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…erabbit-badges

docs: add SonarCloud and CodeRabbit badges to README
Adds .coderabbit.yaml so CodeRabbit no longer reviews or comments on PRs opened by dependabot[bot].

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…flow

ci: switch to shared nix workflow from craft-common-actions
@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: wiothemilo-lang/deckcraft/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f77b9df5-c99f-4b11-88cf-8236a31ca6d6
📥 Commits

Reviewing files that changed from the base of the PR and between 310b500 and 3061043.

📒 Files selected for processing: 10
  • .github/workflows/nix.yml
  • ROADMAP.md
  • crates/engine/src/recovery.rs
  • crates/format/src/chart_parts.rs
  • crates/format/src/chart_parts_tests.rs
  • crates/format/src/lib.rs
  • docs/architecture.md
  • docs/file-format-parity.md
  • docs/gaps.md
  • docs/roadmap.md
🚧 Files skipped from review as they are similar to previous changes: 5
  • docs/gaps.md
  • ROADMAP.md
  • docs/roadmap.md
  • docs/architecture.md
  • docs/file-format-parity.md

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

📝 Walkthrough

The change adds bounded native ZIP sidecars for chart package bytes, restores them under shared budgets, enforces chart part and relationship limits during PPTX capture and export, and tests chart round trips. It also adds recovery size checks and updates review settings, CI, version, and project records.

Changes: Native Chart Sidecar Persistence

Layer / File(s) Summary
Chart metadata and payload limits
crates/model/src/chart.rs, crates/pptx/src/read/chart.rs
Chart metadata supports serialized retained parts and native-entry references. PPTX capture applies shared part and relationship limits.
Native ZIP save, load, and validation
crates/format/src/chart_parts.rs, crates/format/src/lib.rs
Native saves write indexed chart sidecars and bounded manifests. Loads validate and restore entries under shared budgets.
Native sidecar and budget tests
crates/format/src/chart_parts_tests.rs
Tests cover legacy compatibility, malformed and duplicate references, corruption, cardinality limits, shared budgets, and bounded entries.
PPTX capture and export limits
crates/pptx/src/write/chart.rs, crates/pptx/src/write/mod.rs
PPTX export validates chart limits, indexes normalized names, and emits unique payloads and relationship sidecars once.
PPTX limit and deduplication tests
crates/pptx/tests/chart_embed.rs, crates/pptx/src/opc.rs
Tests cover owner traversal, boundary limits, relationship capture, and normalized duplicate names.
Round-trip coverage and format records
crates/engine/tests/chart_native.rs, crates/format/src/lib.rs, docs/*, ROADMAP.md
Round-trip tests verify retained chart parts and stale-part removal after edits. Documentation and roadmap records describe the format and limits.

Recovery and Repository Updates

Layer / File(s) Summary
Recovery checkpoint limits
crates/engine/src/recovery.rs
Recovery saves reject oversized snapshots and metadata before replacing checkpoint files. Tests verify preservation of the previous checkpoint.
Review, CI, and package version settings
.coderabbit.yaml, .github/workflows/nix.yml, Cargo.toml
Automatic reviews ignore Dependabot pull requests. The Nix evaluation job uses a pinned reusable workflow. The workspace version changes to 0.9.0.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant PPTXReader
  participant ChartModel
  participant NativeFormat
  participant NativeZIP
  participant PPTXExporter
  PPTXReader->>ChartModel: capture chart parts and relationships within limits
  ChartModel->>NativeFormat: separate retained chart payloads
  NativeFormat->>NativeZIP: write indexed chart sidecars
  NativeZIP->>NativeFormat: provide sidecar entries during reopen
  NativeFormat->>ChartModel: restore chart payloads under shared budgets
  ChartModel->>PPTXExporter: export retained chart parts
Loading

Suggested reviewers: echelon, nikitkara, dylanmtaylor

Merge Risk: ⚪ Minimal · up to 30610

No merge-blocking issue was identified. Complete the required CI and Windows portable-build checks before merging.

Security architecture risk: 🔵 Low · up to 30610

The new file data is bounded and uses controlled package names. No introduced security flaw was established in the examined paths, but external-link handling and damaged-file recovery retain some uncertainty.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The examined attacker-controlled inputs are native manifest fields and retained ZIP bytes. They reach in-process restoration and, upon export, generated PPTX parts and relationships. Native restoration treats retained package names as metadata and reads only canonical chart-parts references; export can carry external targets into the resulting document.

Trust Boundaries and Controls

  • observed — Native restoration rejects noncanonical references, repeated references and simultaneous inline/native payloads. Missing members are reported as damage; present corrupt members abort loading. The bounded reader checks declared size and limits actual decompression, preventing later chart members from reusing the budget after a chart decode failure.
  • observed — PPTX export restricts retained internal parts to designated folders, rejects dot segments, generates fresh package names and drops internal relationships without retained targets. Relationship and content-type values pass through XML attribute escaping, providing counterevidence to XML injection from native metadata even though it does not pass through the PPTX capture string filter.

Resilience and Maintainability Implications

  • observed — Checkpoint replacement remains atomic only per file: the document is renamed before its metadata. An interruption between those operations can leave mixed generations. This ordering predates the PR; the new pre-write checks improve rejection handling but do not establish pair-level transactionality or concurrent-save safety.
  • observed — Recovery reopening still uses load(), which discards damage reports. Missing chart members consequently become empty parts without a recovery damage warning. The loader choice predates this PR for media; chart sidecars now inherit it. Ordinary file opening instead uses damage information to avoid retaining the original save path.

Hardening Proposals

  • proposed — Define an explicit external-link preservation policy for untrusted native files, and consider damage-aware recovery reopening before allowing a damaged recovered document to replace an original file or checkpoint. These are hardening proposals, not verified security findings.
Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title accurately and clearly summarizes the two main changes: upstream 0.9 integration and chart-part retention across native saves.
Docstring Coverage Passed Docstring coverage is 83.58% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 67 functions across 11 files. (6 skipped: 6…
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 83.58% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 67 functions across 11 files. (6 skipped: 6 unsupported.)

✨ 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

Comment @coderabbitai help to get the list of available commands.

@wiothemilo-lang
wiothemilo-lang merged commit b184317 into main Oct 21, 2026
7 checks passed
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