A monthly report on retention that nobody read, converted into three assertions that fail.
-- each of these must return zero rows
SELECT 1 FROM events
WHERE retention_class = 3
AND created_at < DATE_SUB(NOW(), INTERVAL 19 MONTH)
LIMIT 1;
SELECT 1 FROM events
WHERE retention_class = 1
AND created_at < DATE_SUB(NOW(), INTERVAL 25 MONTH)
AND JSON_EXTRACT(payload, '$.anonymised_at') IS NULL
LIMIT 1;
A report describes and an assertion fails, and the difference is whether anybody has to decide to look. The nineteen-month threshold against an eighteen-month policy is the grace the nightly job needs to catch up, which is a number that had to be chosen and is documented next to the query.