feat(snapshots): Emit diff_threshold in snapshot sidecar (EME-1055)#1158
Merged
runningcode merged 3 commits intomainfrom Apr 21, 2026
Merged
feat(snapshots): Emit diff_threshold in snapshot sidecar (EME-1055)#1158runningcode merged 3 commits intomainfrom
runningcode merged 3 commits intomainfrom
Conversation
Contributor
Semver Impact of This PR🟡 Minor (new features) 📋 Changelog PreviewThis is how your changes will appear in the changelog. This PR will not appear in the changelog. 🤖 This preview updates automatically when you update the PR. |
Contributor
|
The generated Paparazzi test now reflects on each @Preview to read an optional @SentrySnapshot(diffThreshold) annotation and writes the value as "diff_threshold" in the per-snapshot sidecar JSON, but only when the annotation is present and the threshold differs from the 0f default. Changes SentrySnapshot's retention from BINARY to RUNTIME so the JVM retains it for reflection. Java's Method.getAnnotation cannot see CLASS/BINARY-retained annotations. The lookup is guarded by runCatching so a missing runtime jar or a class-loading failure degrades to "field omitted" rather than a test failure. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ec8a132 to
4d31af2
Compare
Drop the runCatching around the @SentrySnapshot lookup. The previous guard silently swallowed ClassNotFoundException when sentry-snapshots-runtime is absent from the test runtime classpath, so a misconfigured consumer would see "diff_threshold" quietly omitted with no indication of why. Letting exceptions propagate surfaces the misconfiguration loudly at test runtime. Co-Authored-By: Claude Opus 4.7 (1M context) <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 c1a5f39. Configure here.
…ar writer" This reverts commit c1a5f39.
romtsn
approved these changes
Apr 21, 2026
runningcode
commented
Apr 21, 2026
| if (info.showSystemUi) metadata["show_system_ui"] = true | ||
| if (info.showBackground) metadata["show_background"] = true | ||
|
|
||
| val diffThreshold: Float? = runCatching { |
Contributor
Author
There was a problem hiding this comment.
This catches all errors here in scanning since we are using reflection.
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
Finishes EME-1055 (follow-up to #1154) by wiring the
@SentrySnapshot(diffThreshold = ...)runtime annotation into the per-snapshot sidecar JSON emitted by the generated Paparazzi test.writeSidecarMetadatanow reflects onpreview.declaringClass/preview.methodNameto read@SentrySnapshot.diffThreshold. The value is written asdiff_thresholdonly when the annotation is present and the threshold is non-default (!= 0f), matching the existing "omit when default" pattern used forfont_scale,api_level, etc.Class.forNamefor the annotation class and is wrapped inrunCatching, so a missing runtime jar or a class-loading failure silently skips the field rather than failing the test.Scope
ExportPreviewMetadataTask's build-timepreview-metadata.jsonis intentionally left alone.PreviewScannerASM machinery; detection is fully at test runtime.#skip-changelog
🤖 Generated with Claude Code