ref(snapshots): Add configurable diff_threshold for snapshot comparison#112728
Conversation
2a40e7f to
df7a12d
Compare
96dfb80 to
199b40c
Compare
df7a12d to
418c4ee
Compare
…ound Make diff_threshold exclusive of 1.0 in both the API schema and Pydantic model since a threshold of 1.0 with strict > comparison would silently prevent any image from being marked changed. Also remove the hash-mismatch fallback that forced changed status when odiff reported 0 diff — the upstream odiff bug is being fixed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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 2fdde05. Configure here.
| else 0 | ||
| ) | ||
| effective_threshold = diff_threshold if diff_threshold is not None else 0.0 | ||
| is_changed = diff_pct > effective_threshold |
There was a problem hiding this comment.
Missing hash-mismatch safety check described in PR
Medium Severity
The PR description explicitly states "Add a hash-mismatch safety check: if odiff reports 0 diff but content hashes differ, force the image as changed," and the PR discussion shows a hashes_differ = head_hash != base_hash line that was present in an earlier version of the code. This safety check is missing from the final diff. At this point in the code, head_hash != base_hash is guaranteed (filtered at line 414), but odiff can still report 0 changed_pixels due to its own ODIFF_SENSITIVITY_DIFF_THRESHOLD. Without the safety check, such images are incorrectly classified as "unchanged" even though their content hashes differ.
Reviewed by Cursor Bugbot for commit 2fdde05. Configure here.
There was a problem hiding this comment.
forgot to update PR description



Summary
diff_threshold(0.0–1.0) parameter to the snapshot upload API, allowing callers to control what percentage of changed pixels marks an image as "changed"Test plan
diff_thresholdtype and range at the API boundary