fix(mail): accurate and grammatical new-findings mail #41

Merged
sharang merged 1 commits from fix/findings-mail-wording into main 2026-09-25 22:03:50 +00:00
3 changed files with 44 additions and 33 deletions

No files matched your search

+10 -3
View File
@@ -37,11 +37,18 @@ func TestRender_findingsEnglishAndDefaults(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if m.Subject != "3 new findings in Pump" || !strings.Contains(m.Text, "Critical 1") || !strings.Contains(m.Text, "High 0") {
if m.Subject != "3 new findings in Pump" || !strings.Contains(m.Text, "Critical 1") || strings.Contains(m.Text, "High ") {
t.Fatalf("%q\n%s", m.Subject, m.Text)
}
if de, _ := Render(KindFindingsNew, "fr", View{D: map[string]any{"new_count": 1}}); !strings.Contains(de.Subject, "neue Befunde") {
t.Fatalf("fallback locale: %q", de.Subject)
if !strings.Contains(m.HTML, "Needs review") || strings.Contains(m.HTML, "AI assessment") {
t.Fatalf("html: %s", m.HTML)
}
// JSON numbers arrive as float64: one finding still reads in the singular.
if de, _ := Render(KindFindingsNew, "fr", View{D: map[string]any{"new_count": float64(1), "target_name": "Presse"}}); de.Subject != "1 neuer Befund in Presse" || !strings.Contains(de.Text, "1 Befund ergeben, den es vorher nicht gab") {
t.Fatalf("fallback locale singular: %q\n%s", de.Subject, de.Text)
}
if en, _ := Render(KindFindingsNew, "en", View{D: map[string]any{"new_count": float64(1), "target_name": "Press"}}); en.Subject != "1 new finding in Press" {
t.Fatalf("english singular: %q", en.Subject)
}
if _, err := Render("nope", "de", View{}); err == nil {
t.Fatal("unknown kind rendered")
+17 -15
View File
@@ -1,27 +1,29 @@
{{define "subject"}}{{.D.new_count}} neue Befunde in {{.D.target_name}}{{end}}
{{define "subject"}}{{if eq (printf "%v" .D.new_count) "1"}}1 neuer Befund{{else}}{{.D.new_count}} neue Befunde{{end}} in {{.D.target_name}}{{end}}
{{define "button"}}Befunde ansehen{{end}}
{{define "footer"}}Sie erhalten diese E-Mail, weil Sie den Arbeitsbereich {{.Tenant}} verwalten.{{end}}
{{define "html"}}<p style="margin:0 0 12px 0;font-size:18px;font-weight:bold;">Prüfwerk hat neue Befunde gefunden</p>
<p style="margin:0 0 12px 0;">Die letzte Prüfung von <strong>{{.D.target_name}}</strong> im Arbeitsbereich {{.Tenant}} hat <strong>{{.D.new_count}}</strong> Befunde ergeben, die es vorher nicht gab.</p>
{{define "html"}}<p style="margin:0 0 12px 0;font-size:18px;font-weight:bold;">Neue Befunde in {{.D.target_name}}</p>
<p style="margin:0 0 12px 0;">Die letzte Prüfung von <strong>{{.D.target_name}}</strong> im Arbeitsbereich {{.Tenant}} hat {{if eq (printf "%v" .D.new_count) "1"}}<strong>1</strong> Befund ergeben, den es vorher nicht gab.{{else}}<strong>{{.D.new_count}}</strong> Befunde ergeben, die es vorher nicht gab.{{end}}</p>
<table role="presentation" cellpadding="0" cellspacing="0" style="margin:0 0 14px 0;font-size:13px;">
<tr><td style="padding:3px 14px 3px 0;color:#B3372F;font-weight:bold;">Kritisch</td><td style="padding:3px 0;">{{or .D.critical 0}}</td></tr>
<tr><td style="padding:3px 14px 3px 0;color:#C4612A;font-weight:bold;">Hoch</td><td style="padding:3px 0;">{{or .D.high 0}}</td></tr>
<tr><td style="padding:3px 14px 3px 0;color:#B5761F;">Mittel</td><td style="padding:3px 0;">{{or .D.medium 0}}</td></tr>
<tr><td style="padding:3px 14px 3px 0;color:#414669;">Niedrig / Info</td><td style="padding:3px 0;">{{or .D.low 0}}</td></tr>
{{if .D.critical}}<tr><td style="padding:3px 14px 3px 0;color:#B3372F;font-weight:bold;">Kritisch</td><td style="padding:3px 0;">{{.D.critical}}</td></tr>{{end}}
{{if .D.high}}<tr><td style="padding:3px 14px 3px 0;color:#C4612A;font-weight:bold;">Hoch</td><td style="padding:3px 0;">{{.D.high}}</td></tr>{{end}}
{{if .D.medium}}<tr><td style="padding:3px 14px 3px 0;color:#B5761F;">Mittel</td><td style="padding:3px 0;">{{.D.medium}}</td></tr>{{end}}
{{if .D.low}}<tr><td style="padding:3px 14px 3px 0;color:#414669;">Niedrig / Info</td><td style="padding:3px 0;">{{.D.low}}</td></tr>{{end}}
</table>
<p style="margin:0 0 12px 0;">Jeder Befund hat eine KI-Bewertung, einen Beleg im Code und einen Behebungsvorschlag.</p>{{end}}
{{define "text"}}Prüfwerk hat neue Befunde gefunden
<p style="margin:0 0 12px 0;">Im Befund sehen Sie Fundstelle, Schweregrad und, soweit zugeordnet, die betroffene CRA-Anforderung. Was die automatische Bewertung nicht sicher einordnen konnte, steht auf „Zu prüfen“.</p>{{end}}
{{define "text"}}Neue Befunde in {{.D.target_name}}
Die letzte Prüfung von {{.D.target_name}} im Arbeitsbereich {{.Tenant}} hat {{.D.new_count}} Befunde ergeben, die es vorher nicht gab:
Die letzte Prüfung von {{.D.target_name}} im Arbeitsbereich {{.Tenant}} hat {{if eq (printf "%v" .D.new_count) "1"}}1 Befund ergeben, den es vorher nicht gab:{{else}}{{.D.new_count}} Befunde ergeben, die es vorher nicht gab:{{end}}
{{if .D.critical}}
Kritisch {{.D.critical}}{{end}}{{if .D.high}}
Hoch {{.D.high}}{{end}}{{if .D.medium}}
Mittel {{.D.medium}}{{end}}{{if .D.low}}
Niedrig / Info {{.D.low}}{{end}}
Kritisch {{or .D.critical 0}}
Hoch {{or .D.high 0}}
Mittel {{or .D.medium 0}}
Niedrig / Info {{or .D.low 0}}
Im Befund sehen Sie Fundstelle, Schweregrad und, soweit zugeordnet, die betroffene CRA-Anforderung. Was die automatische Bewertung nicht sicher einordnen konnte, steht auf „Zu prüfen“.
Befunde ansehen:
{{.URL}}
--
Sie erhalten diese E-Mail, weil Sie den Arbeitsbereich {{.Tenant}} verwalten.
BreakPilot GmbH · https://breakpilot.com/impressum{{end}}
Breakpilot GmbH · https://breakpilot.com/impressum{{end}}
+17 -15
View File
@@ -1,27 +1,29 @@
{{define "subject"}}{{.D.new_count}} new findings in {{.D.target_name}}{{end}}
{{define "subject"}}{{if eq (printf "%v" .D.new_count) "1"}}1 new finding{{else}}{{.D.new_count}} new findings{{end}} in {{.D.target_name}}{{end}}
{{define "button"}}View the findings{{end}}
{{define "footer"}}You receive this email because you administer the {{.Tenant}} workspace.{{end}}
{{define "html"}}<p style="margin:0 0 12px 0;font-size:18px;font-weight:bold;">Prüfwerk found new findings</p>
<p style="margin:0 0 12px 0;">The latest scan of <strong>{{.D.target_name}}</strong> in the {{.Tenant}} workspace produced <strong>{{.D.new_count}}</strong> findings that were not there before.</p>
{{define "html"}}<p style="margin:0 0 12px 0;font-size:18px;font-weight:bold;">New findings in {{.D.target_name}}</p>
<p style="margin:0 0 12px 0;">The latest scan of <strong>{{.D.target_name}}</strong> in the {{.Tenant}} workspace produced {{if eq (printf "%v" .D.new_count) "1"}}<strong>1</strong> finding that was not there before.{{else}}<strong>{{.D.new_count}}</strong> findings that were not there before.{{end}}</p>
<table role="presentation" cellpadding="0" cellspacing="0" style="margin:0 0 14px 0;font-size:13px;">
<tr><td style="padding:3px 14px 3px 0;color:#B3372F;font-weight:bold;">Critical</td><td style="padding:3px 0;">{{or .D.critical 0}}</td></tr>
<tr><td style="padding:3px 14px 3px 0;color:#C4612A;font-weight:bold;">High</td><td style="padding:3px 0;">{{or .D.high 0}}</td></tr>
<tr><td style="padding:3px 14px 3px 0;color:#B5761F;">Medium</td><td style="padding:3px 0;">{{or .D.medium 0}}</td></tr>
<tr><td style="padding:3px 14px 3px 0;color:#414669;">Low / info</td><td style="padding:3px 0;">{{or .D.low 0}}</td></tr>
{{if .D.critical}}<tr><td style="padding:3px 14px 3px 0;color:#B3372F;font-weight:bold;">Critical</td><td style="padding:3px 0;">{{.D.critical}}</td></tr>{{end}}
{{if .D.high}}<tr><td style="padding:3px 14px 3px 0;color:#C4612A;font-weight:bold;">High</td><td style="padding:3px 0;">{{.D.high}}</td></tr>{{end}}
{{if .D.medium}}<tr><td style="padding:3px 14px 3px 0;color:#B5761F;">Medium</td><td style="padding:3px 0;">{{.D.medium}}</td></tr>{{end}}
{{if .D.low}}<tr><td style="padding:3px 14px 3px 0;color:#414669;">Low / info</td><td style="padding:3px 0;">{{.D.low}}</td></tr>{{end}}
</table>
<p style="margin:0 0 12px 0;">Every finding comes with an AI assessment, the code evidence and a suggested fix.</p>{{end}}
{{define "text"}}Prüfwerk found new findings
<p style="margin:0 0 12px 0;">Each finding shows where it is, how severe it is and, where mapped, the CRA requirement it concerns. Anything the automated review could not place with confidence is marked “Needs review”.</p>{{end}}
{{define "text"}}New findings in {{.D.target_name}}
The latest scan of {{.D.target_name}} in the {{.Tenant}} workspace produced {{.D.new_count}} findings that were not there before:
The latest scan of {{.D.target_name}} in the {{.Tenant}} workspace produced {{if eq (printf "%v" .D.new_count) "1"}}1 finding that was not there before:{{else}}{{.D.new_count}} findings that were not there before:{{end}}
{{if .D.critical}}
Critical {{.D.critical}}{{end}}{{if .D.high}}
High {{.D.high}}{{end}}{{if .D.medium}}
Medium {{.D.medium}}{{end}}{{if .D.low}}
Low / info {{.D.low}}{{end}}
Critical {{or .D.critical 0}}
High {{or .D.high 0}}
Medium {{or .D.medium 0}}
Low / info {{or .D.low 0}}
Each finding shows where it is, how severe it is and, where mapped, the CRA requirement it concerns. Anything the automated review could not place with confidence is marked “Needs review”.
View the findings:
{{.URL}}
--
You receive this email because you administer the {{.Tenant}} workspace.
BreakPilot GmbH · https://breakpilot.com/impressum{{end}}
Breakpilot GmbH · https://breakpilot.com/impressum{{end}}