diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 33faad2..b4d943d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -102,6 +102,9 @@ jobs: )" pre-commit run --from-ref "${BASE_SHA}" --to-ref HEAD + - name: Test decision approval binding + run: python roles/decision_consumer/tests/test_approval_binding.py + - name: Run ansible-lint on changed Ansible files shell: bash run: | diff --git a/CHANGELOG.md b/CHANGELOG.md index 32e16d8..46c5397 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -- No unreleased changes yet. +### Changed + +- Bound decision requests to a deterministic SHA-256 identity of the approval-relevant artefact. The consumer verifies that identity before applying the request's approval posture, rejects invalid or stale approval and incomplete audit context, and preserves the approved identity in the execution record. ## [0.1.6] - 2026-06-14 diff --git a/roles/decision_consumer/README.md b/roles/decision_consumer/README.md index becf374..d458e14 100644 --- a/roles/decision_consumer/README.md +++ b/roles/decision_consumer/README.md @@ -3,3 +3,31 @@ Installs the HybridOps decision consumer as a `systemd` service. The consumer watches dispatch requests, waits for approval when required, and writes normalized execution records. It does not execute `hyops` in v1. + +## Approval binding + +When a dispatch request requires approval, the approval must identify the exact request artefact that was reviewed. The dispatcher writes: + +- `approval_payload_version` +- `approval_artifact_sha256` + +The approval file remains named `.approved.json`, but its contents must include the same identity: + +```json +{ + "dispatch_id": "dispatch-...", + "approval_payload_version": 1, + "approval_artifact_sha256": "", + "approved_by": "operator@example.com", + "approved_at": "2026-09-12T12:00:00Z", + "note": "approved change window" +} +``` + +Immediately before promotion, the consumer recomputes the SHA-256 digest from the current approval-relevant request contents. Promotion is refused when the request identity is missing, when the approval references another request identity, or when the artefact no longer matches what was approved. A stale or invalid approval never produces `approved-ready`. + +`approved_by` and `approved_at` must be non-empty strings. An approval without that audit context is not promoted. + +Every request must retain the identity written by the dispatcher. Routes with `requires_approval: false` keep their existing no-approval behavior after that identity is verified. Their execution records still carry the current artefact identity for provenance. + +The digest binds content; it does not authenticate filesystem writers. Access to the request and approval directories remains a trusted boundary. diff --git a/roles/decision_consumer/templates/decision-consumer.py.j2 b/roles/decision_consumer/templates/decision-consumer.py.j2 index 13e3f9d..1350335 100644 --- a/roles/decision_consumer/templates/decision-consumer.py.j2 +++ b/roles/decision_consumer/templates/decision-consumer.py.j2 @@ -7,6 +7,7 @@ maintainer: HybridOps from __future__ import annotations import datetime +import hashlib import json import time import uuid @@ -16,6 +17,7 @@ ROOT = Path("{{ decision_consumer_root }}") CONFIG_PATH = ROOT / "config" / "config.json" STATE_PATH = ROOT / "state" / "state.json" LOG_PATH = ROOT / "logs" / "consumer.log" +APPROVAL_PAYLOAD_VERSION = 1 def _utc_now() -> str: @@ -28,7 +30,8 @@ def _utc_now_token() -> str: def _read_json(path: Path) -> dict: try: - return json.loads(path.read_text(encoding="utf-8")) + payload = json.loads(path.read_text(encoding="utf-8")) + return payload if isinstance(payload, dict) else {} except Exception: return {} @@ -56,7 +59,48 @@ def _sanitize_token(value: str) -> str: return token or "execution" -def _emit_execution_record(*, request: dict, approval: dict, config: dict, executions_dir: Path) -> dict: +def _approval_payload(request: dict) -> dict: + return { + "version": APPROVAL_PAYLOAD_VERSION, + "source_decision_id": str(request.get("source_decision_id") or ""), + "decision_type": str(request.get("decision_type") or ""), + "execution_plane": str(request.get("execution_plane") or ""), + "target_kind": str(request.get("target_kind") or ""), + "target_ref": str(request.get("target_ref") or ""), + "target_env": str(request.get("target_env") or ""), + "requires_approval": bool(request.get("requires_approval", True)), + "rationale": str(request.get("rationale") or ""), + "checks": request.get("checks") if isinstance(request.get("checks"), list) else [], + } + + +def _approval_artifact_sha256(request: dict) -> str: + encoded = json.dumps( + _approval_payload(request), + ensure_ascii=False, + separators=(",", ":"), + sort_keys=True, + ).encode("utf-8") + return hashlib.sha256(encoded).hexdigest() + + +def _is_sha256(value: object) -> bool: + token = value if isinstance(value, str) else "" + return len(token) == 64 and all(char in "0123456789abcdef" for char in token) + + +def _is_non_empty_string(value: object) -> bool: + return isinstance(value, str) and bool(value.strip()) + + +def _emit_execution_record( + *, + request: dict, + approval: dict, + config: dict, + executions_dir: Path, + approval_artifact_sha256: str, +) -> dict: dispatch_id = str(request.get("dispatch_id") or "") execution_id = ( f"execution-{_utc_now_token()}-" @@ -68,6 +112,8 @@ def _emit_execution_record(*, request: dict, approval: dict, config: dict, execu "status": "approved-ready", "execution_mode": str(config.get("execution_mode") or "approval-only"), "source_dispatch_id": dispatch_id, + "approval_payload_version": APPROVAL_PAYLOAD_VERSION, + "approval_artifact_sha256": approval_artifact_sha256, "decision_type": str(request.get("decision_type") or ""), "execution_plane": str(request.get("execution_plane") or ""), "target_kind": str(request.get("target_kind") or ""), @@ -78,7 +124,11 @@ def _emit_execution_record(*, request: dict, approval: dict, config: dict, execu "approval": { "required": bool(request.get("requires_approval", config.get("require_approval", True))), "approval_file": str(approval.get("_source_file") or ""), + "dispatch_id": str(approval.get("dispatch_id") or ""), + "payload_version": approval.get("approval_payload_version"), + "artifact_sha256": str(approval.get("approval_artifact_sha256") or ""), "approved_by": str(approval.get("approved_by") or ""), + "approved_at": str(approval.get("approved_at") or ""), "note": str(approval.get("note") or ""), }, } @@ -110,12 +160,39 @@ def _process(config: dict, prior: dict) -> dict: if requests_dir.exists(): for path in sorted(requests_dir.glob("*.json")): request = _read_json(path) - dispatch_id = str(request.get("dispatch_id") or path.stem).strip() - if not dispatch_id or dispatch_id in processed: + dispatch_id = str(request.get("dispatch_id") or "").strip() + if dispatch_id in processed: + continue + if not dispatch_id or dispatch_id != path.stem: + pending_count += 1 + last_request_id = path.stem + last_reason = f"invalid-approval-identity:{path.stem}" continue last_request_id = dispatch_id - needs_approval = bool(request.get("requires_approval", require_approval)) + approval_posture = request.get("requires_approval", require_approval) + if not isinstance(approval_posture, bool): + pending_count += 1 + last_reason = f"invalid-approval-identity:{dispatch_id}" + continue + + needs_approval = approval_posture + canonical_request = dict(request) + canonical_request["requires_approval"] = approval_posture + current_artifact_sha256 = _approval_artifact_sha256(canonical_request) + declared_version = request.get("approval_payload_version") + declared_artifact_sha256 = request.get("approval_artifact_sha256") + if declared_version != APPROVAL_PAYLOAD_VERSION or not _is_sha256( + declared_artifact_sha256 + ): + pending_count += 1 + last_reason = f"invalid-approval-identity:{dispatch_id}" + continue + if declared_artifact_sha256 != current_artifact_sha256: + pending_count += 1 + last_reason = f"stale-approval:{dispatch_id}" + continue + approval = {} if needs_approval: approval_path = approvals_dir / f"{dispatch_id}.approved.json" @@ -126,16 +203,41 @@ def _process(config: dict, prior: dict) -> dict: approval = _read_json(approval_path) approval["_source_file"] = str(approval_path) + approval_dispatch_id = str(approval.get("dispatch_id") or "").strip() + approval_version = approval.get("approval_payload_version") + approval_artifact_sha256 = approval.get("approval_artifact_sha256") + if ( + approval_dispatch_id != dispatch_id + or approval_version != APPROVAL_PAYLOAD_VERSION + or not _is_sha256(approval_artifact_sha256) + ): + pending_count += 1 + last_reason = f"invalid-approval-identity:{dispatch_id}" + continue + if approval_artifact_sha256 != current_artifact_sha256: + pending_count += 1 + last_reason = f"stale-approval:{dispatch_id}" + continue + if not ( + _is_non_empty_string(approval.get("approved_by")) + and _is_non_empty_string(approval.get("approved_at")) + ): + pending_count += 1 + last_reason = f"invalid-approval-context:{dispatch_id}" + continue + result = _emit_execution_record( request=request, approval=approval, config=config, executions_dir=executions_dir, + approval_artifact_sha256=current_artifact_sha256, ) processed[dispatch_id] = { "status": result.get("status"), "execution_id": result.get("execution_id"), "execution_file": result.get("execution_file"), + "approval_artifact_sha256": current_artifact_sha256, "timestamp_utc": _utc_now(), } last_execution_id = str(result.get("execution_id") or "") diff --git a/roles/decision_consumer/tests/test_approval_binding.py b/roles/decision_consumer/tests/test_approval_binding.py new file mode 100644 index 0000000..b6bad07 --- /dev/null +++ b/roles/decision_consumer/tests/test_approval_binding.py @@ -0,0 +1,323 @@ +#!/usr/bin/env python3 +"""Acceptance tests for approval binding in the decision pipeline.""" + +from __future__ import annotations + +import json +from pathlib import Path +import tempfile +import unittest + + +REPO_ROOT = Path(__file__).resolve().parents[3] +DISPATCHER_TEMPLATE = REPO_ROOT / "roles/decision_dispatcher/templates/decision-dispatcher.py.j2" +CONSUMER_TEMPLATE = REPO_ROOT / "roles/decision_consumer/templates/decision-consumer.py.j2" + + +def _load_runtime(template: Path, placeholder: str, runtime_root: Path) -> dict: + source = template.read_text(encoding="utf-8").replace(placeholder, str(runtime_root)) + namespace = {"__name__": f"test_{template.stem}"} + exec(compile(source, str(template), "exec"), namespace) + return namespace + + +def _write_json(path: Path, payload: dict) -> None: + path.parent.mkdir(parents=True, exist_ok=True) + path.write_text(json.dumps(payload, sort_keys=True, indent=2), encoding="utf-8") + + +class ApprovalBindingTests(unittest.TestCase): + def setUp(self) -> None: + self.tempdir = tempfile.TemporaryDirectory() + self.root = Path(self.tempdir.name) + self.requests_dir = self.root / "requests" + self.approvals_dir = self.root / "approvals" + self.executions_dir = self.root / "executions" + self.dispatcher = _load_runtime( + DISPATCHER_TEMPLATE, + "{{ decision_dispatcher_root }}", + self.root / "dispatcher", + ) + self.consumer = _load_runtime( + CONSUMER_TEMPLATE, + "{{ decision_consumer_root }}", + self.root / "consumer", + ) + self.dispatcher["REQUESTS_DIR"] = self.requests_dir + + def tearDown(self) -> None: + self.tempdir.cleanup() + + def _dispatch(self, *, requires_approval: bool = True) -> dict: + decision = { + "decision_id": "decision-001", + "decision_type": "cutover", + "rationale": "primary path failed validation", + "checks": [ + {"name": "primary_ready", "status": "failed"}, + {"name": "burst_ready", "status": "passed"}, + ], + } + route = { + "execution_plane": "runner-local", + "target_kind": "blueprint", + "target_ref": "dr/postgresql-ha-failover-gcp@v1", + "target_env": "prod", + "requires_approval": requires_approval, + } + result = self.dispatcher["_emit_dispatch_request"]( + decision=decision, + route=route, + config={"execution_mode": "record-only", "require_approval": True}, + ) + return json.loads(Path(result["request_file"]).read_text(encoding="utf-8")) + + def _consumer_config(self) -> dict: + return { + "dispatch_requests_dir": str(self.requests_dir), + "approval_dir": str(self.approvals_dir), + "executions_dir": str(self.executions_dir), + "execution_mode": "approval-only", + "require_approval": True, + "poll_seconds": 5, + } + + def _write_approval(self, request: dict, **overrides: object) -> Path: + payload = { + "dispatch_id": request["dispatch_id"], + "approval_payload_version": request["approval_payload_version"], + "approval_artifact_sha256": request["approval_artifact_sha256"], + "approved_by": "operator@example.com", + "approved_at": "2026-09-12T12:00:00Z", + "note": "approved for the planned change window", + } + payload.update(overrides) + path = self.approvals_dir / f"{request['dispatch_id']}.approved.json" + _write_json(path, payload) + return path + + def _execution_records(self) -> list[dict]: + if not self.executions_dir.exists(): + return [] + return [ + json.loads(path.read_text(encoding="utf-8")) + for path in sorted(self.executions_dir.glob("*.json")) + ] + + def test_exact_approved_artifact_is_promoted(self) -> None: + request = self._dispatch() + self.assertEqual(request["approval_payload_version"], 1) + self.assertEqual(len(request["approval_artifact_sha256"]), 64) + self.assertEqual( + request["approval_artifact_sha256"], + self.consumer["_approval_artifact_sha256"](request), + ) + self._write_approval(request) + + state = self.consumer["_process"](self._consumer_config(), {}) + records = self._execution_records() + + self.assertEqual(state["processed_count"], 1) + self.assertEqual(state["pending_count"], 0) + self.assertEqual(len(records), 1) + self.assertEqual(records[0]["status"], "approved-ready") + self.assertEqual( + records[0]["approval_artifact_sha256"], + request["approval_artifact_sha256"], + ) + self.assertEqual( + records[0]["approval"]["artifact_sha256"], + request["approval_artifact_sha256"], + ) + self.assertEqual(records[0]["approval"]["approved_by"], "operator@example.com") + + def test_changed_artifact_makes_prior_approval_stale(self) -> None: + request = self._dispatch() + original_digest = request["approval_artifact_sha256"] + self._write_approval(request) + + request["target_ref"] = "dr/postgresql-ha-failover-gcp@v2" + request["approval_artifact_sha256"] = self.consumer["_approval_artifact_sha256"](request) + self.assertNotEqual(request["approval_artifact_sha256"], original_digest) + _write_json(self.requests_dir / f"{request['dispatch_id']}.json", request) + + state = self.consumer["_process"](self._consumer_config(), {}) + + self.assertEqual(state["processed_count"], 0) + self.assertEqual(state["pending_count"], 1) + self.assertEqual(state["reason"], f"stale-approval:{request['dispatch_id']}") + self.assertEqual(self._execution_records(), []) + + self._write_approval(request) + retried = self.consumer["_process"](self._consumer_config(), state) + + self.assertEqual(retried["processed_count"], 1) + self.assertEqual(retried["pending_count"], 0) + self.assertEqual(len(self._execution_records()), 1) + + def test_request_digest_tampering_is_rejected(self) -> None: + request = self._dispatch() + request["approval_artifact_sha256"] = "0" * 64 + _write_json(self.requests_dir / f"{request['dispatch_id']}.json", request) + + state = self.consumer["_process"](self._consumer_config(), {}) + + self.assertEqual(state["processed_count"], 0) + self.assertEqual(state["pending_count"], 1) + self.assertEqual(state["reason"], f"stale-approval:{request['dispatch_id']}") + self.assertEqual(self._execution_records(), []) + + def test_request_dispatch_id_must_match_its_filename(self) -> None: + request = self._dispatch() + original_dispatch_id = request["dispatch_id"] + request["dispatch_id"] = "../../another-request" + _write_json(self.requests_dir / f"{original_dispatch_id}.json", request) + + state = self.consumer["_process"](self._consumer_config(), {}) + + self.assertEqual(state["processed_count"], 0) + self.assertEqual(state["pending_count"], 1) + self.assertEqual( + state["reason"], + f"invalid-approval-identity:{original_dispatch_id}", + ) + self.assertEqual(self._execution_records(), []) + + def test_wrong_request_payload_version_is_rejected(self) -> None: + request = self._dispatch() + request["approval_payload_version"] = 2 + _write_json(self.requests_dir / f"{request['dispatch_id']}.json", request) + + state = self.consumer["_process"](self._consumer_config(), {}) + + self.assertEqual(state["processed_count"], 0) + self.assertEqual(state["pending_count"], 1) + self.assertEqual( + state["reason"], + f"invalid-approval-identity:{request['dispatch_id']}", + ) + self.assertEqual(self._execution_records(), []) + + def test_approval_posture_cannot_be_changed_to_bypass_approval(self) -> None: + request = self._dispatch() + request["requires_approval"] = False + _write_json(self.requests_dir / f"{request['dispatch_id']}.json", request) + + state = self.consumer["_process"](self._consumer_config(), {}) + + self.assertEqual(state["processed_count"], 0) + self.assertEqual(state["pending_count"], 1) + self.assertEqual(state["reason"], f"stale-approval:{request['dispatch_id']}") + self.assertEqual(self._execution_records(), []) + + def test_rationale_and_checks_are_approval_relevant(self) -> None: + request = self._dispatch() + original_digest = request["approval_artifact_sha256"] + mutations = ( + {"rationale": "operator selected another recovery path"}, + {"checks": [{"name": "primary_ready", "status": "passed"}]}, + ) + + for mutation in mutations: + with self.subTest(mutation=mutation): + changed = dict(request) + changed.update(mutation) + self.assertNotEqual( + self.consumer["_approval_artifact_sha256"](changed), + original_digest, + ) + + def test_missing_approval_identity_is_rejected(self) -> None: + request = self._dispatch() + self._write_approval(request, approval_artifact_sha256="") + + state = self.consumer["_process"](self._consumer_config(), {}) + + self.assertEqual(state["processed_count"], 0) + self.assertEqual(state["pending_count"], 1) + self.assertEqual( + state["reason"], + f"invalid-approval-identity:{request['dispatch_id']}", + ) + self.assertEqual(self._execution_records(), []) + + def test_wrong_approval_version_can_be_corrected_and_retried(self) -> None: + request = self._dispatch() + self._write_approval(request, approval_payload_version=2) + + state = self.consumer["_process"](self._consumer_config(), {}) + + self.assertEqual(state["processed_count"], 0) + self.assertEqual(state["pending_count"], 1) + self.assertEqual( + state["reason"], + f"invalid-approval-identity:{request['dispatch_id']}", + ) + self.assertEqual(self._execution_records(), []) + + self._write_approval(request) + retried = self.consumer["_process"](self._consumer_config(), state) + + self.assertEqual(retried["processed_count"], 1) + self.assertEqual(retried["pending_count"], 0) + self.assertEqual(len(self._execution_records()), 1) + + def test_approval_requires_audit_context(self) -> None: + request = self._dispatch() + self._write_approval(request, approved_by="") + + state = self.consumer["_process"](self._consumer_config(), {}) + + self.assertEqual(state["processed_count"], 0) + self.assertEqual(state["pending_count"], 1) + self.assertEqual( + state["reason"], + f"invalid-approval-context:{request['dispatch_id']}", + ) + self.assertEqual(self._execution_records(), []) + + self._write_approval(request, approved_at="") + state = self.consumer["_process"](self._consumer_config(), state) + + self.assertEqual(state["processed_count"], 0) + self.assertEqual(state["pending_count"], 1) + self.assertEqual( + state["reason"], + f"invalid-approval-context:{request['dispatch_id']}", + ) + self.assertEqual(self._execution_records(), []) + + def test_non_object_approval_is_rejected(self) -> None: + request = self._dispatch() + approval_path = self.approvals_dir / f"{request['dispatch_id']}.approved.json" + approval_path.parent.mkdir(parents=True, exist_ok=True) + approval_path.write_text("[]", encoding="utf-8") + + state = self.consumer["_process"](self._consumer_config(), {}) + + self.assertEqual(state["processed_count"], 0) + self.assertEqual(state["pending_count"], 1) + self.assertEqual( + state["reason"], + f"invalid-approval-identity:{request['dispatch_id']}", + ) + self.assertEqual(self._execution_records(), []) + + def test_no_approval_route_retains_existing_semantics(self) -> None: + request = self._dispatch(requires_approval=False) + + state = self.consumer["_process"](self._consumer_config(), {}) + records = self._execution_records() + + self.assertEqual(state["processed_count"], 1) + self.assertEqual(state["pending_count"], 0) + self.assertEqual(len(records), 1) + self.assertFalse(records[0]["approval"]["required"]) + self.assertEqual( + records[0]["approval_artifact_sha256"], + request["approval_artifact_sha256"], + ) + + +if __name__ == "__main__": + unittest.main() diff --git a/roles/decision_dispatcher/README.md b/roles/decision_dispatcher/README.md index b01e822..50fcd0e 100644 --- a/roles/decision_dispatcher/README.md +++ b/roles/decision_dispatcher/README.md @@ -9,3 +9,12 @@ Role scope (v1): - Does not execute HyOps directly. Default behavior is `record-only`. + +Each dispatch request also carries a deterministic approval identity: + +- `approval_payload_version` +- `approval_artifact_sha256` + +The digest covers the approval-relevant request fields, including the decision type, execution plane, target scope, approval posture, rationale and checks. Runtime metadata such as the generated `dispatch_id`, timestamp and request status is kept outside that digest. + +The identity exists even when a route does not require approval so downstream records can preserve the exact request artefact that was promoted. When approval is required, the matching consumer must reject approval that does not reference the current digest. diff --git a/roles/decision_dispatcher/templates/decision-dispatcher.py.j2 b/roles/decision_dispatcher/templates/decision-dispatcher.py.j2 index 83d1358..4b37c72 100644 --- a/roles/decision_dispatcher/templates/decision-dispatcher.py.j2 +++ b/roles/decision_dispatcher/templates/decision-dispatcher.py.j2 @@ -7,6 +7,7 @@ maintainer: HybridOps from __future__ import annotations import datetime +import hashlib import json import time import uuid @@ -17,6 +18,7 @@ CONFIG_PATH = ROOT / "config" / "config.json" STATE_PATH = ROOT / "state" / "state.json" LOG_PATH = ROOT / "logs" / "dispatcher.log" REQUESTS_DIR = ROOT / "state" / "requests" +APPROVAL_PAYLOAD_VERSION = 1 def _utc_now() -> str: @@ -62,6 +64,31 @@ def _route_key_for(decision: dict) -> str: return token +def _approval_payload(request: dict) -> dict: + return { + "version": APPROVAL_PAYLOAD_VERSION, + "source_decision_id": str(request.get("source_decision_id") or ""), + "decision_type": str(request.get("decision_type") or ""), + "execution_plane": str(request.get("execution_plane") or ""), + "target_kind": str(request.get("target_kind") or ""), + "target_ref": str(request.get("target_ref") or ""), + "target_env": str(request.get("target_env") or ""), + "requires_approval": bool(request.get("requires_approval", True)), + "rationale": str(request.get("rationale") or ""), + "checks": request.get("checks") if isinstance(request.get("checks"), list) else [], + } + + +def _approval_artifact_sha256(request: dict) -> str: + encoded = json.dumps( + _approval_payload(request), + ensure_ascii=False, + separators=(",", ":"), + sort_keys=True, + ).encode("utf-8") + return hashlib.sha256(encoded).hexdigest() + + def _emit_dispatch_request(*, decision: dict, route: dict, config: dict) -> dict: route_key = _route_key_for(decision) dispatch_id = ( @@ -86,6 +113,8 @@ def _emit_dispatch_request(*, decision: dict, route: dict, config: dict) -> dict "rationale": str(decision.get("rationale") or decision.get("reason") or ""), "checks": decision.get("checks") if isinstance(decision.get("checks"), list) else [], } + payload["approval_payload_version"] = APPROVAL_PAYLOAD_VERSION + payload["approval_artifact_sha256"] = _approval_artifact_sha256(payload) request_path = REQUESTS_DIR / f"{dispatch_id}.json" REQUESTS_DIR.mkdir(parents=True, exist_ok=True) _write_json(request_path, payload) @@ -93,6 +122,7 @@ def _emit_dispatch_request(*, decision: dict, route: dict, config: dict) -> dict "dispatch_id": dispatch_id, "request_file": str(request_path), "status": status, + "approval_artifact_sha256": payload["approval_artifact_sha256"], } @@ -139,6 +169,7 @@ def _process(config: dict, prior: dict) -> dict: "status": dispatch_result.get("status"), "dispatch_id": dispatch_result.get("dispatch_id"), "request_file": dispatch_result.get("request_file"), + "approval_artifact_sha256": dispatch_result.get("approval_artifact_sha256"), "timestamp_utc": _utc_now(), } last_decision_id = decision_id