From 61dcb6bf13f3d0853d36788930d79bca5f68ece6 Mon Sep 17 00:00:00 2001 From: Artyom Date: Fri, 30 Oct 2026 09:09:15 +0300 Subject: [PATCH] Keep the audit journal of each reconciler pass in its report The driver now stores the audit events a pass writes to stderr next to its JSON report, and the apply check requires one audit.attachment_discarded reason=reconcile for every injected stale intent. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01V1d3RLHNBBMA6UqBLLJv27 --- scripts/reconcile_track.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/reconcile_track.py b/scripts/reconcile_track.py index 3d43f91f..7731e8ab 100644 --- a/scripts/reconcile_track.py +++ b/scripts/reconcile_track.py @@ -78,7 +78,8 @@ def reconcile(*flags, env=None): if code not in (0, 1) or not out.strip(): raise SystemExit(f"reconciler failed ({code}):\n{err[-800:]}") report = json.loads(out) - report.update(exit_code=code, wall_seconds=wall) + audit = [json.loads(line) for line in err.splitlines() if '"audit.' in line] + report.update(exit_code=code, wall_seconds=wall, audit=audit) return report @@ -192,11 +193,15 @@ def faults(c, check, pre): ) first = reconcile("--apply", "--deep", *FLAGS) save("apply-1.json", first) + discarded = sorted(e["attachment_id"] for e in first["audit"] if e["reason"] == "reconcile") check( - "apply исправляет ровно найденное dry-run", - pick(first["fixed"], FIXABLE) == pick(dry["found"], FIXABLE) and not first["errors"], + "apply исправляет ровно найденное dry-run, удаление намерений — в журнале аудита", + pick(first["fixed"], FIXABLE) == pick(dry["found"], FIXABLE) + and not first["errors"] + and discarded == sorted(injected["pending_stale"]), dry_run=pick(dry["found"], FIXABLE), fixed=pick(first["fixed"], FIXABLE), + audit_discarded=len(discarded), ) second = reconcile("--apply", "--deep", *FLAGS) save("apply-2.json", second)