controller v0.272.0: the backup page says when a whole-box backup does not fit (R-685); R-671, R-670, R-677
gates / gates (push) Successful in 26s
gates / gates (push) Successful in 26s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
@@ -210,3 +210,35 @@ func parseImageTag(tag string) (util.Version, string, bool) {
|
||||
}
|
||||
return v, suffix, true
|
||||
}
|
||||
|
||||
// BehindSinceAge is the "Frissítés elérhető — N napja" age, in calendar days (R-677, v0.272.0). For a
|
||||
// DIGEST-ONLY move — every installed ref equals the catalog's and only a newer TESTED digest makes the app
|
||||
// behind (a floating tag re-tested) — the age counts from when that digest was tested (the ladder entry's
|
||||
// tested_at), not from the template's `catalog_since`, which dates the TAG and read „1 napja" for a digest
|
||||
// tested minutes earlier (seen 2026-09-24). Every other case keeps CatalogSinceAge. Both badge producers
|
||||
// call this, so they cannot disagree. Pinned by TestR677_DigestOnlyAgeFromTestedAt.
|
||||
func BehindSinceAge(s Stack, now time.Time) (int, bool) {
|
||||
if digestOnlyBehind(s) && !s.CatalogTestedAt.IsZero() {
|
||||
t := s.CatalogTestedAt.UTC()
|
||||
today := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.UTC)
|
||||
day := time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, time.UTC)
|
||||
if d := int(today.Sub(day).Hours() / 24); d >= 0 {
|
||||
return d, true
|
||||
}
|
||||
return 0, false
|
||||
}
|
||||
return s.Meta.CatalogSinceAge(now)
|
||||
}
|
||||
|
||||
// digestOnlyBehind: every catalog service's ref equals the installed ref, and a newer tested digest exists.
|
||||
func digestOnlyBehind(s Stack) bool {
|
||||
if s.AppConfig == nil || len(s.CatalogImages) == 0 || len(s.AppConfig.InstalledImages) != len(s.CatalogImages) {
|
||||
return false
|
||||
}
|
||||
for svc, want := range s.CatalogImages {
|
||||
if got, ok := s.AppConfig.InstalledImages[svc]; !ok || got.Ref != want {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return digestBehind(s)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user