feat: strengthen transactional audit delivery

This commit is contained in:
2026-08-01 17:48:23 +02:00
parent 57ceef0173
commit 4177287b22
4 changed files with 125 additions and 1 deletions
+14
View File
@@ -21,6 +21,7 @@ from govoplan_core.core.events import (
ensure_event_trace,
publish_platform_event,
)
from govoplan_core.core.institutional import GovernedContextEnvelope
EventDispatcher = Callable[[PlatformEvent], None]
@@ -562,6 +563,19 @@ def _event_from_payload(payload: Mapping[str, Any]) -> PlatformEvent:
subject=_object_ref(payload.get("subject")),
resource=_object_ref(payload.get("resource")),
classification=cast(EventClassification, str(payload.get("classification") or "internal")),
institutional_context=_institutional_context(
payload.get("institutional_context")
),
)
def _institutional_context(
value: object,
) -> GovernedContextEnvelope | None:
return (
GovernedContextEnvelope.from_mapping(value)
if isinstance(value, Mapping)
else None
)