Commit 7072874
feat(snapshots): Emit diff_threshold in snapshot sidecar (EME-1055) (#1158)
* feat(snapshots): Emit diff_threshold in snapshot sidecar (EME-1055)
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>
* refactor(snapshots): Propagate reflection failures from sidecar writer
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>
* Revert "refactor(snapshots): Propagate reflection failures from sidecar writer"
This reverts commit c1a5f39.
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 19df621 commit 7072874
3 files changed
Lines changed: 32 additions & 0 deletions
File tree
- plugin-build/src
- main/kotlin/io/sentry/android/gradle/snapshot
- test/kotlin/io/sentry/android/gradle/snapshot
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
376 | 376 | | |
377 | 377 | | |
378 | 378 | | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
379 | 390 | | |
380 | 391 | | |
381 | 392 | | |
| |||
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
129 | 149 | | |
130 | 150 | | |
131 | 151 | | |
| |||
0 commit comments