Skip to content

Accept a change repeated across stories once, instead of story by story - #59

Merged
nedtwigg merged 2 commits into
mainfrom
accept-delta
Nov 5, 2026
Merged

nedtwigg merged 2 commits into
mainfrom
accept-delta

Conversation

@nedtwigg

@nedtwigg nedtwigg commented Nov 5, 2026

Copy link
Copy Markdown
Member

When one change lands on many stories, like a header change that touches every page, you currently have to review each story separately. This finds the changes that repeat and lets you accept each one once. It's fully client-side, with no SQL or stored-format changes.

What it does

  • Finds repeated changes: the batch page groups hunks by the size of each side, then by the SHA-256 of each side's pixels. Any group in at least 3 undecided stories is offered as a delta.
  • Lets you look first: one delta is open at a time. Previous and Next go through its stories, each with a link, the crop, and the whole before and after images with every place it has the delta outlined. Whole images matter because a delta's pixels are the same everywhere, so only where it landed can differ.
  • Accepting shrinks the diff: the delta is drawn onto each golden in this browser, so the story page shows only the hunks that are left. It says the golden is redrawn and that the one on record hasn't changed. Accepted deltas are kept in localStorage, and each can be undone.
  • Reaching zero approves: an undecided image with no hunks left goes through the existing POST /batches/:id/decisions, after the usual bulk confirmation. Undoing a delta doesn't take back an approval.

The specs are updated: ui.md and its rationale, access.md, and glossary.md. The page's CSP now allows blob: images for the redrawn goldens.

Trying it on main

On main's real batch of 124 changed stories, Selfie offers 28 deltas. Accepting them all approves 83 stories, leaves 35 with a smaller diff, and leaves 6 with no delta to accept.

Testing

  • pnpm test passes: ui 96, store 621 (92 skipped), render 148, cli 512.
  • cli/test/deltas.test.ts runs the real differ over every combination of hunks, and shows that redrawing some leaves exactly the rest.
  • All 83 finished images were compared pixel by pixel with their current image in a browser, through canvas and PNG, and match.
  • Previous, Next and "Look through" were driven on the real batch. At 1000px wide, none of the 54 crops overflow.
  • The new stories render without failures.

Known limitations

  • Rendering noise is still offered as deltas: 23 of those 28 offers are faint edge differences you can't see, such as 1/255 on a rounded corner. They appear to come from Chromium's raster tiles, because a 15px shift moves edges across tile seams. Fixing this is left for later.
  • Stats are approximate on a redrawn story: spacing inside changed hunks isn't counted, and the largest channel difference is hidden. Exact numbers need per-hunk stats in the stored diff format.
  • Accepting all 28 takes 12 confirmation dialogs: there's no "Accept all" yet.
  • Buttons only: Previous and Next have no keyboard shortcuts.

🤖 Generated with Claude Code

nedtwigg and others added 2 commits November 4, 2026 11:03
A header that grew 15 rows changed all 124 stories of a batch, and each still
had to be looked at for whatever else was in it. The batch's page now offers
each hunk at least 3 undecided stories share, by the size and pixels of both
sides. Accepting one draws it onto those stories' goldens, in the browser, so
what's left to look at is smaller, and approves any image with nothing left.
On that batch, the 28 offers approve 83 images and shrink 35 more.

There's no new route or table. Which deltas are accepted is held in
localStorage by batch, and what reaches a store is an ordinary approval. Each
redrawn image is compared with nothing: everything outside a hunk matches, so
what differs afterward is exactly the other hunks, which cli/test/deltas.test.ts
shows on the real differ for every combination of them.

The page's policy now allows blob: images, for what's redrawn.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A delta's pixels are the same in every story, so a crop can't tell one
story from another. What can be wrong is where it landed. One delta is open
at a time, with previous and next through its stories, each story's crop,
and all of its image on each side with every place it has the delta outlined.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nedtwigg
nedtwigg merged commit 46f7d4e into main Nov 5, 2026
1 of 2 checks passed
@nedtwigg
nedtwigg deleted the accept-delta branch November 5, 2026 00:26
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