Files
content-ingestion-agent/app/governance.py
Jonathan Boniface d8a4b6b3c1
Some checks failed
quality-gates / verify (push) Failing after 7s
fix: files manually
2026-09-01 17:21:58 +01:00

18 lines
627 B
Python

from dataclasses import dataclass
from kab_ingestion.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")