Skip to content

fix(snapshots): Show 'Waiting for base' instead of 'Base' when base artifact not found#115446

Merged
NicoHinderling merged 3 commits into
masterfrom
fix/preprod-waiting-for-base-label
May 12, 2026
Merged

fix(snapshots): Show 'Waiting for base' instead of 'Base' when base artifact not found#115446
NicoHinderling merged 3 commits into
masterfrom
fix/preprod-waiting-for-base-label

Conversation

@NicoHinderling
Copy link
Copy Markdown
Contributor

@NicoHinderling NicoHinderling commented May 12, 2026

When a snapshot is uploaded with a base_sha but no matching base artifact exists yet, both the snapshot list and detail pages incorrectly show a "Base" badge — implying the build is a base build with no comparison intended. In reality, the upload explicitly requested a comparison but the base hasn't been uploaded yet.

This changes both the list and detail APIs to return a waiting_for_base state when base_sha is present but no base artifact or comparison exists. The frontend now shows a "Waiting for base" tag with a tooltip explaining the build will resolve within ~10 minutes or fail.

Backend:

  • Detail API (comparison_type): returns "waiting_for_base" instead of "solo" when base_sha exists but no comparison manifest found
  • List API (comparison_state): returns "waiting_for_base" instead of null when base_sha exists but no PreprodSnapshotComparison record found
  • SnapshotComparisonInfo Pydantic model: added "waiting_for_base" to the comparison_state Literal type to prevent ValidationError at runtime

Frontend:

  • List view: renders <Tag variant="muted">Waiting for base</Tag> with tooltip
  • Detail view: renders the same tag instead of the pink "Base" badge
  • isSoloView treats waiting_for_base the same as solo for rendering purposes

@github-actions github-actions Bot added Scope: Frontend Automatically applied to PRs that change frontend components Scope: Backend Automatically applied to PRs that change backend components labels May 12, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🚨 Warning: This pull request contains Frontend and Backend changes!

It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently.

Have questions? Please ask in the #discuss-dev-infra channel.

@NicoHinderling NicoHinderling marked this pull request as ready for review May 12, 2026 22:20
@NicoHinderling NicoHinderling requested a review from a team as a code owner May 12, 2026 22:20
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 12, 2026

📊 Type Coverage Diff

✅ No new type safety issues introduced. Coverage: 93.50%

…l type

The comparison_state field was being set to "waiting_for_base" but the
Pydantic Literal type only allowed "pending", "processing", "success",
and "failed", which would cause a ValidationError at runtime.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Comment thread src/sentry/preprod/api/endpoints/preprod_artifact_snapshot.py Outdated
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 57342fa. Configure here.

Comment thread src/sentry/preprod/api/endpoints/preprod_artifact_snapshot.py
…exists

When a comparison record exists in PENDING/PROCESSING/FAILED state, the
base artifact was already found. Showing "waiting_for_base" in that case
is misleading — fall through to "solo" and let the run_info carry the
actual comparison state.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@NicoHinderling NicoHinderling enabled auto-merge (squash) May 12, 2026 22:48
@NicoHinderling NicoHinderling merged commit bc88a53 into master May 12, 2026
71 checks passed
@NicoHinderling NicoHinderling deleted the fix/preprod-waiting-for-base-label branch May 12, 2026 22:49
NicoHinderling added a commit that referenced this pull request May 12, 2026
…ng base (#115448)

When a head snapshot uploads before its base build (e.g., due to network
timing), the status check task immediately posts a FAILURE to GitHub
with "No base snapshots found." This is a false negative — the base just
hasn't arrived yet.

This adds a grace period: instead of failing immediately, the task posts
an IN_PROGRESS status ("Waiting for base snapshots...") and schedules a
delayed self-invocation (10 minutes). If the base arrives before the
timeout, the existing comparison flow re-triggers the status check which
takes the normal path — the timeout task becomes a harmless no-op. If
the base never arrives, the timeout flips it to FAILURE.

The approach is event-driven rather than poll-based: no retries, no new
state to maintain. The task re-runs the same idempotent logic and
queries the DB for current truth.

Companion to #115446 which adds the matching "Waiting for base" UI state
in the frontend.

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants