mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-20 18:23:47 +00:00
22ce58cb9b
Slice 13 added the drift refusal path but only logged at WARN level — the audit history showed nothing, so an operator reviewing the action trail could not see "Pulse caught this drift attempt." Now the drift branch writes a Failed audit record with Result.ErrorMessage prefixed "plan_drift:" and dispatches a Failed lifecycle event before returning ErrActionPlanDrift. The record carries the same Request, Plan, and Approvals snapshots that a normal audit record would, so the operator-facing audit row shows exactly what was attempted and what was approved. The "plan_drift:" prefix is a stable token for downstream surfaces (audit UI filters, alert rules) to distinguish drift refusals from generic execution failures. Extends TestExecuteCommandWithAuditRefusesPayloadDriftAgainstApprovedPlan to assert the audit record exists with State=Failed and the plan_drift error message after refusal. Updates the code-standards snippet check for ErrActionPlanDrift to match gofmt's actual alignment in actions.go. ai-runtime contract pinned with the audit-record-on-drift rule.