feat: add unified screenshot diff with layout-shift compensation#6
Open
jsfez wants to merge 2 commits into
Open
feat: add unified screenshot diff with layout-shift compensation#6jsfez wants to merge 2 commits into
jsfez wants to merge 2 commits into
Conversation
Add diffScreenshots, a single-pass screenshot comparator replacing odiff in the Argos pipeline: - pixelmatch algorithm in Rust (YIQ color distance, alpha blending over white, antialiasing detection), both diff thresholds evaluated in one loop over in-memory images - integrated layout-shift compensation: row alignment (patience diff on quantized row hashes, exposed separately as computeRowAlignment), in-memory row remapping instead of image compositing, inserted sections painted on the mask, deletion seam markers - parallelized with rayon (decode, diff rows, row hashing): x3 faster than the two parallel odiff processes it replaces - masks are only encoded when they have content Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
diff_pass had 9 arguments, tripping clippy::too_many_arguments. Bundle the canvas geometry and thresholds into a PassConfig struct. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Summary
Adds
diffScreenshots, a single-pass screenshot comparator designed to replaceodiff-binin the Argos backend (companion PR in argos-ci/argos), pluscomputeRowAlignmentexposing the row alignment on its own.insertedRows/deletedRows) so the caller can score them explicitly.big-imagesfixture: 66ms vs 200ms for the two parallel odiff spawns it replaces (×3).odiff parity
Validated against the full Argos fixture corpus (24 cases): the base-threshold pass is bit-identical to odiff on identical inputs; the color-sensitive pass diverges by +0.1–2% relative (OCaml vs Rust float precision at a very low threshold), with identical gate verdicts everywhere.
Tests
cargo test): alignment (insertion, deletion, repeated rows, min-run folding, width mismatch) and diff (color math, dual threshold, transparent padding, row-map realignment, end-to-end layout shift).diffScreenshotsspecs on synthetic PNGs (masks content asserted pixel by pixel) and the pre-existing fingerprint spec, unchanged.Release note
Version bumped to 0.3.0 — the Argos backend PR depends on this version being published to npm.
🤖 Generated with Claude Code