feat: strengthen module contracts and shared WebUI runtime
This commit is contained in:
@@ -16,7 +16,7 @@ from govoplan_core.core.events import (
|
||||
PlatformEvent,
|
||||
current_event_trace,
|
||||
normalize_trace_id,
|
||||
publish_platform_event,
|
||||
emit_platform_event,
|
||||
)
|
||||
from govoplan_core.core.runtime import get_registry
|
||||
from govoplan_core.privacy.retention import sanitize_audit_details_for_policy
|
||||
@@ -171,9 +171,13 @@ class _NullAuditRecorder:
|
||||
)
|
||||
|
||||
|
||||
def _publish_audit_platform_event(item: AuditRecordRef) -> None:
|
||||
def _publish_audit_platform_event(
|
||||
session: Session,
|
||||
item: AuditRecordRef,
|
||||
) -> None:
|
||||
trace = _compact_trace(item.details.get("_trace") if isinstance(item.details, Mapping) else None)
|
||||
publish_platform_event(
|
||||
emit_platform_event(
|
||||
session,
|
||||
PlatformEvent(
|
||||
type=item.action,
|
||||
module_id=_module_id_for_audit_action(item.action),
|
||||
@@ -252,7 +256,7 @@ def audit_event(
|
||||
actor_id=user_id or api_key_id,
|
||||
payload={"scope": scope, "action": action, "object_type": object_type, "object_id": object_id},
|
||||
)
|
||||
_publish_audit_platform_event(item)
|
||||
_publish_audit_platform_event(session, item)
|
||||
if commit:
|
||||
session.commit()
|
||||
return item
|
||||
|
||||
Reference in New Issue
Block a user