From 3e3c1b1adc98585af2000fc5a84f37580b7b88bb Mon Sep 17 00:00:00 2001 From: John Coffey Date: Wed, 18 Nov 2026 12:12:55 -0700 Subject: [PATCH] Dashboard: DMARC and TLS report warnings as separate items The attention rail added DMARC and TLS report warnings into one count across every domain, so "12 reports with warnings" read as disagreeing with the DMARC reports page, which lists one domain at a time. Each kind now gets its own item, linking to its own reports page, and says the count covers all domains over the dashboard's period. Fixes #218 --- src/features/dashboard/attention.test.ts | 41 ++++++++++++++++++++++++ src/features/dashboard/attention.ts | 38 +++++++++++++++------- src/i18n/en.json | 11 ++++--- 3 files changed, 74 insertions(+), 16 deletions(-) diff --git a/src/features/dashboard/attention.test.ts b/src/features/dashboard/attention.test.ts index 8d9e573..90d6ded 100644 --- a/src/features/dashboard/attention.test.ts +++ b/src/features/dashboard/attention.test.ts @@ -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' }); + }); +}); diff --git a/src/features/dashboard/attention.ts b/src/features/dashboard/attention.ts index 124d69a..156091d 100644 --- a/src/features/dashboard/attention.ts +++ b/src/features/dashboard/attention.ts @@ -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({ diff --git a/src/i18n/en.json b/src/i18n/en.json index 1e5071e..4f39322 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -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}}", -- 2.54.0