9167cf53af
gates / gates (push) Successful in 23s
The hub has written every customer e-mail in Hungarian whatever the box was set to. The box has published its language since controller v0.247.0; nothing read it. Now it does. Nothing an operator reads changes. The Hungarian mails are byte-identical, and that is a diff rather than a reading: 56 goldens per language captured from v0.117.0 BEFORE any string moved, and all 56 Hungarian ones pass unchanged after every sentence was routed through the new bundle. - internal/i18n: flat bundle, 79 keys, hu authoritative + hu fallback, ceiling 0. - customerMessages/severityLabels are DERIVED from the bundle, so a sentence is written in one place and all 40+ tests that read those maps still work. - Language order: last reported -> created-with -> hu. reports.language defaults to EMPTY, never hu: "never told us" is not "chose Hungarian". - message_customer on POST /api/v1/event, additive and optional forever, for the sentences the box composes and the hub cannot translate. - The bind page is per-language, and its `expired` state stays Hungarian: it is the state an unknown token lands in, so rendering a real English customer's token in English would make the LANGUAGE answer what the TEXT refuses to. Two defects found inside the release: - R-581: the newest report was picked by received_at, which has SECOND granularity, so same-second reports tied and the winner was arbitrary. Ordered by the autoincrement id now. GetCustomers() still has the shape - row open. - R-582: the English copy-guard stems, ported word for word from Hungarian, convicted 141 honest sentences. The English claim is a phrase with a modal. R-555 closed: the language allowlist entry is out of wire_contract_gate.py. hub_copy_gate.py follows the sentences into the bundle - without that it would have scanned four files that no longer hold any customer text and reported success. Three new decoys incl. an innocent control. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
50 lines
2.2 KiB
Go
50 lines
2.2 KiB
Go
package api
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
|
|
"gitea.dooplex.hu/admin/felhom-hub/internal/notify"
|
|
)
|
|
|
|
// R-539 — controller_slow_crashloop joins its fast sibling: allowlisted AND operator-only.
|
|
// RED-PROOF: remove it from operatorOnlyEvents → "must be operator-only".
|
|
func TestControllerSlowCrashloopIsAllowlistedAndOperatorOnly(t *testing.T) {
|
|
et := "controller_slow_crashloop"
|
|
if !allowedEventTypes[et] {
|
|
t.Fatalf("%s must be in allowedEventTypes (R-77)", et)
|
|
}
|
|
if !notify.IsOperatorOnly(et) {
|
|
t.Fatalf("%s must be operator-only — host ids and vmids are not a household's business", et)
|
|
}
|
|
}
|
|
|
|
// R-550 — restore_interrupted is pushed by controller v0.246.0 and IS for the household: they started
|
|
// the restore and can run it again. So it must be allowlisted (or POST /event 400s — R-77), must NOT be
|
|
// operator-only, and must carry a Hungarian customer message (a missing entry falls back to the raw
|
|
// English message — the v0.78.0 defect).
|
|
// RED-PROOF: drop the customerMessages entry → the subject/body carry the raw message.
|
|
func TestRestoreInterruptedReachesTheHouseholdInHungarian(t *testing.T) {
|
|
et := "restore_interrupted"
|
|
if !allowedEventTypes[et] {
|
|
t.Fatalf("%s must be in allowedEventTypes — the controller's push would 400", et)
|
|
}
|
|
if notify.IsOperatorOnly(et) {
|
|
t.Fatalf("%s must reach the household, not only the operator", et)
|
|
}
|
|
const raw = "RAW-ENGLISH-SENTINEL restore interrupted"
|
|
// The SUBJECT is built from the Hungarian message alone; the body legitimately repeats the raw
|
|
// message as a detail line ("Üzenet: …"), so the body cannot be the witness — the subject is.
|
|
subject, body := notify.FormatCustomerEmail("hu", "c1", et, "warning", raw, "", "{}")
|
|
if strings.Contains(subject, "RAW-ENGLISH-SENTINEL") {
|
|
t.Fatalf("customer mail subject for %s is the raw message — customerMessages entry missing: %q", et, subject)
|
|
}
|
|
// ASCII fragment of the Hungarian text („megszakadt"), with a negative control.
|
|
if !strings.Contains(body, "megszakadt") {
|
|
t.Fatalf("customer mail for %s lacks the Hungarian sentence (fragment \"megszakadt\")", et)
|
|
}
|
|
if strings.Contains(body, "zzzz-not-present") {
|
|
t.Fatalf("negative control matched — the fragment search is broken")
|
|
}
|
|
}
|