v0.306.0: R-570 — the off-site note decides on its kind only; the pre-0.251.0 text fallback is deleted
gates / gates (push) Successful in 1m14s

Fleet condition read on each box's settings.json 2026-10-10 (offbox.last_success ~02:16Z on 0.304.0).
Red-proof: the new no-kind row of TestR553_StaleNoteDecisionSurvivesWordingChange failed against the fallback.

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:
2026-10-10 15:08:42 +02:00
parent c255195e37
commit 9e5b88146e
9 changed files with 41 additions and 69 deletions
@@ -4,6 +4,7 @@ import (
"strings"
"testing"
"gitea.dooplex.hu/admin/felhom-controller/internal/backup"
"gitea.dooplex.hu/admin/felhom-controller/internal/settings"
)
@@ -13,8 +14,8 @@ import (
// COMPANION red-proof (recorded in REPORT): make offboxWarningDisplay return lastWarning
// unconditionally → TestOffboxWarningDisplay_Pick's 1-enabled case FAILS.
//
// R-553 (v0.251.0): these calls pass an EMPTY kind on purpose — they are now the LEGACY path, a box
// whose last off-site run predates kinds. The kind path is TestR553_StaleNoteDecisionSurvivesWordingChange.
// R-570 (2026-10-10): the legacy no-kind path is gone; these calls carry the kind the run records. The
// no-kind contract (verbatim) is pinned by TestR553_StaleNoteDecisionSurvivesWordingChange.
const staleZeroToggleWarning = "Sikeres — nincs mentésre jelölt alkalmazás volt a futáskor."
@@ -22,11 +23,11 @@ func TestOffboxWarningDisplay_Pick(t *testing.T) {
s, _, _ := newOffboxWebServer(t)
selectionChanged := s.msgLang("hu", offboxSelectionChangedKey)
// warning + ≥1 enabled → the replacement line
if got := s.offboxWarningDisplay(staleZeroToggleWarning, "", 1, "hu"); got != selectionChanged {
if got := s.offboxWarningDisplay(staleZeroToggleWarning, backup.OffboxWarnNoAppsSelected, 1, "hu"); got != selectionChanged {
t.Errorf("stale warning + 1 toggled: got %q, want the selection-changed line", got)
}
// warning + 0 enabled → the original line, verbatim (the v0.123.0 honesty stays)
if got := s.offboxWarningDisplay(staleZeroToggleWarning, "", 0, "hu"); got != staleZeroToggleWarning {
if got := s.offboxWarningDisplay(staleZeroToggleWarning, backup.OffboxWarnNoAppsSelected, 0, "hu"); got != staleZeroToggleWarning {
t.Errorf("stale warning + 0 toggled: got %q, want the original warning unchanged", got)
}
// any OTHER warning passes through regardless of toggles (quota, partial failure)
@@ -47,9 +48,9 @@ func TestOffboxWarningDisplay_RemotePageRender(t *testing.T) {
data := appRowSplitData()
data["Offbox"] = &settings.OffboxTarget{
Enabled: true, Host: "nas.local", LastStatus: "ok", EscrowState: "escrowed",
LastWarning: staleZeroToggleWarning,
LastWarning: staleZeroToggleWarning, LastWarningKind: backup.OffboxWarnNoAppsSelected,
}
data["OffboxWarningDisplay"] = s.offboxWarningDisplay(staleZeroToggleWarning, "", 1, "hu")
data["OffboxWarningDisplay"] = s.offboxWarningDisplay(staleZeroToggleWarning, backup.OffboxWarnNoAppsSelected, 1, "hu")
html := renderBackupPage(t, "backups_remote", data)
if !strings.Contains(html, selectionChanged) {
t.Error("selection-changed note missing with 1 app toggled")
@@ -64,9 +65,9 @@ func TestOffboxWarningDisplay_RemotePageRender(t *testing.T) {
data["OffboxToggledCount"] = 0
data["Offbox"] = &settings.OffboxTarget{
Enabled: true, Host: "nas.local", LastStatus: "ok", EscrowState: "escrowed",
LastWarning: staleZeroToggleWarning,
LastWarning: staleZeroToggleWarning, LastWarningKind: backup.OffboxWarnNoAppsSelected,
}
data["OffboxWarningDisplay"] = s.offboxWarningDisplay(staleZeroToggleWarning, "", 0, "hu")
data["OffboxWarningDisplay"] = s.offboxWarningDisplay(staleZeroToggleWarning, backup.OffboxWarnNoAppsSelected, 0, "hu")
html = renderBackupPage(t, "backups_remote", data)
if !strings.Contains(html, staleZeroToggleWarning) {
t.Error("0 toggled: the original run warning must render unchanged")