fix(nodes): stop flagging a node on the other update channel as outdated

A node's "update available" tag compares its reported panel version with the
master's latest, and any non-semver side fell back to string inequality. A
dev build reports dev+<sha> (config.GetPanelVersion), so a node moved to the
dev channel from a master on the stable channel kept the tag forever; the
reverse, a stable node under a master on the dev channel, was flagged too and
the tag's default stable update installed nothing new.

A dev label and a release tag carry no order, so the comparison now only
decides within one channel; dev-to-dev still compares commits, which keeps a
node on the current dev-latest commit untagged as config.go intends.
This commit is contained in:
Sanaei
2026-09-15 21:21:36 +02:00
parent 1d85ef138e
commit 14b92fbcff
2 changed files with 10 additions and 0 deletions
+3
View File
@@ -28,6 +28,9 @@ export function formatPanelVersion(version: string | undefined | null): string {
export function isPanelUpdateAvailable(latest: string, current: string): boolean { export function isPanelUpdateAvailable(latest: string, current: string): boolean {
if (!latest || !current) return false; if (!latest || !current) return false;
// A dev+<sha> label and a release tag sit on different channels and carry no
// order, so a node moved to the other channel is not "behind" the master's latest.
if (latest.trim().startsWith('dev+') !== current.trim().startsWith('dev+')) return false;
const a = parseVersionParts(latest); const a = parseVersionParts(latest);
const b = parseVersionParts(current); const b = parseVersionParts(current);
if (!a || !b) { if (!a || !b) {
+7
View File
@@ -30,6 +30,13 @@ describe('isPanelUpdateAvailable', () => {
expect(isPanelUpdateAvailable('nightly-2', 'nightly-1')).toBe(true); expect(isPanelUpdateAvailable('nightly-2', 'nightly-1')).toBe(true);
expect(isPanelUpdateAvailable('nightly-1', 'nightly-1')).toBe(false); expect(isPanelUpdateAvailable('nightly-1', 'nightly-1')).toBe(false);
}); });
it('compares dev builds by commit and never across channels', () => {
expect(isPanelUpdateAvailable('dev+1a2b3c4d', 'dev+0f0f0f0f')).toBe(true);
expect(isPanelUpdateAvailable('dev+1a2b3c4d', 'dev+1a2b3c4d')).toBe(false);
expect(isPanelUpdateAvailable('v3.5.0', 'dev+1a2b3c4d')).toBe(false);
expect(isPanelUpdateAvailable('dev+1a2b3c4d', '3.5.0')).toBe(false);
});
}); });
describe('formatPanelVersion', () => { describe('formatPanelVersion', () => {