Skip to content

Commit f65c5f3

Browse files
authored
feat: always log StaleMARC/suppressions-DB report skips (#438)
Previously every skip reason (StaleMARC, the suppressions DB, and NoReportsList) was only printed under --verbose, so a report silently skipped via StaleMARC or the suppressions table left no trace in a normal cron run. NoReportsList stays --verbose-only since it's operator-curated and the operator already knows what's in it; the other two are dynamic/external and worth surfacing by default.
1 parent e2304db commit f65c5f3

2 files changed

Lines changed: 34 additions & 7 deletions

File tree

reports/opendmarc-reports.8.in

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,13 +302,27 @@ Print version number and exit.
302302
The script checks the
303303
.I suppressions
304304
database table before sending each report. If the destination RUA/RUF
305-
address, or its domain, appears in that table the report is silently
306-
skipped. The table is also checked at the domain level, so adding a bare
307-
domain name (e.g.
305+
address, or its domain, appears in that table the report is skipped. The
306+
table is also checked at the domain level, so adding a bare domain name
307+
(e.g.
308308
.IR example.com )
309309
suppresses all reports for that domain regardless of their destination
310310
address. Applies to both aggregate and forensic modes.
311311
.PP
312+
Skips caused by the suppressions table or by
313+
.I --stale-check
314+
are always written to standard error, even without
315+
.IR --verbose ,
316+
since these come from dynamic or external sources the operator may not be
317+
expecting. Skips caused by
318+
.B NoReportsList
319+
or
320+
.I --skipdomains
321+
are not, since those are operator-curated and the operator already knows
322+
what they contain; pass
323+
.I --verbose
324+
to see those as well.
325+
.PP
312326
The table is loaded once at startup and is not queried per-message, so
313327
changes take effect on the next run. If the table does not exist (e.g. on
314328
a pre-migration install) the check is skipped and a notice is written to

reports/opendmarc-reports.in

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,18 @@ sub noreports_skip
263263
return 0;
264264
}
265265

266+
# StaleMARC and the suppressions DB are dynamic/external sources that can
267+
# silently drop reports the operator wasn't expecting, so skips they cause
268+
# are always worth printing. NoReportsList is operator-curated -- the
269+
# operator already knows what's in it -- so it stays --verbose-only to
270+
# avoid flooding output when it's used heavily.
271+
sub loud_skip
272+
{
273+
my ($reason) = @_;
274+
275+
return $reason eq "StaleMARC" || $reason eq "suppression DB";
276+
}
277+
266278
# Returns the reason a destination address should be skipped (for logging),
267279
# or undef if it should be sent to. Combines every suppression source so
268280
# the result -- and therefore the recipients who actually get mail -- is
@@ -688,7 +700,7 @@ if ($forensic)
688700
if (defined($reason))
689701
{
690702
print STDERR "$progname: --forensic: skipping report for $reported_domain ($reason)\n"
691-
if $verbose;
703+
if $verbose || loud_skip($reason);
692704
exit($EXIT_SUPPRESSED);
693705
}
694706
}
@@ -728,7 +740,7 @@ if ($forensic)
728740
@rcpts = grep {
729741
my $reason = skip_reason($_);
730742
print STDERR "$progname: --forensic: skipping $_ ($reason)\n"
731-
if defined($reason) && $verbose;
743+
if defined($reason) && ($verbose || loud_skip($reason));
732744
!defined($reason);
733745
} @rcpts;
734746

@@ -1035,7 +1047,8 @@ foreach (@$domainset)
10351047
my $domain_reason = domain_skip_reason($domain);
10361048
if (defined($domain_reason))
10371049
{
1038-
print STDERR "$progname: skipping $domain ($domain_reason)\n" if $verbose;
1050+
print STDERR "$progname: skipping $domain ($domain_reason)\n"
1051+
if $verbose || loud_skip($domain_reason);
10391052
next;
10401053
}
10411054

@@ -1632,7 +1645,7 @@ foreach (@$domainset)
16321645
if (defined($reason))
16331646
{
16341647
print STDERR "$progname: skipping $domain report to $repdest ($reason)\n"
1635-
if $verbose;
1648+
if $verbose || loud_skip($reason);
16361649
next;
16371650
}
16381651
}

0 commit comments

Comments
 (0)