package notify import "testing" // R-1150 (v0.159.0) — the refused whole-guest backup pair and the agent's capability pair never reach a // household, under the configuration that would break it: the customer HAS the type in enabled_events and // HAS an e-mail. The operator still gets the warning. (The api package pins the other register: none of // these is in allowedEventTypes, so no box can POST one.) // // COMPANION RED-PROOF (observed 2026-10-19): with the four lines removed from operatorOnlyEvents this fails // with // // r1150_operator_only_test.go: whole_guest_backup_refused: the household was mailed (customer@example.com) — enabled_events opted it in // r1150_operator_only_test.go: agent_capability_degraded: the household was mailed (customer@example.com) — enabled_events opted it in // // Restored. func TestR1150_RefusedBackupAndCapabilityEventsNeverReachTheCustomer(t *testing.T) { // R-1154 (v0.159.0): the reinstall-over-the-old-host warning rides the same register and the same proof. for _, et := range []string{"whole_guest_backup_refused", "agent_capability_degraded", "host_reinstall_over_old_host"} { st := opOnlyStore(t) if err := st.SaveNotificationPrefs("c1", "customer@example.com", []string{et}, 6); err != nil { t.Fatalf("SaveNotificationPrefs: %v", err) } rec := &sentTo{} d := opOnlyDispatcher(t, st, rec) d.ProcessEvent("c1", et, "warning", "Host c1-abc123: test", `{"host_id":"c1-abc123"}`, "hub") var customer, operator bool for _, to := range rec.to { customer = customer || to == "customer@example.com" operator = operator || to == "operator@felhom.eu" } if customer { t.Errorf("%s: the household was mailed (customer@example.com) — enabled_events opted it in", et) } if !operator { t.Errorf("%s: the operator was not mailed — the guard must be customer-only", et) } } for _, et := range []string{"whole_guest_backup_refusal_cleared", "agent_capability_recovered", "host_reenroll_while_live"} { if !operatorOnlyEvents[et] { t.Errorf("%s must be operator-only (the pair's other edge)", et) } } }