Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
8b8cc24
v2.0.0-beta: 10 autonomous cron workflows + CTO self-merge
germanf Jul 3, 2026
aef15a8
v2.1.0-beta: Phase B — Memory & Self-Improvement (#121)
germanf Jul 3, 2026
8d5bb68
5.3.c — Health check expansion: memory, CPU, backup, MCP, backends
Jul 7, 2026
2843b80
Merge pull request #123 from germanf/feature/health-check-expansion
germanf Jul 7, 2026
21e4d48
5.3.a — Alerting system: webhook channel, REST API, health integratio…
Jul 7, 2026
23f8981
Merge pull request #126 from germanf/feature/alerting-system
germanf Jul 7, 2026
6696218
5.4.a — Real-time SSE Jobs Page: job list + live log viewer with Even…
Jul 7, 2026
6932311
Merge pull request #127 from germanf/feature/realtime-jobs
germanf Jul 7, 2026
8224879
5.1.a — Map-Reduce in Orchestrator: backend factory + endpoint, front…
Jul 7, 2026
7cc90f1
fix: parallelism validation, empty input guard, chunk denominator
Jul 7, 2026
f423b15
Merge pull request #128 from germanf/feature/map-reduce
germanf Jul 9, 2026
06efd24
5.4.b — Alert UI in Dashboard: Active Alerts widget with polling + ac…
Jul 9, 2026
d71689b
fix: ack error handling, consistent polling, remove unused CSS
Jul 9, 2026
7a7abd6
Merge pull request #129 from germanf/feature/alert-ui
germanf Jul 10, 2026
f0124a1
5.3.b — Prometheus metrics endpoint at /metrics with health_check gauge
Jul 10, 2026
7568ebb
Merge pull request #130 from germanf/feature/prometheus-metrics
germanf Jul 10, 2026
cc46e89
5.4.c — Health Timeline: degraded/unavailable lines, summary bar
Jul 10, 2026
35201ea
Merge pull request #131 from germanf/feature/health-timeline
germanf Jul 11, 2026
4333d4e
5.3.d — Backup Integrity Verification: PRAGMA integrity_check on all …
Jul 11, 2026
590c0f1
Merge pull request #132 from germanf/feature/backup-integrity
germanf Oct 28, 2026
c2555db
Merge branch 'main' into dev
germanf Nov 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
5.3.d — Backup Integrity Verification: PRAGMA integrity_check on all …
…existing backups
  • Loading branch information
KyoX
KyoX committed Jul 11, 2026
commit 4333d4e87b01fd183eddfaf80629f84554519747
23 changes: 23 additions & 0 deletions dashboard/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,29 @@ def last_backup_time() -> float | None:
return backups[0].stat().st_mtime if backups else None


def verify_backup_integrity() -> dict:
"""Check all existing backup files for corruption. Returns {ok, corrupt, checked, errors}."""
backup_dir = _get_backup_dir()
backups = sorted(backup_dir.glob("chat.db.*.backup"), key=lambda f: f.stat().st_mtime)
corrupt = []
for b in backups:
try:
con = sqlite3.connect(str(b))
cursor = con.execute("PRAGMA integrity_check")
result = cursor.fetchone()[0]
con.close()
if result != "ok":
corrupt.append(str(b.name))
except Exception:
corrupt.append(str(b.name))
return {
"ok": len(corrupt) == 0,
"checked": len(backups),
"corrupt_count": len(corrupt),
"corrupt_files": corrupt if corrupt else None,
}


def start():
global _task
if _task is not None and not _task.done():
Expand Down
12 changes: 9 additions & 3 deletions dashboard/routes/diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from dashboard.alerts import alerts
from dashboard.backends import list_available as list_available_backends
from dashboard.backup import last_backup_time
from dashboard.backup import last_backup_time, verify_backup_integrity
from dashboard.config import FRONTEND_DIST
from dashboard.config import VAULT_DIR as CONFIG_VAULT_DIR
from dashboard.health import HealthComponent, registry
Expand Down Expand Up @@ -183,14 +183,20 @@ def _check_backup():
try:
last_ts = last_backup_time()
lat = (time.time() - t0) * 1000
integrity = verify_backup_integrity()
details: dict = {"integrity": integrity}
if last_ts is None:
return HealthComponent(name="backup", status="unavailable", latency_ms=lat,
details={"error": "No backups found"})
details=details | {"error": "No backups found"})
age_hours = (time.time() - last_ts) / 3600
st = "healthy" if age_hours < 6 else "degraded" if age_hours < 24 else "unavailable"
if not integrity["ok"]:
st = "degraded"
last_fmt = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime(last_ts))
details["last_backup"] = last_fmt
details["age_hours"] = round(age_hours, 1)
return HealthComponent(name="backup", status=st, latency_ms=lat,
details={"last_backup": last_fmt, "age_hours": round(age_hours, 1)})
details=details)
except Exception as e:
lat = (time.time() - t0) * 1000
return HealthComponent(name="backup", status="unavailable", latency_ms=lat,
Expand Down