Label thumbnails by the keys that pick them; never diff binary #8

Merged
cyplo merged 1 commit from image-labels-and-binary-diff into main 2026-11-09 14:37:15 +00:00
Owner

Two problems you spotted on the real screen, both fixed:

1. Thumbnail labels contradicted the options line

A single copy was labelled [a] - but for one conflict the options line says 2: Keep conflict and no letter key does anything. The labels now name the keys that pick each copy:

  • one copy: original | conflict (matching 1: Keep original 2: Keep conflict)
  • several copies: original | [a] | [b] (matching ab: Pick conflict)

And copies with identical bytes share one thumbnail with their labels combined - original, [a] - since they are the same picture and need no second column. The original always appears; a copy identical to it joins its column rather than duplicating it.

2. Binary bytes were diffed as text

Expanding a BMP conflict rendered escape soup across the screen: BMP bytes are valid UTF-8 (with NULs), so the text diff tried anyway. Binary content - NUL bytes or non-UTF-8 - now gets no text diff at all, and stays metadata-only like the file-type table says.

Pinned by fixtures

  • image/identical - identical pair expands to one thumbnail labelled original, conflict
  • image/identical_among_three (new) - [a] byte-identical to the original shares its column (original, [a]), [b] stays alone
  • image/corrupt_png, image/dimensions, image/narrow_six_cols - single-copy labels now conflict (with the narrow one cut to con)
  • image/bmp_stays_plain - expanded BMP shows no diff garbage and no image treatment; the two identical fixture JPEGs also got their 8-bit SOF precision fix so their dimensions parse (they had the same 12-bit header as the earlier ones)

Checked

  • 71/71 tests pass, clippy clean with -D warnings.
  • Mutating this PR's whole diff against main, as CI will: 12 mutants tested, 11 caught, 1 unviable, 0 missed.
  • Rendered the screens as PNGs and looked at them: original, [a] shares one red thumbnail, [b] sits alone in its column.
Two problems you spotted on the real screen, both fixed: ### 1. Thumbnail labels contradicted the options line A single copy was labelled `[a]` - but for one conflict the options line says `2: Keep conflict` and no letter key does anything. The labels now name **the keys that pick each copy**: - one copy: `original` | `conflict` (matching `1: Keep original 2: Keep conflict`) - several copies: `original` | `[a]` | `[b]` (matching `ab: Pick conflict`) And copies with **identical bytes share one thumbnail** with their labels combined - `original, [a]` - since they are the same picture and need no second column. The original always appears; a copy identical to it joins its column rather than duplicating it. ### 2. Binary bytes were diffed as text Expanding a BMP conflict rendered escape soup across the screen: BMP bytes are valid UTF-8 (with NULs), so the text diff tried anyway. Binary content - NUL bytes or non-UTF-8 - now gets no text diff at all, and stays metadata-only like the file-type table says. ### Pinned by fixtures - `image/identical` - identical pair expands to one thumbnail labelled `original, conflict` - `image/identical_among_three` (new) - `[a]` byte-identical to the original shares its column (`original, [a]`), `[b]` stays alone - `image/corrupt_png`, `image/dimensions`, `image/narrow_six_cols` - single-copy labels now `conflict` (with the narrow one cut to `con`) - `image/bmp_stays_plain` - expanded BMP shows no diff garbage and no image treatment; the two identical fixture JPEGs also got their 8-bit SOF precision fix so their dimensions parse (they had the same 12-bit header as the earlier ones) ### Checked - 71/71 tests pass, clippy clean with `-D warnings`. - Mutating this PR's whole diff against `main`, as CI will: **12 mutants tested, 11 caught, 1 unviable, 0 missed**. - Rendered the screens as PNGs and looked at them: `original, [a]` shares one red thumbnail, `[b]` sits alone in its column.
Label thumbnails by the keys that pick them; never diff binary
All checks were successful
CI / Nix checks and package build (pull_request) Successful in 24s
CI / Lint (pull_request) Successful in 24s
CI / Run tests (pull_request) Successful in 29s
CI / Mutation testing (pull_request) Successful in 1m1s
CI / Nix checks and package build (push) Successful in 12s
CI / Lint (push) Successful in 25s
CI / Run tests (push) Successful in 30s
CI / Mutation testing (push) Successful in 7m47s
6432b76b8a
Two problems from looking at the real screen. A single copy was
labelled [a] while the options say '2: Keep conflict' and no letter key
does anything there: thumbnails now name the keys that pick each copy -
original, conflict for one copy, [a], [b] where letters really pick -
and copies with identical bytes share one thumbnail with the labels
combined, like 'original, [a]', since they are the same picture to
compare.

An expanded binary conflict showed its bytes diffed as text: BMP bytes
are valid UTF-8 with NULs in them, so the diff rendered escape soup
across the screen. Binary content - NUL bytes or non-UTF-8 - now gets
no text diff at all, and stays metadata-only as the file-type table
says.

Co-Authored-By: GLM 5.3 <noreply@anthropic.com>
cyplo merged commit 6432b76b8a into main 2026-11-09 14:37:15 +00:00
cyplo deleted branch image-labels-and-binary-diff 2026-11-09 14:37:15 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
cyplo/deescalate!8
No description provided.