Repository navigation
Use BlazeDiff for one soft screenshot highlight - #3820
Merged
Merged
Conversation
Replace inferred pixel categories with one exact changed-pixel mask, retaining soft intensity and explicit alpha/extent changes. Remove category-only coverage; test slight edits, transparency, unequal extents and asynchronous capture refresh. Bump page protocol for the simplified asynchronous mask API.
leaf-agent
approved these changes
Oct 24, 2026
This was referenced Oct 25, 2026
max-sixty
added a commit
that referenced
this pull request
Nov 9, 2026
The Pixels view of an `lf-shot` painted every changed pixel at least alpha 40, about 16% amber. The theme's soft shadows, `--raise-1` and `--raise-2`, redraw a moved box's gradient a level or two at a time, so that floor turned a shadow into a banded amber slab around the box. The mask's alpha now rises linearly from 0 to opaque at 96 levels of channel distance, so an edit under about 10 levels paints below 10% amber. This partly reverses #3820, which adopted BlazeDiff with threshold 0 and anti-aliased pixels kept, and kept the floor, so that a one-level deliberate edit stayed visible in Pixels. A one-level edit is still in the mask (alpha 3), the "one level is a change" tests still pass, and the reading still calls such a pair "only slight changes", but a reader won't see it in Pixels. This is option (b) on #4039, taken as a call Max may reverse, since with Pixels' settings BlazeDiff did nothing a plain comparison doesn't. The module header records the decision and its reason. With its threshold at 0, BlazeDiff marked exactly the pixels that a plain comparison marks ("the two pixels differ, unless both are fully transparent"). Checked per pixel against main's `changedPixels` on the three card pairs below, on 200,000 random pixels (translucent and transparent ones included) and on a 1440x900 pair: zero pixels differ. So `changedPixels` is now that comparison, and synchronous. `@blazediff/core` goes, with its types patch, its `build/vendor.mjs` row, `build/entries/blazediff/`, the vendored bundle and its licence notice, its compiler path, the padding helper, and the special case for BlazeDiff's checkerboard background (with the test case that guarded it). The lock loses only BlazeDiff's entries, and `pnpm run build:browser` regenerated the compiler paths and nothing else. ## Evidence `uv run leaf-dev probe .tmp/4039/pair.html --journey .tmp/4039/measure.py --browser {chromium,firefox} --base` opens each pair's Pixels view and reads back the mask the widget painted. Each pair is a real triage-board card captured before and after moving 3 px down, in three faces. The counts are mask pixels at 10% amber or more (alpha ≥ 26), main and then this branch, and they're identical in Chromium and Firefox: | Card face | main | this branch | | --- | ---: | ---: | | resting, no shadow | 7,681 | 6,964 | | `--raise-1` | 11,049 | 6,792 | | `--raise-2` | 17,075 | 6,766 | On main the shadow adds 3,368 and 9,394 visible pixels; on this branch it adds none. The set of marked pixels (any alpha) is identical between the arms, and the 3,137 opaque pixels of the card's text and edges are unchanged. The stills, one sheet per engine with rows for the three faces and columns for main and this branch, cropped and scaled 3x, are in the worktree at `.tmp/4039/sheets/4039-pixels-{firefox,chromium}.png`. On main the `--raise-1` and `--raise-2` cards sit in a wide, banded tan slab. On this branch both look like the resting card: amber text and a thin amber band at the top and bottom edges where the card moved. Computing the mask for a 1440x900 pair takes a median of 4.7 ms on this branch and 8.9 ms on main (Node, three interleaved rounds of nine), since one pass replaces BlazeDiff's pass plus a second. ## Tests - `pnpm run check` passes (815 runtime tests, the browser build check, the Worker tests). - `node --test tests/runtime/image-difference.test.mjs`: 20 pass. The one assertion that changed is the exact alpha of a 25-level edit, now 66 where it was 96. A bug-back run flipped each rule `changedPixels` keeps (the floor, the transparent-colour exemption, alpha, the row stride for unequal widths); each fails a test, and the unflipped control passes. - `uv run pytest tests/browser/test_render_commands.py -k "shot or pixels"`: 16 pass, covering the Pixels press, mask ordering and replacement. Also `tests/browser/test_render_visual_review_journey.py -k evidence_height`: 1 pass. ## Not verified WebKit, and dark-scheme pages. The amber's visibility at a given alpha depends on the greyed image under it; the 10% line is a judgment, not a measured threshold of perception. Closes #4039 > _This was written by Claude Code on behalf of max-sixty_ Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pixels now uses BlazeDiff Core with a single amber highlight, retaining the previous soft opacity for slight changes. This removes the inferred addition/removal/recolor categories and their background classifier; Slider and Pair remain available to interpret the change.
The simplification reduces three masks, encoded images and paint layers to one. Detection loads on demand, preserves unequal image extents and alpha edits, and uses zero threshold with anti-alias suppression disabled so subtle deliberate edits remain visible. The public mask API now resolves to one RGBA mask, with page protocol 23 and updated authoring guidance.
Validation: all five real screenshot pairs match the former combined masks’ alpha exactly; 15 focused browser cases pass, including capture refresh; pnpm run check passes.