Files
content-ingestion-agent/app/governance.py

18 lines
635 B
Python

from dataclasses import dataclass
from .kab_ingestion.domain.models import SourceDocument
@dataclass(frozen=True)
class GovernanceDecision:
approved: bool
reason: str
def review(document: SourceDocument, require_approval: bool = True) -> GovernanceDecision:
if not document.title.strip() or not document.body.strip():
return GovernanceDecision(False, "title and body are required")
if require_approval and document.metadata.get("governance_approved") is not True:
return GovernanceDecision(False, "governance approval is required")
return GovernanceDecision(True, "document passed governance")