From 3ae0d0ad29d61341d48af314e252bad9bab757f0 Mon Sep 17 00:00:00 2001 From: Nico Hinderling Date: Tue, 12 May 2026 17:56:24 -0700 Subject: [PATCH 1/2] fix(snapshots): Reject uploads with pr_number but no base_sha MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is no valid scenario where a snapshot uploaded as part of a PR should lack a base SHA — without it, the server cannot identify which base build to compare against. Previously this was silently accepted, leading to orphaned "solo" snapshots that could never produce diffs. Bail early with an actionable error message before any images are uploaded or API calls are made. --- src/commands/build/snapshots.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/commands/build/snapshots.rs b/src/commands/build/snapshots.rs index c12b8a465a..6484ee2064 100644 --- a/src/commands/build/snapshots.rs +++ b/src/commands/build/snapshots.rs @@ -118,6 +118,14 @@ pub fn execute(matches: &ArgMatches) -> Result<()> { // Always collect git metadata, but only perform automatic inference when enabled let vcs_info = collect_git_metadata(matches, &config, should_collect_git_metadata); + if vcs_info.pr_number.is_some() && vcs_info.base_sha.is_none() { + anyhow::bail!( + "A PR number was provided but no base SHA could be determined. \ + Snapshot comparisons require a base SHA to identify the base build. \ + Pass --base-sha explicitly or ensure your CI environment exposes the merge base." + ); + } + debug!("Scanning for images in: {}", dir_path.display()); debug!("Organization: {org}"); debug!("Project: {project}"); From 551f43dd6455e817bb244bdad0330685b7719f7a Mon Sep 17 00:00:00 2001 From: Nico Hinderling Date: Tue, 12 May 2026 17:57:50 -0700 Subject: [PATCH 2/2] docs(changelog): Add entry for pr_number/base_sha validation --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7848f55e2..0c7edb1025 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +### Fixes + +- (snapshots) Reject snapshot uploads that have a PR number but no base SHA, since comparisons cannot work without a base reference ([#3300](https://github.com/getsentry/sentry-cli/pull/3300)) + ## 3.4.2 ### Fixes