Files
bd632e7eb3 Layered TIFF: open and save Photoshop layer data in TIFF files, in either byte order (part of #215) (#672)
* Layered TIFF: open and save Photoshop layer data in TIFF files, in either byte order (part of #215)

Photoshop keeps a layered TIFF's layers in two private tags: 37724 (ImageSourceData, the same
layer section a PSD has) and 34377 (the image resources). PhotoCraft now reads and writes both,
so a TIFF opens with its groups, masks, layer styles, type, shapes, smart objects and adjustment
layers exactly as the PSD path would, and saves them back.

* photocraft-psd: a `tiff` module with `ImageSourceData` (parse/write, PSD- and PSB-sized),
  the 34377 resource helpers, and a field-by-field byte-order transcoder. In Intel-order TIFFs
  Photoshop byte-swaps the whole block structure (reversed keys, little-endian integers and
  doubles) while pixel samples stay big-endian; the transcoder knows the layer-info structure,
  masks, blending ranges and every block photocraft-io maps (descriptors, TySh, lrFX, the
  binary adjustments, paths, patterns, filter effects, metadata settings, linked layers,
  annotations...), recognizes descriptor-shaped unknown blocks, and drops the rest with a
  warning instead of passing byte-swapped data to other readers. The reader gained an optional
  little-endian mode. 23 unit tests; a fuzz target in the CI matrix.
* photocraft-codecs: the two tags travel as opaque bytes on `Metadata`, read by a
  bounds-checked walk of IFD0 (classic and BigTIFF, both byte orders) and written back as
  BYTE / UNDEFINED tags. `tiff_writes_little_endian()` tells which order the encoder produces.
* photocraft-io: `tiff_layers` rebuilds a PSD model from the TIFF's pixels plus the tags on
  import, and on export runs the PSD exporter (new `merged_matte` / `merged_compression`
  options), interleaves its merged planes for the TIFF image and stores the layer section in
  the encoder's byte order. `ExportOptions.tiff_layers` (default on). Lab and Multichannel
  documents save flat; extra alpha channels are not written (one transparency sample).
* UI: the TIFF Options prompt ("Including layers will increase file size." / "Discard Layers
  and Save a Copy" / "Don't show again") behind Preferences > File Handling > Ask Before
  Saving Layered TIFF Files; `ExportSettings.tiff_layers`; catalogs updated.
* Tests: io round trips at 8/16/32 bits in Gray/RGB/CMYK, equivalence with the PSD path, every
  TIFF compression, the flat fall-backs, malformed input, and files written by psdtags in both
  byte orders (fixtures from scripts/layered_tiff_fixtures.py); a corpus test (feature
  `corpus`) writes every corpus PSD as a layered TIFF and compares the result with the PSD
  round trip (700 files, 0 differences, 0 crashes). Codecs tests cover the tag walk on
  hand-made files.
* Scorecard FILE-215-7 done, BUG-204-3 partial; README and book updated.

Co-Authored-By: Claude Mythos 5.1 <[email protected]>

* Layered TIFF: de and pt-br strings; neutral wording in the psd tiff docs

The four psdtags fixtures stay out of the repository (no binary test data here): the
generator now writes them to the gitignored corpus/layered-tiff/, and the tests that read
them skip with a message when absent.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Regenerate docs/scorecard.md

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: leon <[email protected]>
Co-authored-by: Claude Mythos 5.1 <[email protected]>
Co-authored-by: Brandon Thomas <[email protected]>
2026-10-07 17:10:35 -04:00

232 lines
8.0 KiB
TOML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Scorecard checklist: open bugs (#203–#208).
# Each item: id, short target, status (done | partial | missing), issue, note (evidence).
# Statuses must be true on main. BUG-203 verified against 47f9306 on 2026-10-07; the rest
# against 4b53f62 on 2026-10-05.
area = "bugs"
title = "Open bugs"
order = 9
[[item]]
id = "BUG-203-1"
target = "Every document write goes through one atomic_write (temp, fsync, rename)"
status = "done"
issue = 203
note = "photocraft_format::atomic_write (format/src/atomic.rs, #230/8227071); every write site routes through it: engine file_cmds.rs write_file and preset_store.rs, automation files.rs/headless.rs/workspace.rs, app services.rs write_atomic, format store.rs and autosave.rs"
[[item]]
id = "BUG-203-2"
target = "Temp file in the same dir, sync_all, rename over target, fsync dir on Unix"
status = "done"
issue = 203
note = "atomic.rs: temp_name in the same dir, create_new + write_all + sync_all, Unix directory fsync after the rename"
[[item]]
id = "BUG-203-3"
target = "Windows: retry the rename with backoff on PermissionDenied"
status = "done"
issue = 203
note = "atomic.rs RenameRetry::platform(): seven retries from 10 ms on Windows; retry_rename is shared with automation's cap-std workspace write"
[[item]]
id = "BUG-203-4"
target = "Unwritable directory errors clearly, never falls back to writing in place"
status = "done"
issue = 203
note = "atomic.rs maps read-only dir, disk-full and cross-device rename errors to messages that say the original was not changed; there is no in-place fallback path"
[[item]]
id = "BUG-203-5"
target = "On any failure the original file is untouched and the temp file removed"
status = "done"
issue = 203
note = "atomic.rs removes the temp file on every failure; tests assert the original bytes survive write and rename failures"
[[item]]
id = "BUG-203-6"
target = "Failure-injection tests: mid-write, rename and read-only dir errors keep original bytes"
status = "done"
issue = 203
note = "format/src/atomic/tests.rs: Faulty AtomicFs injects mid-write StorageFull, rename failure and a read-only dir; locked-target retries, symlink and file-mode preservation covered too"
[[item]]
id = "BUG-204-1"
target = "Interface prefs (UI scale, font size, channels in colour, sliders, tooltips) wired or hidden"
status = "missing"
issue = 204
note = "prefs.rs:196-202; no reader outside prefs.rs (see the prefs audit)"
[[item]]
id = "BUG-204-2"
target = "workspace.large_tabs, animated_zoom, auto_show_home_screen wired or hidden"
status = "missing"
issue = 204
note = "prefs.rs:163,166,229; no reader outside prefs.rs"
[[item]]
id = "BUG-204-3"
target = "RAW prefs and ask_before_saving_layered_tiff read, or hidden"
status = "partial"
issue = 204
note = "ask_before_saving_layered_tiff drives the TIFF Options prompt (ui-egui tiff_options_ui.rs); raw_defaults (prefs.rs:712) still has no readers"
[[item]]
id = "BUG-204-4"
target = "Recent files persisted through prefs across restarts"
status = "done"
issue = 204
note = "crates/ui-egui/src/lib.rs::push_recent stores the list in preferences; prefs_ui::load restores it and recent_files_survive_a_restart_and_honour_the_count verifies reload"
[[item]]
id = "BUG-204-5"
target = "Recent-files list honours recent_file_count (default 20)"
status = "done"
issue = 204
note = "lib.rs push_recent caps the list with recent_cap (recent_file_count); menus.rs covers default and custom limits"
[[item]]
id = "BUG-204-6"
target = "Test: every Prefs field is read somewhere or on a hidden allowlist"
status = "partial"
issue = 204
note = "The scorecard's prefs audit counts unread fields; no engine test or allowlist yet"
[[item]]
id = "BUG-205-1"
target = "Free Transform with a selection moves only the selected part of a linked mask"
status = "missing"
issue = 205
note = "transform_cmds.rs:127-130 warps the whole linked mask even when the selection split pixels"
[[item]]
id = "BUG-205-2"
target = "Live transform preview draws the layer with its mask applied"
status = "missing"
issue = 205
note = "transform_tool.rs:173 preview_image uses the raw surface"
[[item]]
id = "BUG-205-3"
target = "edit.transform honours target mask: transforms only a targeted, unlinked mask"
status = "missing"
issue = 205
note = "transform_cmds.rs:214-270 never reads a target param"
[[item]]
id = "BUG-205-4"
target = "Test: a linked raster mask with no selection moves with the pixels"
status = "partial"
issue = 205
note = "Implemented at transform_cmds.rs:127; no raster-mask test"
[[item]]
id = "BUG-205-5"
target = "Tests: linked mask + selection stays aligned; unlinked stays; targeted mask only"
status = "missing"
issue = 205
note = "Unlinked case honoured (m.linked check, l.128) but untested; the other two not implemented"
[[item]]
id = "BUG-206-1"
target = "CharStyle models per-character manual kerning separately from the auto-kern mode"
status = "missing"
issue = 206
note = "doc/text.rs:76 only `kerning: Kerning` enum (Metrics/Optical/Off)"
[[item]]
id = "BUG-206-2"
target = "PSD import keeps Optical and manual Kerning values"
status = "missing"
issue = 206
note = "text/psd.rs:264 maps anything not Off to Metrics; Kerning value ignored"
[[item]]
id = "BUG-206-3"
target = "PSD export writes the real AutoKerning mode and Kerning values"
status = "missing"
issue = 206
note = "text/psd.rs:380-381 AutoKerning bool only; Kerning hard-coded 0"
[[item]]
id = "BUG-206-4"
target = "Alt+Left/Right at a collapsed caret adjusts pair kerning; Character panel field"
status = "missing"
issue = 206
note = "type_tool.rs:896-912 only a mode combo"
[[item]]
id = "BUG-206-5"
target = "Tests: PSD round trip of manual and Optical kerning, a real file in the oracle corpus"
status = "missing"
issue = 206
note = "No kerning round-trip test"
[[item]]
id = "BUG-207-1"
target = "Retouch tools respect the paint target (mask, alpha channel, Quick Mask)"
status = "missing"
issue = 207
note = "retouch_cmds.rs:83 run_stroke always uses l.surface_mut(); no paint_target() call"
[[item]]
id = "BUG-207-2"
target = "Sample All Layers applies to Blur, Sharpen and Smudge"
status = "missing"
issue = 207
note = "Checkbox at retouch_ui.rs:171-190 is not passed to the stroke commands"
[[item]]
id = "BUG-207-3"
target = "Smudge mixes premultiplied RGBA (no dark fringe at transparent edges)"
status = "missing"
issue = 207
note = "No premultiply in paint/src/retouch.rs"
[[item]]
id = "BUG-207-4"
target = "edit.transform transforms a targeted alpha channel"
status = "missing"
issue = 207
note = "transform_cmds.rs transform() has no target handling"
[[item]]
id = "BUG-207-5"
target = "Tests: per-tool mask/channel targeting, Sample All Layers, no smudge fringe"
status = "missing"
issue = 207
note = "Only smudge_drags_colour_along_the_stroke (retouch.rs:407)"
[[item]]
id = "BUG-208-1"
target = "Shift while dragging a Rect/Elliptical Marquee constrains to a square/circle"
status = "done"
issue = 208
note = "canvas.rs marquee_corners applies Shift via Drag::marquee_mods; marquee_tests.rs::shift_during_the_drag_draws_a_square_and_the_readout_follows covers the drag"
[[item]]
id = "BUG-208-2"
target = "Alt while dragging a marquee draws from the centre"
status = "done"
issue = 208
note = "canvas.rs marquee_corners centres Alt drags; marquee_tests.rs::alt_draws_from_the_centre_and_shift_alt_a_centred_circle verifies rectangles and ellipses"
[[item]]
id = "BUG-208-3"
target = "W x H px readout beside the cursor while dragging a marquee"
status = "done"
issue = 208
note = "canvas.rs marquee_readout draws the readout; marquee_tests.rs asserts dimensions while dragging and its removal after release"
[[item]]
id = "BUG-208-4"
target = "Add/subtract/intersect from modifiers pressed before the drag, kept by a test"
status = "partial"
issue = 208
note = "Mods captured at press (canvas.rs:1679, used :1779); only a badge test (tool_feedback.rs:195)"
[[item]]
id = "BUG-208-5"
target = "Kittest: Shift drag gives a square, Alt drag is centred, readout matches the size"
status = "done"
issue = 208
note = "crates/ui-egui/src/marquee_tests.rs covers Shift, Alt, selection bounds, W/H readout and drag completion"