Dashboard: DMARC and TLS report warnings as separate items #242

Merged
jcoffey-dev merged 1 commits from fix/218-split-report-warnings into main 2026-11-18 19:16:28 +00:00
3 changed files with 74 additions and 16 deletions

No files matched your search

+41
View File
@@ -49,3 +49,44 @@ describe('buildAttention: scheduled reports (RP-17)', () => {
expect(buildAttention({ ...quiet, failingReports: null })).toEqual([]);
});
});
describe('buildAttention: report warnings (#218)', () => {
const counter = (metric: string, count: number) => ({ '@type': 'Counter' as const, metric, count });
const linkOf = (metrics: string[]) =>
metrics[0].includes('dmarc') ? '/Management/x:DmarcExternalReport' : '/Management/x:TlsExternalReport';
it('lists DMARC and TLS warnings as separate items, each linking to its own page', () => {
const items = buildAttention({
...quiet,
linkOf,
samples: [
counter('incoming-report.dmarc-report-with-warnings', 3),
counter('incoming-report.dmarc-report-with-warnings', 2),
counter('incoming-report.tls-report-with-warnings', 7),
],
});
expect(items).toHaveLength(2);
expect(items[0]).toMatchObject({
id: 'dmarcReports',
count: 5,
title: 'DMARC reports with warnings',
href: '/Management/x:DmarcExternalReport',
});
expect(items[1]).toMatchObject({
id: 'tlsReports',
count: 7,
title: 'TLS reports with warnings',
href: '/Management/x:TlsExternalReport',
});
});
it('shows only the kind that has warnings', () => {
const items = buildAttention({
...quiet,
linkOf,
samples: [counter('incoming-report.tls-report-with-warnings', 1)],
});
expect(items).toHaveLength(1);
expect(items[0]).toMatchObject({ id: 'tlsReports', count: 1, title: 'TLS report with warnings' });
});
});
+26 -12
View File
@@ -203,24 +203,38 @@ export function buildAttention({
detail: t('cc.a.slowDetailPage', 'Performance shows which one.'),
href: slowHref,
});
// DMARC and TLS reports are separate matters with separate pages, so each
// gets its own item (#218). One summed count read as disagreeing with the
// DMARC reports page, which lists one domain at a time.
const dmarc = total(samples, DMARC_WARNINGS);
const tls = total(samples, TLS_WARNINGS);
if (dmarc + tls > 0)
if (dmarc > 0)
attention.push({
id: 'reports',
id: 'dmarcReports',
severity: 'warn',
icon: FileWarning,
count: dmarc + tls,
title: t('cc.a.reports', {
count: dmarc + tls,
defaultValue_one: 'report with warnings',
defaultValue_other: 'reports with warnings',
count: dmarc,
title: t('cc.a.dmarcReports', {
count: dmarc,
defaultValue_one: 'DMARC report with warnings',
defaultValue_other: 'DMARC reports with warnings',
}),
detail: t('cc.a.reportsDetail', 'Other providers flagged how your mail arrived ({{dmarc}} DMARC, {{tls}} TLS).', {
dmarc,
tls,
detail: t('cc.a.dmarcReportsDetail', 'Received this period, across all your domains.'),
href: linkOf(DMARC_WARNINGS),
});
const tls = total(samples, TLS_WARNINGS);
if (tls > 0)
attention.push({
id: 'tlsReports',
severity: 'warn',
icon: FileWarning,
count: tls,
title: t('cc.a.tlsReports', {
count: tls,
defaultValue_one: 'TLS report with warnings',
defaultValue_other: 'TLS reports with warnings',
}),
href: linkOf(dmarc ? DMARC_WARNINGS : TLS_WARNINGS),
detail: t('cc.a.tlsReportsDetail', 'Received this period, across all your domains.'),
href: linkOf(TLS_WARNINGS),
});
if (liveStatus === 'error')
attention.push({
+7 -4
View File
@@ -1810,9 +1810,6 @@
"slow_one": "stage running slow",
"slow_other": "stages running slow",
"slowDetailPage": "Performance shows which one.",
"reports_one": "report with warnings",
"reports_other": "reports with warnings",
"reportsDetail": "Other providers flagged how your mail arrived ({{dmarc}} DMARC, {{tls}} TLS).",
"feed": "Live feed unavailable",
"feedDetail": "Counts come from the server’s records; connection meters are dark.",
"deliverability_one": "blocklist or reverse-DNS problem",
@@ -1820,7 +1817,13 @@
"deliverabilityDetail": "Other mail servers may refuse mail from this one.",
"scheduledReports_one": "scheduled report keeps failing",
"scheduledReports_other": "scheduled reports keep failing",
"scheduledReportsDetail": "Their last two runs failed; the report page says why."
"scheduledReportsDetail": "Their last two runs failed; the report page says why.",
"dmarcReports_one": "DMARC report with warnings",
"dmarcReports_other": "DMARC reports with warnings",
"dmarcReportsDetail": "Received this period, across all your domains.",
"tlsReports_one": "TLS report with warnings",
"tlsReports_other": "TLS reports with warnings",
"tlsReportsDetail": "Received this period, across all your domains."
},
"attention_one": "Needs attention · {{count}}",
"attention_other": "Needs attention · {{count}}",