Day 33 of 37 ยท Tuesday ยท Learning

The alert ledger you shipped on Jul 21Review

A week after shipping the alert dedup + auto-resolve layer (commit d9b37fc), the ledger is doing its job: one live incident tracked in alert-state.json instead of ~170 duplicate ๐Ÿšจ tasks. Today you review how to read it โ€” and why resolved incidents vanish from it.

Catch-up progress
33/37
Why this matters to you

Your Today list still shows three '๐Ÿšจ PDB relay error' tasks and two 'JobHunt weekly sweep FAILED' tasks. That looks like the dedup layer failing โ€” it isn't. Those are pre-Jul-21 tasks created before the ledger existed, waiting for a one-time manual sweep. Knowing how to tell 'old noise' from 'live incident' is the difference between trusting your alerts and ignoring them.

The ledger (PDB/data/alert-state.json) is a statement of CURRENT reality, not a history log. Each entry is one open incident, keyed by a stable dedup_key like 'jobhunt-sweep'. When the same failure fires again, raise_alert() bumps that entry's count and last_seen instead of creating a second Things task. When the watcher sees recovery, resolve_alert() completes the ๐Ÿšจ task and deletes the entry entirely.

That deletion is the subtle part. Last week plan-day failed five mornings in a row โ€” the ledger held a plan-day incident with count climbing to 5. Open the file today and it's not there. That's not data loss; that's the design: the incident closed itself when Jul 27's run came back green. If you want history, it's in git โ€” the ledger file is committed, so 'git log -p data/alert-state.json' replays every incident's lifecycle.

The fail-safe bias is worth remembering: if the ledger or Things API errors mid-raise, the code falls back to firing a fresh task anyway. The system is allowed to duplicate in a crash; it is never allowed to stay silent. That's why a stray duplicate is a curiosity, not an emergency.

Worked example

Read the live ledger, then replay the plan-day incident's whole life from git:

cat ~/Claude/PDB/data/alert-state.json | python3 -m json.tool

cd ~/Claude/PDB && git log --oneline -p -- data/alert-state.json | grep -A3 'plan-day'
โ–ถ Do it now
  1. Open ~/Claude/PDB/data/alert-state.json and confirm what's live: you should see exactly one incident (jobhunt-sweep). Everything else ๐Ÿšจ in Things Today is pre-ledger noise.
  2. Run the git-history command from the worked example and find the morning the plan-day incident's count peaked, and the commit where the entry disappeared.
  3. Now act on the split: the jobhunt-sweep task is real โ€” leave it (it's today's fix list). Bulk-complete the other stale ๐Ÿšจ tasks in Things knowing the ledger will re-raise anything that's genuinely still broken. That last part is why the sweep is safe.

Gotchas

Go deeper: The dedup layer commit (d9b37fc)
One-card takeaway

The ledger describes what is broken right now; git describes what was ever broken. Sweep Things freely โ€” anything real will re-raise itself.