Surface reconciliation in the dashboard and keep the view read-only

Two gaps in the baseline-reconciliation feature:

- The dashboard claimed to summarise acknowledged drift, but renderIntegrity()
  never rendered it. Add a `recon` chip to the integrity summary and a
  Reconciliation state-card (accepted/ok/stale counts plus stale items).
- A read-only GET /api/integrity could write the store: list() flushed a
  TTL-lapsed ok->stale transition to disk, violating the read-only dashboard
  invariant. Add list(persist=False) and use it from the web summary path so
  staleness is evaluated in memory without touching the file.

Covered by a new test asserting integrity_report() never rewrites the store.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Luna 2026-06-27 10:39:15 -07:00
parent dbbe35b3fc
commit 9cbdb989ac
4 changed files with 49 additions and 8 deletions

View file

@ -421,11 +421,12 @@ def integrity_report(cfg: Config, status: dict | None = None,
def _reconciliation_summary(cfg: Config) -> dict:
"""Acknowledged-drift counts for the dashboard. Read-only: this evaluates
TTL expiry and persisted status, but does not run live FIM/package scans
from the web request path (consistent with the rest of integrity_report)."""
"""Acknowledged-drift counts for the dashboard. Read-only: it evaluates TTL
expiry and persisted status in memory but never writes the store
(``persist=False``), and does not run live FIM/package scans from the web
request path (consistent with the rest of integrity_report)."""
from . import reconcile
records = reconcile.ReconcileStore.load(cfg).list()
records = reconcile.ReconcileStore.load(cfg).list(persist=False)
stale = [r for r in records if r.status == "stale"]
return {
"total": len(records),