Skip to content
Open
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
12 changes: 12 additions & 0 deletions src/libs/VersionUtils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
type AppVersion = {
buildNumber?: string;
semanticVersion: string;
};

function getAppVersion(version: string): AppVersion {
const [semanticVersion, buildNumber] = version.split('-');

return {semanticVersion, buildNumber};
}

export default getAppVersion;
5 changes: 4 additions & 1 deletion src/setup/telemetry/setupSentry.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {isDevelopment} from '@libs/Environment/Environment';
import {breadcrumbsIntegration, browserProfilingIntegration, consoleIntegration, navigationIntegration, reportingObserverIntegration, tracingIntegration} from '@libs/telemetry/integrations';
import {processBeforeSendLogs, processBeforeSendTransactions} from '@libs/telemetry/middlewares';
import getAppVersion from '@libs/VersionUtils';

import CONFIG from '@src/CONFIG';
import CONST from '@src/CONST';
Expand All @@ -11,6 +12,7 @@ import pkg from '../../../package.json';
import makeDebugTransport from './debugTransport';

function setupSentry(): void {
const {semanticVersion, buildNumber} = getAppVersion(pkg.version);
const integrations = [navigationIntegration, tracingIntegration, browserProfilingIntegration, breadcrumbsIntegration, consoleIntegration, reportingObserverIntegration].filter(
(integration): integration is NonNullable<typeof integration> => integration !== undefined,
);
Expand All @@ -27,7 +29,8 @@ function setupSentry(): void {
enableUserInteractionTracing: true,
integrations,
environment: CONFIG.ENVIRONMENT,
release: `${pkg.name}@${pkg.version}`,
release: `${pkg.name}@${semanticVersion}`,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Align uploaded web release with runtime release

For production or staging web builds with a build suffix such as 9.4.48-2, events now use release new.expensify@9.4.48 with dist 2, while config/rsbuild/rsbuild.common.ts lines 547-550 still creates the Sentry release and associates commits under new.expensify@9.4.48-2. Because these are distinct Sentry release identifiers, the release receiving events loses the uploaded release metadata and commit association; update the webpack plugin's release name/dist in the same change.

Useful? React with 👍 / 👎.

dist: buildNumber,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Propagate the dist split to native SDK initialization

On Android and iOS builds, the SDK is initialized before JavaScript and autoInitializeNativeSdk remains disabled, but SentryNativeSDKManager.kt line 49 and SentryNativeSDKManager.m lines 69-76 still configure the full 9.4.48-2 value as the release without a dist. Consequently, native errors and JS errors from the same mobile build are assigned to different releases, and native releases retain the sorting problem this change is intended to fix; configure the semantic release and build dist in both native initializers as well.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Read dist in the release-adoption report

Once events use this release/dist split, scripts/sentry/release-adoption-older-than.ts lines 432-447 still queries only release, and its parser requires the release suffix to match major.minor.patch-build. New rows such as new.expensify@9.4.48 therefore fail parsing and are silently excluded, causing the report to undercount users on older builds; query and combine dist with the semantic release before comparing it to the threshold.

Useful? React with 👍 / 👎.

// UPDATE_REQUIRED is not a real error and makes our errors in Spotnana spike and get rate limited when we bump the app min version, so ignore it
ignoreErrors: [CONST.ERROR.UPDATE_REQUIRED],
beforeSendTransaction: processBeforeSendTransactions,
Expand Down
11 changes: 11 additions & 0 deletions tests/unit/libs/VersionUtilsTest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import getAppVersion from '@libs/VersionUtils';

describe('getAppVersion', () => {
it('should split the semantic version from the build number', () => {
expect(getAppVersion('9.4.48-2')).toStrictEqual({semanticVersion: '9.4.48', buildNumber: '2'});
});

it('should support versions without a build number', () => {
expect(getAppVersion('9.4.48')).toStrictEqual({semanticVersion: '9.4.48', buildNumber: undefined});
});
});
Loading