feat: SAC 0.7.4 sidebar system stats block with UI toggle

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-02 09:15:15 +10:00
parent cf5a6f995c
commit 3053058cdf
20 changed files with 1082 additions and 255 deletions
+30
View File
@@ -0,0 +1,30 @@
"""GET /api/v1/system/stats"""
from app.services.ui_settings import upsert_ui_settings
def test_system_stats_requires_auth(client):
response = client.get("/api/v1/system/stats")
assert response.status_code == 401
def test_system_stats_visible_default(jwt_headers, client):
response = client.get("/api/v1/system/stats", headers=jwt_headers)
assert response.status_code == 200
body = response.json()
assert body["visible"] is True
assert "collected_at" in body
assert "database" in body
assert body["database"]["status"] in ("ok", "error")
assert "app" in body
assert "events_last_hour" in body["app"]
assert "problems_open" in body["app"]
def test_system_stats_respects_ui_setting(jwt_headers, client, db_session):
upsert_ui_settings(db_session, show_sidebar_system_stats=False)
db_session.commit()
response = client.get("/api/v1/system/stats", headers=jwt_headers)
assert response.status_code == 200
assert response.json()["visible"] is False