Skip to content

Upstream intake 2026-11-25: craft-libs lane + first craft-libs intake (9 ports), monitor round - #1499

Merged
emmertex merged 12 commits into
mainfrom
upstream-intake-2026-11-25-craft-libs
Nov 25, 2026
Merged

emmertex merged 12 commits into
mainfrom
upstream-intake-2026-11-25-craft-libs

Conversation

@emmertex

Copy link
Copy Markdown
Owner

Upstream now moves decoder, develop and metadata code into storytold/craft-libs and consumes it from there. Fixes land there, and the matching upstream PR shrinks to a rev bump or closes, so the intake never saw them. This PR adds craft-libs as a second intake source and runs its first intake. It also records today's upstream monitor round.

Tooling and runbook

  • tools/upstream_intake.py:
    • enumerate and drift take --repo craft-libs.
    • craft-libs PRs are kept only when they touch TRACKED_PATHS. Those are the crates the fork has its own counterpart of (raw, crw, develop, develop-model, metadata, crs, tiff, sniff, image codecs, colour, psd) plus ui and docpath, which the fork builds against. craft-libs takes 200+ PRs a week.
    • Ledger rows craft-libs#<n> / craft-libs commit <sha> sit in the same ledger, and duplicates are checked per source.
  • docs/upstream-pr-intake.md gets a new section, "The craft-libs lane". It covers what is read and how fixes are taken: always hand-ported into the fork's own crate, never as a dependency. Dependency crates get a rev bump instead. Extraction PRs are skipped.

Round table: craft-libs (first intake)

Scope: everything merged since craft-raw was created (2026-11-11) on the decoder and metadata paths, which is 72 merges and commits. Extractions, perf and test-only changes were skipped. The fixes and the PRs named by upstream ledger rows were read in full against the fork's code.

Item Decision Why Fork commit · checked
craft-libs#2380 ORF crop ADOPT Same v as usize on LONG8 maker-note crop tags: a wrapped value passed as a plausible crop on wasm32 5919610 · new test, lcc-raw tests
craft-libs#2232 tiny lossless tiles ADOPT Same 65,536-sample frame floor in tiffraw.rs and ARW quad tiles: many tiny tiles each decoded and kept a large frame. DCT tiles keep the floor a00eaa8 · 2 hostile-input tests
craft-libs#1884 lossy frame budget ADOPT (adapted) The fork's lossy cap used max(image height) per chunk, so each strip could decode a frame of about 4 images. Now bounded by the chunk's own rows 29b1e4c · hostile and control test
craft-libs#1759 LJ92 writer tile ADOPT Same 65,534 tile-edge guard. Now the 2048 Deflate bound (API hardening; callers pass 256) 2af1fbb · test
craft-libs#1300 format safety ADOPT (2 parts) A truncated CR3 stsz/co64/stco dropped the main track, so the reduced raw decoded as the photo. Predictor 2 did not wrap at the packed bit depth. The other parts are recorded in the ledger (maintainer call, corpus, LEARN) 741454e · tests; one old test now asserts "track kept, no data"
craft-libs#1080 CR3 CMT boxes ADOPT Same last-box-wins bug: a damaged later CMT box hid a readable one 4ece6fa · test
craft-libs#967 metadata fixes ADOPT (2 parts) Exif Rating 65535 read as 5 stars, now rejected (upstream #1995). parseType="Resource" attribute fields were lost (upstream #1226) 9b501b7 · tests, What's New + changelog
craft-libs#1042 metadata fixes ADOPT (1 part) The XMP writer lost a CR on round trip; it now writes &#13; (upstream #4119) e74a1b8 · round-trip test
craft-libs#2042 DNG strip width ADOPT DJI Mavic 3 DNGs count only the ActiveArea columns, so the fork zero-filled about 70 bottom rows. The strip is lengthened only in that exact case 1544fb1 · positive and 7 negative/hostile cases, What's New + changelog
craft-libs#1314 Z 6/Z 7 distortion PENDING Turns distortion on for every Z 6/Z 7 NEF (a render change). Re-check upstream's six CC0 files in the fork first -
craft-libs#1745 + #3050 linearization order PENDING The fork has the bug, but the fix changes valid DNGs that carry both tags. Needs corpus numbers -
craft-libs#733 web-api in-flight cap PENDING A ~40-line port plus a docs line, queued for the next round -
craft-libs#534 docpath security (dependency) PENDING Maintainer call: craft-docpath and craft-ui since our pinned rev carry Windows namespace-prefix refusal fixes that doc_path::resolve relies on. A rev bump may move egui -
craft-libs#3042 WB'd demosaic + clip mask LEARN A Bayer render change of about 1,000 lines, unmeasured upstream -
#2379, #2378, #1336, #2234, #2039, #1857, #1783, #827, 80144afd9, e98299546, #1413, #1929, #2356 SKIP Already in the fork (each row names where), lint-only, or not applicable -

Round table: upstream (monitor, 2026-11-25)

59 of 163 waiting rows moved. None could be adopted.

Shared numbers and anything unmeasured

Checks

  • cargo test -p lcc-raw and -p lcc-meta: all green, with the new tests.
  • cargo xtask ci --quick after merging current main: all 14 steps passed (547 corpus tests skipped: no corpus on this machine, so the decoder changes were not run against real raws).
  • python tools/upstream_intake.py check: 0 errors.
  • drift for both sources: clean after the re-stamp.

Manual: none, no user-visible change beyond the two fixes in What's New / changelog (Rejected rating from Exif; DJI Mavic 3 DNG rows).

🤖 Generated with Claude Code

emmertex and others added 12 commits November 25, 2026 23:04
…acked paths)

Upstream moves decoder, develop and metadata code into storytold/craft-libs, so fixes land
there and the matching upstream PR shrinks to a rev bump or closes. The intake tool now takes
--repo craft-libs for enumerate and drift, keeps only PRs touching TRACKED_PATHS (the crates
the fork has a counterpart of, plus craft-ui/craft-docpath it builds against), and the ledger
accepts craft-libs#<n> rows (duplicates are checked per source). The runbook gains a
craft-libs lane section.

Manual: none, no user-visible change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The ImageProcessing crop tags may be LONG8. `v as usize` truncated a value past u32 on wasm32
to a small number that passed the bounds check as a plausible crop; the conversion is now
checked (`usize::try_from`) and the bounds use the subtraction form, so anything unrepresentable
or outside the frame keeps the whole frame. The preview start/length casts get the same check.

Sources: adapted from storytold/craft-libs#2380 (63ed548b69, trufae), MIT OR Apache-2.0.
Manual: none, no user-visible change.

Co-authored-by: pancake <pancake@nopcode.org>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… tiles

A lossless DNG tile could decode a frame of up to max(2·tile, 65,536) samples, and a Sony quad
tile one of max(tile, 65,536). Many tiny tiles pointing at one large frame each decoded and kept
about 128 KB that the decode grouping counted as a few bytes. The lossless limit is now twice the
tile's samples (a quad tile: its samples) with no floor, and a DNG tile drops the surplus capacity
after the resize. DCT-coded (Blackmagic) tiles keep the floor, since they are padded to whole MCUs.

Sources: adapted from storytold/craft-libs#2232 (ccabfee3b5, Phil Hart), MIT OR Apache-2.0.
Manual: none, no user-visible change.

Co-authored-by: Phil Hart <radial@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The lossy-JPEG frame cap took `.max(image height)` for every chunk, so each 16-row strip of a
tall image could declare (and decode) a frame of about four whole images, and many strips
pointing at one payload decoded it each in parallel. The cap is now a few times the chunk's own
MCU-rounded rows (RowsPerStrip clipped to the image still covers a last strip coded at full
height and an only strip taller than the image). Valid tiled lossy DNGs are unchanged.

Sources: adapted from storytold/craft-libs#1884 (bea91b1861, FredApps), MIT OR Apache-2.0; the
fork's cap came from its own take on upstream #2635 (89895c6).
Manual: none, no user-visible change.

Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t 2048

`DngCompression::Lj92 { tile }` accepted edges up to 65,534 (JPEG's dimension limit), so a tiny
image could pad every tile to 65,534² samples. It now takes the Deflate bound (2048) and refuses
anything larger with the existing "tile too large" limit before any padding; every caller passes
256, so this hardens the API only.

Sources: adapted from storytold/craft-libs#1759 (9b5b517b42, Dylan M. Taylor), MIT OR Apache-2.0.
Manual: none, no user-visible change.

Co-authored-by: Dylan M. Taylor <dylan@dylanmtaylor.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ctor 2 wraps at the packed depth

Two parts of craft-libs #1300 the fork had the bug for:
- CR3: a `stsz`, `co64` or `stco` box too short for its own count made `trak()` return None,
  so the main raw track vanished and the largest-raw selector quietly decoded the reduced raw
  as the photo. The tables now deny the track's data (an error at decode) instead, and their
  counts are bounded by the box (a constant sample size times its count by the file).
- Deflated DNG chunks with horizontal differencing: packed 9-15-bit samples store each
  difference modulo 2^bits, so the sum now wraps there too; a negative step no longer comes
  back 2^bits too high. Samples in 16-bit words keep the 16-bit wrap.
The other parts of #1300 (uncompressed coverage, lossy component count, RAF layout, per-format
guards) are recorded in the intake ledger, not ported.

Sources: adapted from storytold/craft-libs#1300 (ad8faa1c13, Terra854), MIT OR Apache-2.0.
Manual: none, no user-visible change.

Co-authored-by: Terra854 <bentinner@yahoo.com.sg>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… one

Each CMT1-CMT4 slot took the last box of its name, so a damaged later box hid a readable
earlier one (and its Exif, maker note, focus and preview data). The first readable box of a slot
now wins, a later readable box replaces a damaged one, and a lone damaged box still fills the
slot. Well-formed files (one box per slot) are unchanged.

Sources: adapted from storytold/craft-libs#1080 (4ca29b10db, Dylan M. Taylor), MIT OR Apache-2.0.
Manual: none, no user-visible change.

Co-authored-by: Dylan M. Taylor <dylan@dylanmtaylor.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rce attribute fields

Two read fixes from craft-libs #967 (fixes it took from open upstream PRs) the fork still had:
- Exif Rating: writers store -1 (rejected) as a SHORT 0xFFFF; the reader clamped it to five
  stars. It now reads as -1 (upstream #1995's read side; writing Rating stays out).
- XMP: a property with rdf:parseType="Resource" may carry its struct's fields as attributes,
  as an rdf:Description does; only its child elements were flattened, so `crs:Look`'s
  attribute-form parameters were lost on import (upstream #1226's XMP part).
The other fixes in #967 are already in the fork or decided in the ledger.

Sources: adapted from storytold/craft-libs#967 (commits 554951d2b9, Sebastian Berschneider;
3df364ad17, Ilya Dorman), MIT OR Apache-2.0.
Manual: none; the import behaviour change is a fix, recorded in What's New and the changelog.

Co-authored-by: Sebastian Berschneider <berschi@gmail.com>
Co-authored-by: Ilya Dorman <ilya@codeforhumans.dev>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
XML end-of-line handling turns a literal CR into LF on reading, so a caption, title or setting
with a carriage return came back changed after a sidecar round trip. The writer now escapes it
as `&#13;` (in text and attributes); the reader already decodes the reference.

Sources: adapted from storytold/craft-libs#1042 (commit c812fc816b, smi-leonivkovic; from upstream
#4119, whose quick-xml bump stays PENDING), MIT OR Apache-2.0.
Manual: none, no user-visible change.

Co-authored-by: smi-leonivkovic <leon.ivkovic@smi-digital.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DJI Mavic 3 DNGs write StripByteCounts for the active columns (5280 x 3956 x 2) while the strip
holds full 5376-wide rows to the end of the file. The fork read only the counted bytes and
zero-filled the rest, so about 70 rows at the bottom came out black inside the default crop.
The strip is now lengthened to the full raster only for that exact case: uncompressed, one
strip, one integer sample of 8 or 16 bits, an ActiveArea starting at column 0 inside the image,
a count of exactly area-columns x rows, and the whole raster inside the file. Every other short
strip keeps today's behaviour. Only files that decoded wrong change.

Sources: adapted from storytold/craft-libs#2042 (efce830a55, techneissa; issue craft-libs#2040),
MIT OR Apache-2.0.
Manual: none; the fix is recorded in What's New and the changelog.

Co-authored-by: techneissa <55485515+techneissa@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t craft-libs intake

- upstream: 59 waiting rows moved (drift). Decision changes recorded (#4426 #1463 #3733 #3944
  #4119 #4126 #4358 #3949 #672 #4271 #3502 -> SKIP; #4057 #4243 #4413 -> LEARN); the 46 rows
  whose head moved with the decision unchanged are re-stamped.
- craft-libs: 29 rows for the PRs read (9 ADOPT with fork commits, 13 SKIP, 5 PENDING incl. the
  craft-ui/craft-docpath rev bump with security fixes, 1 LEARN); boundary and run-log rows.
- NOTICE credits craft-libs (MIT OR Apache-2.0, used under MIT) for the ports.
- Runbook: craft-libs rows' Upstream ref is the PR head; the tool's reports survive a
  non-UTF-8 console.

Manual: none, no user-visible change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@emmertex
emmertex merged commit 955295c into main Nov 25, 2026
5 checks passed
@emmertex
emmertex deleted the upstream-intake-2026-11-25-craft-libs branch November 25, 2026 21:06
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