v0.253.0 — errors carry the key of the sentence they are (R-557 slice 2 release B)
gates / gates (push) Successful in 24s
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:
@@ -5,6 +5,7 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"gitea.dooplex.hu/admin/felhom-controller/internal/util"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
@@ -59,7 +60,7 @@ func defaultSharesPassdbRestore(tar []byte) error {
|
||||
// exists (the F-6C-1 ownership-fidelity lesson).
|
||||
func (m *Manager) sharesRestoreScratchDir() (scratch, nsRoot string, err error) {
|
||||
if m.settings == nil {
|
||||
return "", "", fmt.Errorf("nincs elérhető adatmeghajtó a visszaállításhoz")
|
||||
return "", "", util.MsgError("err.backup.nincs_elerheto_adatmeghajto_a_visszaallitashoz")
|
||||
}
|
||||
pick := func(networkOK bool) (string, string, bool) {
|
||||
for _, sp := range m.settings.GetSchedulableStoragePaths() {
|
||||
@@ -78,7 +79,7 @@ func (m *Manager) sharesRestoreScratchDir() (scratch, nsRoot string, err error)
|
||||
m.logger.Printf("[WARN] [shares] restore scratch on network storage — ownership fidelity not guaranteed under squash")
|
||||
return s, nr, nil
|
||||
}
|
||||
return "", "", fmt.Errorf("nincs elérhető adatmeghajtó a visszaállításhoz")
|
||||
return "", "", util.MsgError("err.backup.nincs_elerheto_adatmeghajto_a_visszaallitashoz")
|
||||
}
|
||||
|
||||
// RestoreSharesScratch restores the latest `_shares` snapshot into the scratch dir. Non-destructive:
|
||||
@@ -97,19 +98,19 @@ func (m *Manager) RestoreSharesScratch(ctx context.Context) error {
|
||||
}
|
||||
defer m.releaseRunning()
|
||||
if !m.OffboxConfigured() {
|
||||
return fmt.Errorf("a távoli mentés nincs beállítva")
|
||||
return util.MsgError("err.backup.a_tavoli_mentes_nincs_beallitva")
|
||||
}
|
||||
scratch, nsRoot, err := m.sharesRestoreScratchDir()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if free := m.offboxFree()(nsRoot); free > 0 && free < offboxUnitOnlyFreeFloor {
|
||||
return fmt.Errorf("Nincs elég szabad hely a visszaállításhoz (%s szükséges, %s szabad).",
|
||||
return util.MsgError("err.backup.nincs_eleg_szabad_hely_a_visszaallitashoz",
|
||||
humanizeBytes(offboxUnitOnlyFreeFloor), humanizeBytes(free))
|
||||
}
|
||||
id, _, err := m.offboxLatestSnapshot(ctx, SharesPseudoStack)
|
||||
if err != nil {
|
||||
return fmt.Errorf("nincs visszaállítható megosztás-mentés: %w", err)
|
||||
return util.MsgError("err.backup.nincs_visszaallithato_megosztas_mentes", err)
|
||||
}
|
||||
if err := os.MkdirAll(scratch, 0o755); err != nil {
|
||||
return fmt.Errorf("restore dir: %w", err)
|
||||
@@ -121,7 +122,7 @@ func (m *Manager) RestoreSharesScratch(ctx context.Context) error {
|
||||
m.unlockStale(rctx, base, env)
|
||||
out, rerr := m.resticStep(rctx, env, base, "restore:"+SharesPseudoStack, "restore", id, "--target", scratch)
|
||||
if rerr != nil {
|
||||
return fmt.Errorf("a megosztások visszaállítása sikertelen: %w: %s", rerr, truncate(out))
|
||||
return util.MsgError("err.backup.a_megosztasok_visszaallitasa_sikertelen", rerr, truncate(out))
|
||||
}
|
||||
m.logger.Printf("[INFO] [shares] restored snapshot %s → %s", id, scratch)
|
||||
return nil
|
||||
@@ -197,10 +198,10 @@ func (m *Manager) readSharesManifestFrom(scratch string) (SharesManifest, error)
|
||||
p := filepath.Join(scratchJoin(scratch, m.sharesPayloadDir()), sharesManifestName)
|
||||
blob, err := os.ReadFile(p)
|
||||
if err != nil {
|
||||
return mf, fmt.Errorf("a mentésben nincs megosztás-leíró: %w", err)
|
||||
return mf, util.MsgError("err.backup.a_mentesben_nincs_megosztas_leiro", err)
|
||||
}
|
||||
if err := json.Unmarshal(blob, &mf); err != nil {
|
||||
return mf, fmt.Errorf("a megosztás-leíró olvashatatlan: %w", err)
|
||||
return mf, util.MsgError("err.backup.a_megosztas_leiro_olvashatatlan", err)
|
||||
}
|
||||
return mf, nil
|
||||
}
|
||||
@@ -212,7 +213,7 @@ func (m *Manager) readSharesManifestFrom(scratch string) (SharesManifest, error)
|
||||
func (m *Manager) PlaceSharesRestore(ctx context.Context) (SharesRestoreResult, error) {
|
||||
var res SharesRestoreResult
|
||||
if err := m.acquireRunning(); err != nil {
|
||||
return res, fmt.Errorf("egy másik mentési/visszaállítási művelet már fut")
|
||||
return res, util.MsgError("err.backup.egy_masik_mentesi_visszaallitasi_muvelet_mar")
|
||||
}
|
||||
defer m.releaseRunning()
|
||||
|
||||
@@ -221,7 +222,7 @@ func (m *Manager) PlaceSharesRestore(ctx context.Context) (SharesRestoreResult,
|
||||
return res, err
|
||||
}
|
||||
if _, sErr := os.Stat(scratch); sErr != nil {
|
||||
return res, fmt.Errorf("nincs előkészített visszaállítás — futtass előbb egy megosztás-visszaállítást")
|
||||
return res, util.MsgError("err.backup.nincs_elokeszitett_visszaallitas_futtass_elobb_egy")
|
||||
}
|
||||
mf, err := m.readSharesManifestFrom(scratch)
|
||||
if err != nil {
|
||||
@@ -248,7 +249,7 @@ func (m *Manager) PlaceSharesRestore(ctx context.Context) (SharesRestoreResult,
|
||||
if _, sErr := os.Stat(src); sErr == nil {
|
||||
n, cErr := copier(src, sh.Path)
|
||||
if cErr != nil {
|
||||
return res, fmt.Errorf("a(z) „%s” megosztás fájljainak visszaállítása sikertelen: %w", sh.Name, cErr)
|
||||
return res, util.MsgError("err.backup.a_z_megosztas_fajljainak_visszaallitasa_sikertelen", sh.Name, cErr)
|
||||
}
|
||||
res.FilesRestored += n
|
||||
res.SharesPlaced = append(res.SharesPlaced, sh.Name)
|
||||
|
||||
Reference in New Issue
Block a user