Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

fix(status): strip 'v' prefix before comparing versions (#7484) (#11011)

Sandeep pandeyd55003582a7b
diff --git a/frontend/src/utils/app.test.ts b/frontend/src/utils/app.test.ts
new file mode 100644
index 0000000000..8b057f5e6b
--- /dev/null
+++ b/frontend/src/utils/app.test.ts
@@ -0,0 +1,28 @@
+import { checkVersionState } from './app';
+
+describe('checkVersionState', () => {
+ it('returns true when both versions match exactly', () => {
+ expect(checkVersionState('0.76.2', '0.76.2')).toBe(true);
+ });
+
+ it('returns true when current version has a leading "v" and latest does not', () => {
+ expect(checkVersionState('v0.76.2', '0.76.2')).toBe(true);
+ });
+
+ it('returns true when latest version has a leading "v" and current does not', () => {
+ expect(checkVersionState('0.76.2', 'v0.76.2')).toBe(true);
+ });
+
+ it('returns true when both versions have a leading "v"', () => {
+ expect(checkVersionState('v0.76.2', 'v0.76.2')).toBe(true);
+ });
+
+ it('treats pre-release suffix on current as equivalent to the core version', () => {
+ expect(checkVersionState('v0.76.2-rc.1', '0.76.2')).toBe(true);
+ });
+
+ it('returns false for different versions regardless of prefix', () => {
+ expect(checkVersionState('v0.76.1', '0.76.2')).toBe(false);
+ expect(checkVersionState('0.76.1', 'v0.76.2')).toBe(false);
+ });
+});
diff --git a/frontend/src/utils/app.ts b/frontend/src/utils/app.ts
index 42701c06cd..926fddf879 100644
--- a/frontend/src/utils/app.ts
+++ b/frontend/src/utils/app.ts
@@ -16,12 +16,15 @@ export function extractDomain(email: string): string {
return emailParts[1];
}
+const stripVersionPrefix = (version: string): string =>
+ version?.replace(/^v/i, '') ?? '';
+
export const checkVersionState = (
currentVersion: string,
latestVersion: string,
): boolean => {
const versionCore = currentVersion?.split('-')[0];
- return versionCore === latestVersion;
+ return stripVersionPrefix(versionCore) === stripVersionPrefix(latestVersion);
};
// list of forbidden tags to remove in dompurify