Files
felhom-controller/controller/internal/web/a_version_travel_test.go
T
admin fd28d70bff v0.308.0: controller batch 2026-10-12 — clear-address warning (R-922), secret sweep over every page (R-255), read_failed (R-266), no NVMe heat band (R-333), share globe (R-577), Hungarian dates and numbers (R-562), lost-drive option pinned (R-521)
Operator rulings 2026-10-12, 09 §3 decisions 196, 204-207, 223, 227. MinAgent 0.131.0 unchanged.
R-255's sweep found one leak, fixed here: an optional-config secret_input was rendered into its
settings page; it is now revealed on demand. Hungarian parity fixtures re-captured once for R-562.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
2026-10-12 15:13:59 +02:00

49 lines
2.0 KiB
Go

package web
import (
"strings"
"testing"
"time"
)
// TestA3_RestoredVersionSentence — the FIRST sentence after a restore of an older version (v0.275.0,
// `07` §6.6, D4 option A), both languages, and its absence when nothing changed. The brief's wording is
// the contract: which backup, which version, and what happens next.
func TestA3_RestoredVersionSentence(t *testing.T) {
s := noteServer(t)
at := time.Date(2026, 9, 26, 7, 29, 45, 0, time.UTC)
pins := []string{"docmost/docmost:0.96.0@sha256:b5", "postgres:16-alpine", "redis:7-alpine"}
s.versionPosition = func(string) (bool, bool) { return true, true }
got := s.restoredVersionPrefix("docmost", true, pins, at)
for _, want := range []string{"A(z) docmost visszaállt a(z) 2026. 09. 26. ", "-i mentésből", "docmost:0.96.0, postgres:16-alpine, redis:7-alpine verzióra", "lépésenként hozza naprakészre"} {
if !strings.Contains(got, want) {
t.Errorf("hu: missing %q in %q", want, got)
}
}
if !strings.HasSuffix(got, " ") {
t.Errorf("the prefix must end with a space before the outcome sentence: %q", got)
}
if err := s.settings.SetLanguage("en"); err != nil {
t.Fatal(err)
}
got = s.restoredVersionPrefix("docmost", true, pins, at)
if !strings.Contains(got, "docmost is back from the backup of 2026-09-26 ") || !strings.Contains(got, "one step at a time") {
t.Errorf("en: %q", got)
}
// No tested step leads on from the restored version: say the box will not update it by itself.
s.versionPosition = func(string) (bool, bool) { return true, false }
if got := s.restoredVersionPrefix("docmost", true, pins, at); !strings.Contains(got, "does not update it by itself") {
t.Errorf("no ladder step: %q", got)
}
// Nothing changed, or the app is not behind: no sentence.
if got := s.restoredVersionPrefix("docmost", false, pins, at); got != "" {
t.Errorf("unchanged version: %q", got)
}
s.versionPosition = func(string) (bool, bool) { return false, false }
if got := s.restoredVersionPrefix("docmost", true, pins, at); got != "" {
t.Errorf("not behind: %q", got)
}
}