R-553: four decisions stop reading their own Hungarian words (sites 1-4)

Every Hungarian sentence is byte-identical; each decision now reads a signal set where the message is
made. util.KindErrorf builds the same bytes fmt.Errorf did while carrying a sentinel for errors.Is.

- Deploy status (api/router.go): deployStatusFor() by kind — stacks.ErrAlreadyDeployed (409),
  ErrRequiredField / ErrPathMissing / ErrNotEnoughMemory (400). The „kötelező" / „memória" /
  "does not exist" / "already deployed" text chain is gone.
- Off-site failure class (backup/offbox.go): ErrOffsiteQuota replaces the „tárhelykeretet" match. The
  restic/ssh signatures stay text matches on purpose — that output is not ours and is not translated.
- Alert placement (web/alerts.go): monitor.HealthReport carries WarningKinds parallel to Warnings;
  the "not on a separate drive" warning is inline by KIND. The hub report is untouched (builder.go
  copies Status/Issues/Warnings only) — pinned by a wire test.
- Stale off-site note (web/handlers.go): settings LastWarningKind + backup.OffboxWarnNoAppsSelected.
  The text test survives ONLY for kind == "" (a box whose last run predates 0.251.0) and is removed
  when R-570 closes; slice 2 must not translate that producer before then.

Tests (all red-proofed by restoring the pre-fix predicate — see the audit's redproofs.txt):
TestR553_Deploy_DecisionSurvivesWordingChange, TestR553_DeployHandlerUsesTheKind,
TestR553_DeployProducersCarryKindAndKeepTheirWords (through the real DeployStack),
TestR553_OffsiteQuota_{Decision,HeadLine}SurvivesWordingChange, TestR553_OffboxRunRecordsTheKind,
TestR553_StorageWarningsCarryKindsAndKeepTheirWords, TestR553_DiskWarningPlacementSurvivesWordingChange,
TestR553_HubReportWarningsAreUnchangedOnTheWire, TestR553_StaleNote*, TestR553_WarningKindIsPersistedAndCopied.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
2026-09-17 20:58:45 +02:00
parent e236dca486
commit c00fed6db3
19 changed files with 816 additions and 55 deletions
@@ -12,25 +12,28 @@ import (
// jelölt alkalmazás" run-result for the selection-changed note once ≥1 app is toggled.
// 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.
const staleZeroToggleWarning = "Sikeres — nincs mentésre jelölt alkalmazás volt a futáskor."
func TestOffboxWarningDisplay_Pick(t *testing.T) {
// warning + ≥1 enabled → the replacement line
if got := offboxWarningDisplay(staleZeroToggleWarning, 1); got != offboxSelectionChangedLine {
if got := offboxWarningDisplay(staleZeroToggleWarning, "", 1); got != offboxSelectionChangedLine {
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 := offboxWarningDisplay(staleZeroToggleWarning, 0); got != staleZeroToggleWarning {
if got := offboxWarningDisplay(staleZeroToggleWarning, "", 0); 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)
quota := "A tároló a keret 84%-át használja (42/50 GB)."
if got := offboxWarningDisplay(quota, 3); got != quota {
if got := offboxWarningDisplay(quota, "", 3); got != quota {
t.Errorf("non-stale warning must pass through verbatim, got %q", got)
}
// no warning → no line
if got := offboxWarningDisplay("", 2); got != "" {
if got := offboxWarningDisplay("", "", 2); got != "" {
t.Errorf("empty warning must stay empty, got %q", got)
}
}
@@ -42,7 +45,7 @@ func TestOffboxWarningDisplay_RemotePageRender(t *testing.T) {
Enabled: true, Host: "nas.local", LastStatus: "ok", EscrowState: "escrowed",
LastWarning: staleZeroToggleWarning,
}
data["OffboxWarningDisplay"] = offboxWarningDisplay(staleZeroToggleWarning, 1)
data["OffboxWarningDisplay"] = offboxWarningDisplay(staleZeroToggleWarning, "", 1)
html := renderBackupPage(t, "backups_remote", data)
if !strings.Contains(html, offboxSelectionChangedLine) {
t.Error("selection-changed note missing with 1 app toggled")
@@ -59,7 +62,7 @@ func TestOffboxWarningDisplay_RemotePageRender(t *testing.T) {
Enabled: true, Host: "nas.local", LastStatus: "ok", EscrowState: "escrowed",
LastWarning: staleZeroToggleWarning,
}
data["OffboxWarningDisplay"] = offboxWarningDisplay(staleZeroToggleWarning, 0)
data["OffboxWarningDisplay"] = offboxWarningDisplay(staleZeroToggleWarning, "", 0)
html = renderBackupPage(t, "backups_remote", data)
if !strings.Contains(html, staleZeroToggleWarning) {
t.Error("0 toggled: the original run warning must render unchanged")