fix(health): re-run integrity check on Refresh health, not just re-read cache
The dashboard's corruption banner refresh action was a no-op for clearing stale corruption flags after the user repaired the DB. Database. scheduleBackgroundIntegrityCheck runs the integrity check exactly once at engine boot and then early-returns forever after, so corruptionDetected was sticky for the life of the process. POST /api/health/refresh just read the cached flag back. Add Database.refreshIntegrityCheck() and TaskStore.refreshDatabaseHealth() which synchronously re-run the integrity check and update the cached state, and have the route use them. After REINDEX / fn db --vacuum / any in-place repair, users can now clear the banner without restarting the engine. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1329,7 +1329,7 @@ export function createServer(store: TaskStore, options?: ServerOptions): ReturnT
|
||||
|
||||
app.post("/api/health/refresh", (_req, res) => {
|
||||
const report = store.refreshTaskIdIntegrityReport();
|
||||
const database = store.getDatabaseHealth();
|
||||
const database = store.refreshDatabaseHealth();
|
||||
res.json({
|
||||
status: !database.healthy || database.corruptionDetected || report.status === "anomaly" ? "degraded" : "ok",
|
||||
version: cliPackageVersion,
|
||||
|
||||
Reference in New Issue
Block a user