From d3eacbb7cc11f220b814792253b231bce365f116 Mon Sep 17 00:00:00 2001 From: kisfenyo Date: Tue, 15 Sep 2026 10:53:20 +0200 Subject: [PATCH] backup tile: unknown size shows a dash, not 0 B (R-517 follow-up, measured on 9201) Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS --- CHANGELOG.md | 9 ++++++++ controller/internal/web/backup_handlers.go | 5 +++++ .../internal/web/backup_tier_view_test.go | 22 +++++++++++++++++++ .../internal/web/templates/backups.html | 2 +- 4 files changed, 37 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c078fe..5574a34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +## Unreleased — after v0.243.0 (2026-09-15) + +- **R-517 follow-up — the whole-system tile printed „0 B" for a backup whose size is unknown.** + Measured live on demo-hp guest 9201 right after the agent's self-update to 0.131.0: the local tier's + success was read back from storage (the agent's in-memory record was empty), and the top card showed + „✓ … 0 B · Helyi tároló (local)". It now shows „–" (`guestBackupView.SizeUnknown`). The per-tier rows + were already right. Red-proof: without the flag, `TestBuildTierViews_SuccessFromStorageAfterRestart` + fails at "tile would print a size it does not know". Ships with the next release; v0.243.0 is live. + ## v0.243.0 — the file manager gets a real password, the backup page tells the truth per tier, an absent tier stops no app, an OOM-killed worker is seen (2026-09-15, R-513 / R-517 / R-518 / R-514) **MinAgent: 0.131.0** (the per-tier backup status and tier storage presence are agent v0.131.0; the controller supervisor rides the same release) diff --git a/controller/internal/web/backup_handlers.go b/controller/internal/web/backup_handlers.go index 97ce0c1..a81f7f5 100644 --- a/controller/internal/web/backup_handlers.go +++ b/controller/internal/web/backup_handlers.go @@ -114,6 +114,10 @@ type guestBackupView struct { CanTrigger bool // a backup trigger (quiesce loop) is wired + // SizeUnknown (R-517): the shown success was read back from storage after an agent restart, so + // its size is not known. The tile prints „–", never „0 B" (measured live on 9201, 2026-09-15). + SizeUnknown bool + // Tiers (R-517, agent >= v0.131.0) is the per-tier truth. Empty on an older agent — the tile then // renders the single latest record as before. Tiers []guestTierView @@ -182,6 +186,7 @@ func buildTierViews(v *guestBackupView, tiers []agentapi.TierBackupState, cadenc if tv.HasSuccess && (t.Primary || !v.HasBackup) && (t.Primary || tv.SuccessAt.After(newestOK)) { v.HasBackup, v.Success = true, true v.StartedAt, v.SizeBytes, v.Target = tv.SuccessAt, tv.SizeBytes, tv.Label + v.SizeUnknown = !tv.SizeKnown newestOK = tv.SuccessAt } v.Tiers = append(v.Tiers, tv) diff --git a/controller/internal/web/backup_tier_view_test.go b/controller/internal/web/backup_tier_view_test.go index c13e768..200bc78 100644 --- a/controller/internal/web/backup_tier_view_test.go +++ b/controller/internal/web/backup_tier_view_test.go @@ -1,6 +1,8 @@ package web import ( + "bytes" + "strings" "testing" "time" @@ -74,4 +76,24 @@ func TestBuildTierViews_SuccessFromStorageAfterRestart(t *testing.T) { if !v.HasBackup || v.Due || v.Tiers[0].SizeKnown { t.Fatalf("after restart: want the local success shown, up to date, size unknown: %+v / due=%v", v.Tiers[0], v.Due) } + // MEASURED LIVE 2026-09-15 on 9201: the top card printed „0 B" for this state. + // RED-PROOF (run 2026-09-15, recorded in REPORT.md): without `v.SizeUnknown = !tv.SizeKnown` + // this failed at "tile would print a size it does not know". + if !v.SizeUnknown { + t.Fatal("tile would print a size it does not know (0 B) for a success read back from storage") + } +} + +// The rendered tile says „–", not „0 B", when the size is unknown. +func TestBackupTile_UnknownSizeRendersDash(t *testing.T) { + s := securityHarness(t) + s.loadTemplates() + v := &guestBackupView{Available: true, HasBackup: true, Success: true, SizeUnknown: true, Target: "Helyi tároló (local)"} + var buf bytes.Buffer + if err := s.tmpl.ExecuteTemplate(&buf, "backups", map[string]interface{}{"Page": "backups", "Title": "t", "GuestBackup": v, "Backup": map[string]interface{}{}}); err != nil { + t.Skipf("backups page needs more data than this harness gives: %v", err) + } + if strings.Contains(buf.String(), ">0 B<") { + t.Fatal("unknown size rendered as 0 B") + } } diff --git a/controller/internal/web/templates/backups.html b/controller/internal/web/templates/backups.html index 01312c6..86acbbe 100644 --- a/controller/internal/web/templates/backups.html +++ b/controller/internal/web/templates/backups.html @@ -93,7 +93,7 @@
-
{{if .HasBackup}}{{fmtBytes .SizeBytes}}{{else}}–{{end}}
+
{{if and .HasBackup (not .SizeUnknown)}}{{fmtBytes .SizeBytes}}{{else}}–{{end}}
{{if .HasBackup}}{{.Target}}{{else}}Méret / cél{{end}}