orchestrata_ultimate.governance.exceptions

Reference › orchestrata_ultimate › governance › exceptions

The exception hierarchy of the governance package, rooted at GovernanceError. Its subclasses are PolicyEvaluationError, ConstitutionalViolationError (which carries the article number and a message), EthicalViolationError, SafeModeError, PolicyValidationError, ResourceAccessError, CacheError, PrologClientError and AuditError. dynamic_policy raises PolicyValidationError, safe_mode raises SafeModeError, prolog_client imports it, and the package initialiser re-exports it. The kernel has its own, unrelated PolicyEvaluationError in policy_evaluator.

At a glance

Source src/orchestrata_ultimate/governance/exceptions.py
Lines of code 58
Classes 10
Functions 0
Imports (internal) orchestrata_ultimate.core.base.traces
Imported by orchestrata_ultimate.governance, orchestrata_ultimate.governance.dynamic_policy, orchestrata_ultimate.governance.prolog_client, orchestrata_ultimate.governance.safe_mode
Tests that import it tests/governance/test_dynamic_policy.py, tests/governance/test_dynamic_policy_extended.py, tests/governance/test_error_paths.py, tests/governance/test_exceptions.py, tests/governance/test_prolog_client.py, tests/governance/test_verdict_provenance.py, tests/test_governance.py

Class diagram

Class diagram orchestrata_ultimate.governance.exceptions

Dependency diagram

Dependency diagram orchestrata_ultimate.governance.exceptions

API

Classes

GovernanceError

Bases: Exception · Line 8

Base exception for the governance module.

PolicyEvaluationError

Bases: GovernanceError · Line 12

Error during policy evaluation.

ConstitutionalViolationError

Bases: GovernanceError · Decorators: traces(spec='007', story='US-PGOV-002', reqs=['REQ-007-US-002-003']) · Line 17

A constitutional article was violated.

Method Signature Summary
__init__ __init__(article: int, message: str) -> None

EthicalViolationError

Bases: GovernanceError · Decorators: traces(spec='007', story='US-PGOV-005', reqs=['REQ-007-FR5-008', 'REQ-007-US-005-012']) · Line 30

An ethical boundary was violated.

SafeModeError

Bases: GovernanceError · Line 34

Safe mode prevented an operation.

PolicyValidationError

Bases: GovernanceError · Decorators: traces(spec='007', story='FR-PGOV-006', reqs=['REQ-007-FR6-006']) · Line 39

A policy rule failed validation.

ResourceAccessError

Bases: GovernanceError · Decorators: traces(spec='007', story='US-PGOV-004', reqs=['REQ-007-US-004-010']) · Line 44

Resource access was denied by governance.

CacheError

Bases: GovernanceError · Line 48

Cache operation failed.

PrologClientError

Bases: GovernanceError · Decorators: traces(spec='007', story='FR-PGOV-010', reqs=['REQ-007-FR10-034']) · Line 53

Prolog query or operation failed.

AuditError

Bases: GovernanceError · Line 57

Audit logging operation failed.

Source

Permalink: https://gitlab.com/MSamy/orchestrata-ultimate-architecture/-/blob/a4cbc2bdf/src/orchestrata_ultimate/governance/exceptions.py

"""Governance exception hierarchy for Orchestrata."""

from orchestrata_ultimate.core.base.traces import traces

# Spec: 007a - Prolog Governance


class GovernanceError(Exception):
    """Base exception for the governance module."""


class PolicyEvaluationError(GovernanceError):
    """Error during policy evaluation."""


@traces(spec="007", story="US-PGOV-002", reqs=["REQ-007-US-002-003"])
class ConstitutionalViolationError(GovernanceError):
    """A constitutional article was violated."""

    def __init__(self, article: int, message: str) -> None:
        self.article = article
        super().__init__(f"Article {article} violation: {message}")


@traces(
    spec="007",
    story="US-PGOV-005",
    reqs=["REQ-007-FR5-008", "REQ-007-US-005-012"],
)
class EthicalViolationError(GovernanceError):
    """An ethical boundary was violated."""


class SafeModeError(GovernanceError):
    """Safe mode prevented an operation."""


@traces(spec="007", story="FR-PGOV-006", reqs=["REQ-007-FR6-006"])
class PolicyValidationError(GovernanceError):
    """A policy rule failed validation."""


@traces(spec="007", story="US-PGOV-004", reqs=["REQ-007-US-004-010"])
class ResourceAccessError(GovernanceError):
    """Resource access was denied by governance."""


class CacheError(GovernanceError):
    """Cache operation failed."""


@traces(spec="007", story="FR-PGOV-010", reqs=["REQ-007-FR10-034"])
class PrologClientError(GovernanceError):
    """Prolog query or operation failed."""


class AuditError(GovernanceError):
    """Audit logging operation failed."""