From 338bbf5f461516c07a6425743a20444315f1f40e Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Fri, 26 Jun 2026 07:34:34 +0000 Subject: [PATCH 1/3] fix(update): correct inverted version comparison in update nagger Fixes getsentry/sentry-cli#3290 The is_outdated() check compared the fetched release version against the running CLI version in the wrong direction, so the update nagger never prompted when a newer release was available. Add unit tests covering outdated, up-to-date, and dev-build scenarios. --- CHANGELOG.md | 1 + src/utils/update.rs | 39 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d6d708012..63300834fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - (snapshots) Update `snapshots download` to use the new archive endpoint, triggering the archive build and polling until it is ready before downloading ([#3344](https://github.com/getsentry/sentry-cli/pull/3344)) - (snapshots) Show a clear "project was renamed" error instead of a cryptic JSON parse failure when uploading to a renamed project slug ([#3341](https://github.com/getsentry/sentry-cli/pull/3341)) +- Fix update nagger never showing when a newer version is available ([#3290](https://github.com/getsentry/sentry-cli/issues/3290)) ## 3.5.1 diff --git a/src/utils/update.rs b/src/utils/update.rs index 60aab0bc38..d4a51bcd6f 100644 --- a/src/utils/update.rs +++ b/src/utils/update.rs @@ -109,7 +109,7 @@ impl LastUpdateCheck { if let Some(ref release_v) = self.last_fetched_version; if let Some(ref check_v) = self.last_check_version; then { - Version::parse(release_v.as_str()).unwrap() < Version::parse(VERSION).unwrap() && + Version::parse(VERSION).unwrap() < Version::parse(release_v.as_str()).unwrap() && check_v.as_str() == VERSION } else { false @@ -324,3 +324,40 @@ pub fn run_sentrycli_update_nagger() { update_nagger_impl().ok(); } + +#[cfg(test)] +mod tests { + use super::*; + + fn check_with_versions(fetched: &str, checked: &str) -> LastUpdateCheck { + LastUpdateCheck { + last_check_timestamp: Some(Utc::now()), + last_check_version: Some(checked.to_owned()), + last_fetched_version: Some(fetched.to_owned()), + } + } + + #[test] + fn is_outdated_when_running_version_is_behind_latest() { + let check = check_with_versions("99.0.0", VERSION); + assert!(check.is_outdated()); + } + + #[test] + fn is_not_outdated_when_running_version_matches_latest() { + let check = check_with_versions(VERSION, VERSION); + assert!(!check.is_outdated()); + } + + #[test] + fn is_not_outdated_when_latest_is_older_than_running_version() { + let check = check_with_versions("0.0.1", VERSION); + assert!(!check.is_outdated()); + } + + #[test] + fn is_not_outdated_when_last_check_version_differs_from_running_version() { + let check = check_with_versions("99.0.0", "0.0.1"); + assert!(!check.is_outdated()); + } +} From 2e3a3f6517ce80ecc71f982098a04fee41ca3e4d Mon Sep 17 00:00:00 2001 From: Daniel Szoke Date: Fri, 26 Jun 2026 11:01:50 +0200 Subject: [PATCH 2/3] test: remove unnecessary tests --- src/utils/update.rs | 37 ------------------------------------- 1 file changed, 37 deletions(-) diff --git a/src/utils/update.rs b/src/utils/update.rs index d4a51bcd6f..14f787f436 100644 --- a/src/utils/update.rs +++ b/src/utils/update.rs @@ -324,40 +324,3 @@ pub fn run_sentrycli_update_nagger() { update_nagger_impl().ok(); } - -#[cfg(test)] -mod tests { - use super::*; - - fn check_with_versions(fetched: &str, checked: &str) -> LastUpdateCheck { - LastUpdateCheck { - last_check_timestamp: Some(Utc::now()), - last_check_version: Some(checked.to_owned()), - last_fetched_version: Some(fetched.to_owned()), - } - } - - #[test] - fn is_outdated_when_running_version_is_behind_latest() { - let check = check_with_versions("99.0.0", VERSION); - assert!(check.is_outdated()); - } - - #[test] - fn is_not_outdated_when_running_version_matches_latest() { - let check = check_with_versions(VERSION, VERSION); - assert!(!check.is_outdated()); - } - - #[test] - fn is_not_outdated_when_latest_is_older_than_running_version() { - let check = check_with_versions("0.0.1", VERSION); - assert!(!check.is_outdated()); - } - - #[test] - fn is_not_outdated_when_last_check_version_differs_from_running_version() { - let check = check_with_versions("99.0.0", "0.0.1"); - assert!(!check.is_outdated()); - } -} From 41840bdb0d4275f172f53dfa10b1744c6e613dd3 Mon Sep 17 00:00:00 2001 From: Daniel Szoke Date: Fri, 26 Jun 2026 11:09:50 +0200 Subject: [PATCH 3/3] meta: fix the changelog entry to include PR link --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 63300834fc..9f5a13c384 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ - (snapshots) Update `snapshots download` to use the new archive endpoint, triggering the archive build and polling until it is ready before downloading ([#3344](https://github.com/getsentry/sentry-cli/pull/3344)) - (snapshots) Show a clear "project was renamed" error instead of a cryptic JSON parse failure when uploading to a renamed project slug ([#3341](https://github.com/getsentry/sentry-cli/pull/3341)) -- Fix update nagger never showing when a newer version is available ([#3290](https://github.com/getsentry/sentry-cli/issues/3290)) +- Fix update nagger never showing when a newer version is available ([#3347](https://github.com/getsentry/sentry-cli/issues/3347)) ## 3.5.1