ref(snapshots): Make diffing logic more strict + better handle different sized images when comparing#112632
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 001b87e. Configure here.
001b87e to
ca3a049
Compare
|
@rbro112 FWIW i tested with 0.001 and the results were pretty much the same as 0.01 but with slightly louder (and not necessarily more helpful) feedback on the diff. I think 0.01 is good compromise for now based off my testing
maybe we can try 0 properly once https://github.com/dmtrKovalenko/odiff 's v4.3.3 is actually released, but id rather do that separately |
| logger = logging.getLogger(__name__) | ||
|
|
||
| DIFF_THRESHOLD = 0 | ||
| DIFF_THRESHOLD = 0.01 |
There was a problem hiding this comment.
Would highly recommend a comment documenting why this is .01 as I could see someone coming along and having no context getting confused
There was a problem hiding this comment.
Added a comment explaining the threshold value.
…ent sized images when comparing
96dfb80 to
199b40c
Compare



odiff only compares the overlapping region of differently-sized images — pixels outside the overlap are silently ignored. This meant dimension changes like width (200→300px) or height (2688→3676px) could report 0% diff.
Fix: pad both images to the max dimensions with transparent pixels before passing to odiff. This normalizes the canvas so odiff always compares same-sized images and correctly counts the non-overlapping area as changed pixels.
Also restores
DIFF_THRESHOLDto0.01(was temporarily set to0for testing).