Governed asset registry slice with asset creation, representations, metadata, lifecycle transitions, policy authorization, fail-closed denial, audit events, and version records

This commit is contained in:
tegwick 2026-05-06 00:35:30 +02:00
parent d7e38606d2
commit bf59087073
22 changed files with 1259 additions and 6 deletions

View file

@ -0,0 +1,38 @@
"""Policy decision ports for application services."""
from __future__ import annotations
from typing import Any, Protocol
from kontextual_engine.core import OperationContext, PolicyDecision
class PolicyGateway(Protocol):
def authorize(
self,
context: OperationContext,
action: str,
resource: str,
*,
resource_metadata: dict[str, Any] | None = None,
) -> PolicyDecision: ...
class AllowAllPolicyGateway:
"""Deterministic default for local development and tests."""
def authorize(
self,
context: OperationContext,
action: str,
resource: str,
*,
resource_metadata: dict[str, Any] | None = None,
) -> PolicyDecision:
return PolicyDecision.allow(
context.actor.id,
action,
resource,
context={"gateway": "allow-all", "resource_metadata": resource_metadata or {}},
)