Primary finding
Telemetry: global UPDATE provider_metrics SET updated_at runs even when there are no rows, but more importantly is a no-op blanket write
- src/providers/telemetry.ts:168-174
- src/providers/telemetry.ts:277-284
Blanket UPDATE rewriting updated_at on every row of provider_metrics on every flush that has decisions/failures is O(N rows) per flush and corrupts the per-row updated_at meaning — a watcher cannot distinguish 'metrics for X were updated' from 'a decision was logged.' If the UI uses per-row updated_at to detect actual metric churn (which the column is named for), this update creates false positives. Cleaner: add a separate watermark/meta table with a single 'last_event_ts' value; or have the UI watch the decisions/failures tables directly.
Recommendation
Introduce a meta(k,v) table with last_event_ts, or have getLastUpdatedTime() take MAX(updated_at, MAX(timestamp from events)). Avoid mutating every metrics row.