From fdbf7f7e4dabd1eddf8421ca8dd7dd7a37987255 Mon Sep 17 00:00:00 2001 From: Virgil Date: Wed, 1 Apr 2026 22:01:47 +0000 Subject: [PATCH] fix(core-agent): classify prerelease versions correctly Co-Authored-By: Virgil --- cmd/core-agent/update.go | 7 +++++-- cmd/core-agent/update_test.go | 3 +-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/cmd/core-agent/update.go b/cmd/core-agent/update.go index 5f6a114..328e03f 100644 --- a/cmd/core-agent/update.go +++ b/cmd/core-agent/update.go @@ -2,7 +2,10 @@ package main -import agentpkg "dappco.re/go/agent" +import ( + agentpkg "dappco.re/go/agent" + core "dappco.re/go/core" +) // agentpkg.Version = "0.15.0" // updateChannel() // "stable" @@ -10,7 +13,7 @@ func updateChannel() string { switch { case agentpkg.Version == "" || agentpkg.Version == "dev": return "dev" - case agentpkg.Version != "" && (agentpkg.Version[len(agentpkg.Version)-1] >= 'a'): + case core.Contains(agentpkg.Version, "-"): return "prerelease" default: return "stable" diff --git a/cmd/core-agent/update_test.go b/cmd/core-agent/update_test.go index 8111dd9..3d07608 100644 --- a/cmd/core-agent/update_test.go +++ b/cmd/core-agent/update_test.go @@ -43,8 +43,7 @@ func TestUpdate_UpdateChannelNumericSuffix_Ugly(t *testing.T) { t.Cleanup(func() { agentpkg.Version = "" }) - // Ends in '1' which is < 'a', so stable - assert.Equal(t, "stable", updateChannel()) + assert.Equal(t, "prerelease", updateChannel()) } func TestUpdate_ApplicationVersion_Good(t *testing.T) {