fix(db): scheduled VACUUM + persist lastVacuumAt (#4480, #4437)

Adds a scheduled SQLite VACUUM job that persists last-run state to key_value and fixes the hardcoded lastVacuumAt:null in getDatabaseSettings. Review fixes: corrected the key_value write (no updated_at column), dropped a dead/colliding migration, rewrote the test from Vitest to node:test against the real interface.

Integrated into release/v3.8.33.
This commit is contained in:
KooshaPari
2026-06-21 08:29:23 -07:00
committed by GitHub
parent 694adf7e13
commit c5f3d5fb56
12 changed files with 421 additions and 109 deletions

View File

@@ -47,7 +47,7 @@ export const INTENTIONALLY_INTERNAL = new Set([
"comboForecast", // intentionally-internal: src/lib/usage/comboForecast.ts
"commandCodeAuth", // intentionally-internal: 5 API routes em /api/providers/command-code/auth/*
"compression", // intentionally-internal: 2 API routes (settings/compression, context/rtk/config)
"compressionScheduler", // DEAD?: 0 importers na auditoria de 2026-06-11; mantido para schema reservation
"vacuumScheduler", // intentionally-internal: src/instrumentation-node.ts (dynamic import, lifecycle wiring per Rule #2)
"detailedLogs", // intentionally-internal: 3 callers (callLogs.ts, logs/detail route, embeddings handler)
"discovery", // DEAD?: 0 importers na auditoria de 2026-06-11; lib/discovery/index.ts não usa db/discovery
"domainState", // intentionally-internal: 5 callers (batchWriter, circuitBreaker, costRules, fallbackPolicy, lockoutPolicy)

View File

@@ -195,6 +195,9 @@ const DOC_ONLY_ALLOWLIST = new Set([
// Source-code constants referenced in the docs narrative for the local
// endpoints / route-guard classification (PR-3 in #3932).
"LOCAL_ONLY_API_PREFIXES",
// SQL keyword mentioned in the new VACUUM scheduler docs (#4437).
// The check's regex picks up the bare word in description text.
"VACUUM",
]);
// Vars present in .env.example but intentionally absent from ENVIRONMENT.md.