Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,12 @@ def get(self, request: Request, organization: Organization, snapshot_id: str) ->
if pending_or_failed_state is not None:
comparison_state = PreprodSnapshotComparison.State(pending_or_failed_state).name

comparison_type = "diff" if comparison_manifest is not None else "solo"
if comparison_manifest is not None:
comparison_type = "diff"
elif commit_comparison and commit_comparison.base_sha and pending_or_failed_state is None:
comparison_type = "waiting_for_base"
else:
comparison_type = "solo"
Comment thread
cursor[bot] marked this conversation as resolved.

run_info: SnapshotComparisonRunInfo | None = None
if comparison_state is not None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ class PostedStatusChecks(BaseModel):

class SnapshotComparisonInfo(BaseModel):
image_count: int
comparison_state: Literal["pending", "processing", "success", "failed"] | None = None
comparison_state: (
Literal["pending", "processing", "success", "failed", "waiting_for_base"] | None
) = None
comparison_error_message: str | None = None
images_added: int = 0
images_removed: int = 0
Expand Down Expand Up @@ -299,7 +301,11 @@ def to_snapshot_comparison_info(head_artifact: PreprodArtifact) -> SnapshotCompa
reverse=True,
)
comparison = comparisons[0] if comparisons else None
if comparison:
if not comparison:
cc = head_artifact.commit_comparison
if cc and cc.base_sha:
comparison_state = "waiting_for_base"
Comment thread
sentry[bot] marked this conversation as resolved.
elif comparison:
comparison_state = PreprodSnapshotComparison.State(comparison.state).name.lower()
if comparison.state == PreprodSnapshotComparison.State.SUCCESS:
images_added = comparison.images_added
Expand Down
11 changes: 11 additions & 0 deletions static/app/components/preprod/preprodBuildsSnapshotTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,17 @@ function ChangeCounts({
if (!comparisonState) {
return <Tag variant="info">{t('Base')}</Tag>;
}
if (comparisonState === 'waiting_for_base') {
return (
<Tooltip
title={t(
"Base snapshots haven't been uploaded yet. This will resolve automatically within ~10 minutes or fail."
)}
>
<Tag variant="muted">{t('Waiting for base')}</Tag>
</Tooltip>
);
}
if (comparisonState === 'pending') {
return (
<Tooltip title={t('Waiting to start comparison')}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export interface NavButtonRefs {
interface SnapshotMainContentProps {
canNavigateNext: boolean;
canNavigatePrev: boolean;
comparisonType: 'diff' | 'solo' | undefined;
comparisonType: 'diff' | 'solo' | 'waiting_for_base' | undefined;
diffImageBaseUrl: string;
diffMode: DiffMode;
hasDiffComparison: boolean;
Expand Down Expand Up @@ -192,6 +192,16 @@ export function SnapshotMainContent({
);
} else if (comparisonType === 'solo') {
soloDiffToggle = <Tag variant="promotion">{t('Base')}</Tag>;
} else if (comparisonType === 'waiting_for_base') {
soloDiffToggle = (
<Tooltip
title={t(
"Base snapshots haven't been uploaded yet. This will resolve automatically within ~10 minutes or fail."
)}
>
<Tag variant="muted">{t('Waiting for base')}</Tag>
</Tooltip>
);
}

if (viewMode === 'list') {
Expand Down
2 changes: 1 addition & 1 deletion static/app/views/preprod/snapshots/snapshots.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ export default function SnapshotsPage() {
viewOverride === 'solo' ? 'solo' : (data?.comparison_type ?? 'solo');
const comparisonRunInfo = data?.comparison_run_info;

const isSoloView = comparisonType === 'solo';
const isSoloView = comparisonType === 'solo' || comparisonType === 'waiting_for_base';
const handleToggleView = useCallback(() => {
const {view: _view, ...restQuery} = location.query;
if (isSoloView) {
Expand Down
7 changes: 6 additions & 1 deletion static/app/views/preprod/types/buildDetailsTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,12 @@ export function isStatusCheckFailure(
return result?.success === false;
}

export type SnapshotComparisonState = 'pending' | 'processing' | 'success' | 'failed';
export type SnapshotComparisonState =
| 'pending'
| 'processing'
| 'success'
| 'failed'
| 'waiting_for_base';
export type SnapshotApprovalStatus = 'approved' | 'requires_approval';

interface SnapshotComparisonInfo {
Expand Down
2 changes: 1 addition & 1 deletion static/app/views/preprod/types/snapshotTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ interface SnapshotApprovalInfo {
}

export interface SnapshotDetailsApiResponse {
comparison_type: 'solo' | 'diff';
comparison_type: 'solo' | 'diff' | 'waiting_for_base';
head_artifact_id: string;
image_count: number;
images: SnapshotImage[];
Expand Down
Loading