fix(34): CR-01 never move a pseudo-version install back to its base release

plugin:update dropped a go.mod require that was not a strict vX.Y.Z and
treated it as v0.0.0, so a module at a commit after v0.4.0
(v0.4.1-0.<ts>-<hash>) was moved back to v0.4.0. kiosk.Newer now places
a release against a release, a git describe string or a pseudo-version
(by the tag it builds on, in Go's version order); plugin:update and the
admin Plugins screen badge share it. A pseudo-version with no tag before
its commit is left alone with a note naming go get <module>@<tag>.
This commit is contained in:
Jakub Zych
2026-10-29 21:58:07 +01:00
parent d30ef5de47
commit 60551485ed
10 changed files with 200 additions and 28 deletions

View File

@@ -324,17 +324,18 @@ func (c *pluginCatalog) applyUpdates(ctx context.Context, overview *PluginsOverv
// applyUpdate sets the registry fields of a listed plugin: Latest is the
// newest release framework allows, an update is available when Latest is
// newer than the installed version's base tag, and LatestFramework names
// the minimum of a newer release that framework does not satisfy. The rule
// is summer plugin:update's.
// newer than the installed version by kiosk.Newer (a git describe string
// or a pseudo-version compares by the release it builds on, so a commit
// after a release is never offered that release or an older one), and
// LatestFramework names the minimum of a newer release that framework
// does not satisfy. The rule is summer plugin:update's.
func applyUpdate(plugin *InstalledPlugin, versions []kiosk.RegistryVersion, framework string) {
plugin.Listed = true
latest, compatible := kiosk.NewestCompatible(versions, framework)
if compatible {
plugin.Latest = latest.Version
}
base := kiosk.BaseVersion(plugin.Version)
if compatible && base != "" && kiosk.CompareVersions(latest.Version, base) > 0 {
if compatible && kiosk.Newer(latest.Version, plugin.Version) {
plugin.UpdateAvailable = true
plugin.UpdateCommand = "summer plugin:update " + plugin.ID
}
@@ -347,7 +348,7 @@ func applyUpdate(plugin *InstalledPlugin, versions []kiosk.RegistryVersion, fram
if newest.Version == "" || (compatible && kiosk.CompareVersions(newest.Version, latest.Version) <= 0) {
return
}
if base != "" && kiosk.CompareVersions(newest.Version, base) <= 0 {
if kiosk.Comparable(plugin.Version) && !kiosk.Newer(newest.Version, plugin.Version) {
return
}
plugin.LatestFramework = newest.Framework