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

@ -593,7 +593,8 @@ function renderIntegrity(){
"watchdog "+(checks.watchdog||"unknown"),
"fim "+(checks.fim_baseline||"unknown"),
"pkgdb "+(checks.pkgdb_anchor||"unknown"),
"siglevel "+(checks.pacman_siglevel||"unknown")
"siglevel "+(checks.pacman_siglevel||"unknown"),
"recon "+(checks.reconciliation||"unknown")
]));
summary.append(el("div","fine","Generated "+new Date((report.generated_at||0)*1000).toLocaleString()));
box.append(summary);
@ -653,6 +654,28 @@ function renderIntegrity(){
footCard.append(paths);
grid.append(footCard);
const recon = report.reconciliation || {total:0, ok:0, stale:0, stale_items:[]};
const reconCard = el("article","state-card "+(recon.stale ? "review" : "ok"));
reconCard.append(el("h3",null,"Reconciliation"));
addStateLine(reconCard,"accepted",recon.total);
addStateLine(reconCard,"ok",recon.ok);
addStateLine(reconCard,"stale",recon.stale);
if((recon.stale_items||[]).length){
const stale = el("div","path-list");
recon.stale_items.forEach(it=>{
const row = el("div","path-row missing");
row.append(el("b",null,"stale"));
row.append(el("span",null,it.kind+" "+it.target+" — "+(it.reason||"")));
stale.append(row);
});
reconCard.append(stale);
} else if(recon.total){
reconCard.append(el("div","fine","All acknowledgements still match live state."));
} else {
reconCard.append(el("div","fine","No acknowledged drift."));
}
grid.append(reconCard);
box.append(grid);
}
function renderRules(){