From 8ddb9b9570c8e8c81140a19f517ebe9b2c091027 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Br=C3=BCbach?= Date: Sat, 17 Oct 2026 15:16:17 +0200 Subject: [PATCH] [CrashReporting] Send PROJECT_VERSION as the Sentry release MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit main() reported VERSION_STRING (PROJECT_VERSION_FRIENDLY) as the Sentry release — that carries a build date, so every build of the same version landed in its own release, and it never matched the installer, which reports CPACK/PROJECT_VERSION. Bake COCKATRICE_SENTRY_RELEASE= PROJECT_VERSION instead: date-free, identical between client and installer, and derived from the git tag on tag builds, so events, symbol uploads and the installer log all group under one release. --- cmake/CrashReporting.cmake | 6 ++++++ cockatrice/src/client/crash/crash_reporter.h | 4 ++++ cockatrice/src/main.cpp | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/cmake/CrashReporting.cmake b/cmake/CrashReporting.cmake index 7ec0184f3..abd029cc2 100644 --- a/cmake/CrashReporting.cmake +++ b/cmake/CrashReporting.cmake @@ -32,6 +32,12 @@ function(cockatrice_target_enable_crash_reporting _target) endif() # Always baked in (possibly empty): main() prefers the COCKATRICE_SENTRY_DSN env var at runtime. target_compile_definitions(${_target} PRIVATE "COCKATRICE_SENTRY_DSN=\"${COCKATRICE_SENTRY_DSN}\"") + # Sentry release for events from this target: PROJECT_VERSION (getversion.cmake ran before this + # file was included). Deliberately not PROJECT_VERSION_FRIENDLY / VERSION_STRING — that carries + # a build date, so every build of the same version would land in a different Sentry release. + # PROJECT_VERSION matches what the installer reports in its own log and what CPack derives the + # package version from, so client and installer events group under one release. + target_compile_definitions(${_target} PRIVATE "COCKATRICE_SENTRY_RELEASE=\"${PROJECT_VERSION}\"") endfunction() if(WITH_CRASH_REPORTING AND WITH_CLIENT) diff --git a/cockatrice/src/client/crash/crash_reporter.h b/cockatrice/src/client/crash/crash_reporter.h index aa9d98d4d..6ddef6d1e 100644 --- a/cockatrice/src/client/crash/crash_reporter.h +++ b/cockatrice/src/client/crash/crash_reporter.h @@ -20,6 +20,10 @@ #define COCKATRICE_SENTRY_DSN "" #endif +#ifndef COCKATRICE_SENTRY_RELEASE +#define COCKATRICE_SENTRY_RELEASE "" +#endif + Q_DECLARE_LOGGING_CATEGORY(CrashReportLog); /** diff --git a/cockatrice/src/main.cpp b/cockatrice/src/main.cpp index 05f405bf8..64994eb99 100644 --- a/cockatrice/src/main.cpp +++ b/cockatrice/src/main.cpp @@ -301,7 +301,7 @@ int main(int argc, char *argv[]) crashLogAttachedEnvelopes = CrashReporter::attachToPendingCrashEnvelopes( crashDatabasePath, DlgCrashReport::buildRedactedPreview(), QString()); } - crashReporter.init(crashDsn, QString::fromUtf8(VERSION_STRING), crashDatabasePath, crashMode); + crashReporter.init(crashDsn, QString::fromUtf8(COCKATRICE_SENTRY_RELEASE), crashDatabasePath, crashMode); if (crashReporter.isReady() && crashMode == PersonalSettings::CrashReportingMode::AlwaysSend) { // Silent opt-in: cached native crash envelopes flush automatically once consent is given. crashReporter.giveConsent();