Skip to content

psd: use shared borrowed descriptor and block writers - #3949

Merged
dylanmtaylor merged 8 commits into
storytold:mainfrom
FredApps:fix/786-psd-tysh-writer-adapter
Nov 19, 2026
Merged

dylanmtaylor merged 8 commits into
storytold:mainfrom
FredApps:fix/786-psd-tysh-writer-adapter

Conversation

@FredApps

@FredApps FredApps commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Scope

Continues storytold/craft-libs#786 and storytold/craft-libs#778 with shared borrowed, iterative descriptor writing and exact-byte lfx2, SoCo, SoLd and TySh payload framing. Keeps app descriptor construction, RGB scaling, text/newline policy, EngineData, outer framing and public signatures unchanged. Preserves current main's EXR export work and removes the now-unused crate-private helper/import.

Updated against storytold/effectcraft main (13e6e6c6) and pinned craft-psd and craft-svg to storytold/craft-libs main at 08da5e1486ee640de1d2cccd8fe8dd32b1d3b62c (includes merged storytold/craft-libs#2338).

Validation

Local checks on c5c1f48f:

  • cargo fmt --check: passed
  • cargo check --workspace --locked: passed
  • cargo clippy -p effectcraft-psd -p effectcraft-svg --all-targets --locked -- -D warnings: passed
  • cargo xtask pdf-deps & cargo xtask lock-patches: passed
  • cargo test --locked -p effectcraft-psd: 102 passed, 0 failed
  • cargo test --locked -p effectcraft-svg -- --test-threads=1: 83 passed, 0 failed

Summary by CodeRabbit

  • Bug Fixes
    • Improved preservation of Photoshop document data when saving and reopening files, including layer effects, solid colors, smart-object transforms, and text layers.
    • Better handling of descriptor details such as item ordering, duplicate keys, Unicode text, floating-point values, and optional warp data.

@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The PSD crate now uses borrowed descriptor views and craft-psd helpers to serialize descriptors and layer-block payloads. Tests check exact byte encodings and verify that selected payloads survive PSD write/read round trips.

Changes: PSD serialization

Layer / File(s) Summary
Borrowed descriptor serialization
Cargo.toml, crates/psd/src/descriptor.rs
The pinned craft-psd and craft-svg revisions are updated. Descriptor values map to borrowed views and serialize through craft_psd::descriptor::borrowed::append_descriptor. Tests check wire encodings, reference fields, ordering, and borrowing.
Layer-block serialization
crates/psd/src/write.rs, crates/psd/src/tests.rs, crates/psd/src/tests/descriptor_framing.rs
Smart-object, text-layer, effects, and solid-color blocks delegate payload serialization to craft-psd helpers. Framing tests check literal bytes and PSD write/read round trips.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Refactor

Suggested reviewers: echelon, dylanmtaylor, vangel76

Merge Risk: Minimal · up to c5c1f

This change moves PSD descriptor and layer-block serialization onto shared helpers, with byte-level tests meant to keep the output format the same. No concrete merge-blocking risk was found. Final hosted validation of the dependency pin was reported as still running, so confirm it passes before merging.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "psd: use shared borrowed descriptor and block writers" matches the main change. The PSD writer now uses craft_psd's borrowed descriptor views, appender, and tagged-data block helpers in pla…
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.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title "psd: use shared borrowed descriptor and block writers" matches the main change. The PSD writer now uses craft_psd's borrowed descriptor views, appender, and tagged-data block helpers in place of the local recursive writer and binary assembly. The title is short, specific, and names the primary change. The summary and objectives both describe this same change.

Finishing Touches

Generate unit tests (beta)

  • 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 13e6e6c and c5c1f48.

Files ignored due to path filters: 1

  • Cargo.lock is excluded by !**/*.lock
Files selected for processing: 5

  • Cargo.toml
  • crates/psd/src/descriptor.rs
  • crates/psd/src/tests.rs
  • crates/psd/src/tests/descriptor_framing.rs
  • crates/psd/src/write.rs

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

@dylanmtaylor
dylanmtaylor marked this pull request as ready for review November 19, 2026 20:18
@dylanmtaylor
dylanmtaylor merged commit 7be2b0d into storytold:main Nov 19, 2026
11 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.

2 participants