Skip to content

feat(cli): show last anomaly in status (#91) - #101

Merged
rbmuller merged 1 commit into
rbmuller:mainfrom
bferanmi806-sketch:feat/91-status-last-anomaly
Sep 28, 2026
Merged

rbmuller merged 1 commit into
rbmuller:mainfrom
bferanmi806-sketch:feat/91-status-last-anomaly

Conversation

@bferanmi806-sketch

Copy link
Copy Markdown
Contributor

Closes #91.

What changed: ProfileStore gains get_latest_anomaly_per_table(), one window-function query returning the latest anomaly per table (highest detected_at, id tie-break, no 30-day window). status() calls it once and attaches last_anomaly ({type, severity, detected_at} or null) to each record. Text output gains a Last Anomaly column ( · , e.g. volume_drop · 2h ago, empty when none); JSON keeps all existing keys. _table_health, persistence, schemas, and connectors untouched.

Tests: pytest tests/test_store.py tests/test_cli.py — 41 passed. Full pytest — 457 passed; 8 failures in test_demo/test_duckdb/test_mcp_server are pre-existing on clean main (verified via stash: identical 8 fail without this change; duckdb/MCP environment issues). ruff check src/ tests/ — all checks passed.

status() fetches the latest anomaly per table with one window-function query and renders it as a Last Anomaly column (text) and last_anomaly record (JSON).
@rbmuller

Copy link
Copy Markdown
Owner

Tested it end to end against scherlok demo data: text and JSON both look right, one query for all tables, and the severity comes through clean. Merging, thanks.

On the 8 failures you mentioned: they don't reproduce here — main is green in CI and locally (465 passed on your branch), so it's likely the duckdb/mcp install in your environment rather than the code.

One small follow-up I'll track separately: in the text table, OK next to volume_drop · just now can read as a contradiction, since Status is a live check and Last Anomaly is history. Showing the severity in that cell would make it clearer.

@rbmuller
rbmuller merged commit fffdbc6 into rbmuller:main Sep 28, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

scherlok status: show the last anomaly per table

2 participants