Skip to content

Commit 7820557

Browse files
feat(snapshots): Show diff_threshold in snapshot detail header
Surface the optional diff_threshold from the snapshot manifest in the API response and display it in the header next to the branch name when set. This lets users see what comparison precision was configured for a given snapshot. Refs EME-406 Co-Authored-By: Claude <noreply@anthropic.com>
1 parent cd8a533 commit 7820557

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

src/sentry/preprod/api/endpoints/preprod_artifact_snapshot.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,7 @@ def get(self, request: Request, organization: Organization, snapshot_id: str) ->
434434
errored_count=len(categorized.errored),
435435
comparison_run_info=run_info,
436436
approval_info=approval_info,
437+
diff_threshold=manifest.diff_threshold,
437438
).dict()
438439
)
439440

src/sentry/preprod/api/models/snapshots/project_preprod_snapshot_models.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,5 +97,7 @@ class SnapshotDetailsApiResponse(BaseModel):
9797

9898
approval_info: SnapshotApprovalInfo | None = None
9999

100+
diff_threshold: float | None = None
101+
100102

101103
# TODO: POST request in the future when we migrate away from current schemas

static/app/views/preprod/snapshots/header/snapshotHeaderContent.tsx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@ import {ExternalLink} from '@sentry/scraps/link';
77
import {Text} from '@sentry/scraps/text';
88

99
import * as Layout from 'sentry/components/layouts/thirds';
10-
import {IconCommit, IconPullRequest, IconShow, IconStack} from 'sentry/icons';
10+
import {
11+
IconCommit,
12+
IconPullRequest,
13+
IconSettings,
14+
IconShow,
15+
IconStack,
16+
} from 'sentry/icons';
1117
import type {SVGIconProps} from 'sentry/icons/svgIcon';
1218
import {t} from 'sentry/locale';
1319
import type {Theme} from 'sentry/utils/theme';
@@ -66,7 +72,8 @@ export function SnapshotHeaderContent({
6672
<Layout.HeaderContent>
6773
<Layout.Title>{t('Snapshot')}</Layout.Title>
6874

69-
{vcsItems.length > 0 && (
75+
{(vcsItems.length > 0 ||
76+
(data.diff_threshold !== null && data.diff_threshold !== undefined)) && (
7077
<Flex align="center" gap="lg" wrap="wrap">
7178
{vcsItems.map(item => (
7279
<Flex align="center" gap="xs" key={item.key}>
@@ -82,6 +89,14 @@ export function SnapshotHeaderContent({
8289
)}
8390
</Flex>
8491
))}
92+
{data.diff_threshold !== null && data.diff_threshold !== undefined && (
93+
<Flex align="center" gap="xs">
94+
<IconSettings size="xs" />
95+
<Text size="sm" variant="muted">
96+
{t('Diff threshold: %s%%', (data.diff_threshold * 100).toFixed(1))}
97+
</Text>
98+
</Flex>
99+
)}
85100
</Flex>
86101
)}
87102

static/app/views/preprod/types/snapshotTypes.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ export interface SnapshotDetailsApiResponse {
5252

5353
approval_info?: SnapshotApprovalInfo | null;
5454

55+
diff_threshold?: number | null;
56+
5557
// Diff fields
5658
added: SnapshotImage[];
5759
added_count: number;

0 commit comments

Comments
 (0)