fix(slack): real root cause of notifier spam — preserve all NotifierState fields
Summary
This is the real root cause of the daily-brief spam (and the original trends spam). The Colima/virtiofs cache theory was a red herring — the previous anchor workarounds patched symptoms.
Four notify_* functions silently dropped state fields:
-
notify_pending_approvalsdropped last_trends_digest_at, last_daily_brief_date, etc. -
notify_latest_digestdropped same set -
notify_metric_anomaliesdropped same set -
notify_readiness_changedropped same set
Since run_notifier chains these, by the time notify_daily_brief ran its dedup check, last_daily_brief_date was already reset to "" → the brief re-posted every tick. Same mechanism killed trends dedup.
Fix
Replace every NotifierState(...) reconstruction with dataclasses.replace(state, ...) so unrelated fields carry through. Adding a new field is now safe.
Test plan
-
4 regression tests pin the invariant (38/38 pass) -
APEX Review (semantic_reviewer @ 0.98 confidence) flagged the exact pattern across all four functions -
Monitor notifier for 2-3 ticks post-deploy to confirm no more brief posts
Credit: /audit skill caught this via APEX.