v0.253.0 — errors carry the key of the sentence they are (R-557 slice 2 release B)
gates / gates (push) Successful in 24s

179 Hungarian sentences were built deep inside a package with fmt.Errorf and printed by
whoever caught them: too late to translate where they are shown, too early where they are
made. Every one now carries its key across that gap. ZERO Hungarian error literals remain.

util.MsgError does three things at once, each earned:
  - Error() is the Hungarian, byte for byte, so every un-converted printer is unchanged;
  - errors.Is answers for the kind AND for a wrapped cause (KindErrorf dropped the cause);
  - an error ARGUMENT renders recursively, so "formázás sikertelen: %w" translates whole.
A foreign error — restic, docker, ssh, the stdlib — prints verbatim. It is not ours.

76 display sites go through errText, and TestNoErrErrorInPageOutput convicts any that do
not. memoryVerdict returns an error rather than a sentence, so the deploy's 409 and the
household's language come from one value; UpdateRefusal gained a Cause to carry it.

Plurals, one rule, stated once: a key with .one/.other takes its COUNT first. Not a
per-call-site flag — the producer somebody forgot would read "3 app is not running". The
guard caught a real key collision (alert.deadapp.one) the day the rule landed.

TWO DEFECTS FOUND IN MY OWN TOOLING, recorded rather than quietly fixed. The bulk converter
silently dropped multi-line concatenations, damaging 7 producers — and the parity gate could
not see it, because every surviving fragment WAS a real base literal while the CALL had lost
text; two behaviour tests caught it. And the counting script was case-sensitive, so it said
"0 left" while five remained.

MinAgent: 0.131.0 (unchanged). No hub release needed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
2026-09-18 11:44:30 +02:00
parent 5270bad76e
commit 7c05b59708
70 changed files with 1853 additions and 377 deletions
+15 -17
View File
@@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
"gitea.dooplex.hu/admin/felhom-controller/internal/util"
"os"
"os/exec"
"path/filepath"
@@ -134,7 +135,7 @@ func (m *Manager) offboxLatestSnapshot(ctx context.Context, stack string) (id st
Paths []string `json:"paths"`
}
if json.Unmarshal(out, &snaps) != nil || len(snaps) == 0 {
return "", nil, fmt.Errorf("offbox: nincs pillanatkép a(z) %s alkalmazáshoz", stack)
return "", nil, util.MsgError("err.backup.offbox_nincs_pillanatkep_a_z_alkalmazashoz", stack)
}
best := 0
for i := 1; i < len(snaps); i++ {
@@ -165,7 +166,7 @@ func (m *Manager) offboxSnapshotSize(ctx context.Context, id string) (int64, err
TotalSize int64 `json:"total_size"`
}
if json.Unmarshal(out, &st) != nil || st.TotalSize <= 0 {
return 0, fmt.Errorf("offbox: a(z) %s pillanatkép mérete ismeretlen", id)
return 0, util.MsgError("err.backup.offbox_a_z_pillanatkep_merete_ismeretlen", id)
}
return st.TotalSize, nil
}
@@ -280,9 +281,7 @@ func (m *Manager) offboxScratchDirIn(stack string, rootFor func(string) string,
// drives are physically fine and still mounted, it is their REGISTRATION that the destroyed guest
// took with it — and until v0.207.0 it said only that a drive was missing, which reads like data
// loss and offers nothing to do.
return "", "", fmt.Errorf("nincs regisztrált adatmeghajtó, ezért nincs hová visszaállítani — " +
"a meghajtók megvannak, csak újra kell csatolni őket a Tárhely → Meghajtók oldalon, utána " +
"ez a visszaállítás működni fog")
return "", "", util.MsgError("err.backup.no_registered_drive")
}
// HasRestoreDestination reports whether an offsite restore has anywhere on this box to write.
@@ -347,7 +346,7 @@ func (m *Manager) RestoreOffboxScratch(ctx context.Context, stack string, full b
}
unitPath := offboxUnitPathOf(paths, stack)
if unitPath == "" {
return fmt.Errorf("a(z) %s pillanatképében nincs mentési egység — a visszaállítás nem indítható", stack)
return util.MsgError("err.backup.a_z_pillanatkepeben_nincs_mentesi_egyseg", stack)
}
scratch, nsRoot, err := m.offboxRestoreScratchDir(stack)
if err != nil {
@@ -611,7 +610,7 @@ func mapOffsiteRestorePaths(snapPaths []string, stack, scratch, liveNsRoot strin
}
}
if oldNs == "" {
return nil, fmt.Errorf("a pillanatképben nincs mentési egység (backups/primary/%s)", stack)
return nil, util.MsgError("err.backup.a_pillanatkepben_nincs_mentesi_egyseg_backups", stack)
}
out := make([]placement, 0, len(snapPaths))
for _, p := range snapPaths {
@@ -619,17 +618,17 @@ func mapOffsiteRestorePaths(snapPaths []string, stack, scratch, liveNsRoot strin
// catches p == oldNs (the namespace root itself — F-3a-3), which would otherwise map to a junk
// placement nesting the whole old namespace under the live root.
if !strings.HasPrefix(p, oldNs+"/") {
return nil, fmt.Errorf("a pillanatkép egy útvonala a névtéren kívülre mutat: %s", p)
return nil, util.MsgError("err.backup.a_pillanatkep_egy_utvonala_a_nevteren", p)
}
rel := strings.TrimPrefix(p, oldNs+"/")
for _, seg := range strings.Split(rel, "/") {
if seg == ".." {
return nil, fmt.Errorf("a pillanatkép egy útvonala érvénytelen (..): %s", p)
return nil, util.MsgError("err.backup.a_pillanatkep_egy_utvonala_ervenytelen", p)
}
}
isUnit := rel == "backups/primary/"+stack
if !isUnit && (rel == "backups" || strings.HasPrefix(rel, "backups/")) {
return nil, fmt.Errorf("nem-egység útvonal a fenntartott backups zónában: %s", p)
return nil, util.MsgError("err.backup.nem_egyseg_utvonal_a_fenntartott_backups", p)
}
out = append(out, placement{
src: filepath.Join(scratch, p), // SP-3.1: abs source reconstructed under the target
@@ -662,7 +661,7 @@ func (m *Manager) PlaceOffsiteRestore(ctx context.Context, stack string) error {
return fmt.Errorf("invalid stack name")
}
if err := m.acquireRunning(); err != nil {
return fmt.Errorf("egy másik mentési/visszaállítási művelet már fut")
return util.MsgError("err.backup.egy_masik_mentesi_visszaallitasi_muvelet_mar")
}
defer m.releaseRunning()
@@ -671,7 +670,7 @@ func (m *Manager) PlaceOffsiteRestore(ctx context.Context, stack string) error {
return err
}
if _, sErr := os.Stat(scratch); sErr != nil {
return fmt.Errorf("nincs előkészített teljes visszaállítás — futtass előbb egy teljes visszaállítást")
return util.MsgError("err.backup.nincs_elokeszitett_teljes_visszaallitas_futtass_elobb")
}
id, paths, err := m.offboxLatestSnapshot(ctx, stack)
if err != nil {
@@ -684,14 +683,13 @@ func (m *Manager) PlaceOffsiteRestore(ctx context.Context, stack string) error {
// one, system data path otherwise). For the 13 needs_hdd apps nothing changes; for the 40 that
// were never offered a drive the old test was permanently true and this merge was unreachable.
if !m.isStackDeployed(stack) {
return fmt.Errorf("a(z) %s nincs telepítve — előbb állítsd helyre az alkalmazást, utána az adatokat", stack)
return util.MsgError("err.backup.a_z_nincs_telepitve_elobb_allitsd", stack)
}
hdd := strings.TrimSpace(m.GetAppDrivePath(stack))
if hdd == "" {
// Installed, but the box cannot name its own data root. Distinct reason ⇒ distinct sentence:
// telling the customer to reinstall a running app would hide the real fault.
return fmt.Errorf("a(z) %s telepítve van, de a vezérlő nem tudja megállapítani, hová tartoznak az adatai "+
"(nincs beállítva rendszer-adatterület). Ellenőrizd a tárhely beállításait (Tárhely), utána indítsd újra a visszaállítást", stack)
return util.MsgError("err.backup.no_data_root", stack)
}
liveNs := m.namespaceRoot(hdd)
// F-3a-1b: headroom gate — a missing-only merge copies at most the scratch size; refuse before any
@@ -707,7 +705,7 @@ func (m *Manager) PlaceOffsiteRestore(ctx context.Context, stack string) error {
// unit-only restore, userdata srcs absent) refuses with ZERO copies, making "no partial writes" true.
for _, pl := range placements {
if _, sErr := os.Stat(pl.src); sErr != nil {
return fmt.Errorf("a teljes visszaállítás hiányos (%s nincs meg) — futtass előbb egy teljes visszaállítást", filepath.Base(pl.src))
return util.MsgError("err.backup.a_teljes_visszaallitas_hianyos_nincs_meg", filepath.Base(pl.src))
}
}
copier := m.placeCopier()
@@ -721,7 +719,7 @@ func (m *Manager) PlaceOffsiteRestore(ctx context.Context, stack string) error {
}
n, cErr := copier(pl.src, pl.dst)
if cErr != nil {
return fmt.Errorf("a(z) %s helyreállítása sikertelen: %w", stack, cErr) // scratch KEPT for retry
return util.MsgError("err.backup.a_z_helyreallitasa_sikertelen", stack, cErr) // scratch KEPT for retry
}
placed += n
}