Skip to content

.ai import: the editing data reader warns about each image it can't read - #2937

Merged
bflatastic merged 1 commit into
storytold:mainfrom
dotCooCoo:fix/ai-image-left-out-warns
Oct 18, 2026
Merged

bflatastic merged 1 commit into
storytold:mainfrom
dotCooCoo:fix/ai-image-left-out-warns

Conversation

@dotCooCoo

@dotCooCoo dotCooCoo commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

What and why

The reader of a .ai's editing data leaves out an image it can't read. When the image's size or bit depth is out of
range, it adds the warning "an image VectorCraft can't read was left out". On main at 299a4b3 it left the image out
with no warning in four other cases: the XI operands hold no matrix, they hold fewer than 11 numbers, the matrix has
other than six numbers, or the matrix maps the image onto a line or a point. A document read from such editing data
lacked the image, and its warnings did not mention it.

Each of those exits in crates/eps/src/import/ai/read.rs (image_from and add_raster) now adds the same warning,
as does the exit where the decoded pixels don't make an image. The reader already notes every placed file it can't
read.

How it was tested

Four tests in crates/eps/src/import/ai/tests.rs, one for each case, check that the image is left out and that the
warning is listed once. All four fail on main with no warning.

Targeted checks: cargo fmt --all -- --check, cargo clippy -p vectorcraft-eps --all-targets -- -D warnings,
cargo test -p vectorcraft-eps (262 passed), and cargo xtask brands, layers and assets.

On Windows 11 (x86-64) with rustc 1.99.0, on the branch merged with main at cdba0aa:
CRAFT_FONTS_DIR=<craft-fonts checkout> cargo xtask ci passes all 10 steps (fmt, clippy, test, no-bundled-fonts,
pdf-deps, assets, brands, cursors, layers, wasm), with 8,254 tests passed, 0 failed and 12 ignored.

git merge-tree reports no conflicts with main at cdba0aa, or with #1772 and #2753, which also change
crates/eps/src/import/ai/. #2038, #2403, #2532 and #2592 also change read.rs; each merges with this branch in it and
conflicts only in the files where it already conflicts with main.

Checklist

  • cargo xtask ci passes (fmt, clippy, tests, assets, brands, layers, wasm).
  • No panics in shipped code: no unwrap(), expect(), panic!, unreachable!, todo! or
    unimplemented! outside tests, and no unchecked indexing on data from files, parameters or
    messages. Errors are returned as Result and shown to the user
    (why and how).
  • Clean-room: nothing copied from Adobe products or GPL/AGPL code (AGENTS.md).
  • Every new asset has a row in ASSETS.md.

Summary by CodeRabbit

  • Bug Fixes
    • Unreadable images are now omitted with a warning when image data or transformation details are missing or invalid.
    • Existing handling for short image data and invalid transforms is unchanged.
  • Tests
    • Added coverage for unreadable images with missing or incomplete data and zero-area transformations.

@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 31fc208a-6e53-4a47-a553-d3abbd065fbc
📥 Commits

Reviewing files that changed from the base of the PR and between bbf8794 and ba32ef5.

📒 Files selected for processing: 2
  • crates/eps/src/import/ai/read.rs
  • crates/eps/src/import/ai/tests.rs
+--------------------------------------------------------------------------+
| Your code is like a magic trick: now you see it... now it's `undefined`. |
+--------------------------------------------------------------------------+
  \
   \     /)/)
        ( '')
        /  |
      o(___)

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 112f470e-80c9-433e-b05c-858b802f5a4f
📥 Commits

Reviewing files that changed from the base of the PR and between cdba0aa and bbf8794.

📒 Files selected for processing: 2
  • crates/eps/src/import/ai/read.rs
  • crates/eps/src/import/ai/tests.rs

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

📝 Walkthrough

The AI importer now adds an unreadable-image warning when it skips images in several cases. Tests verify the images are omitted and exactly one warning is reported.

Changes: AI image import warnings

Layer / File(s) Summary
Warn on skipped images
crates/eps/src/import/ai/read.rs, crates/eps/src/import/ai/tests.rs
The importer warns when image operands or transform matrices are missing or invalid, RGBA image construction fails, or a transform is non-finite or nearly singular. Tests cover missing operands, short matrices, and zero-area matrices, and verify image omission with exactly one warning.

Priority: ⬇️ Low

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

Change: Bug fix

Suggested reviewers: bflatastic

Merge Risk: ⚪ Minimal · up to bbf87

Unreadable AI images are now reported as omitted, while repeated identical warnings remain consolidated. No material merge-readiness risk is identified.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: warning when the AI editing-data reader cannot read an image.
Description check Passed The description includes the required What and why, How it was tested, and Checklist sections. It explains the affected failure cases, added tests, validation commands, and checklist status.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 2 files.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • 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.

An image in a .ai's editing data whose operands had no matrix, fewer
than 11 numbers, or a matrix of other than six numbers was left out
with no warning. So was one whose matrix maps it onto a line or a
point. The reader's warnings did not mention such an image, while the
reader warned "an image VectorCraft can't read was left out" for an
image whose size or bit depth it can't use.

Each of those exits now adds the same warning, as does the one where
the decoded pixels don't make an image.
@bflatastic
bflatastic force-pushed the fix/ai-image-left-out-warns branch from bbf8794 to ba32ef5 Compare October 18, 2026 17:09
@bflatastic
bflatastic merged commit 1f2e90a into storytold:main Oct 18, 2026
2 of 5 checks passed
@bflatastic

Copy link
Copy Markdown
Member

Thanks @dotCooCoo, merged. It went through the full gate (fmt, clippy, tests, layers, wasm) in a batch with the other PRs landed today.

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