orchestrata_ultimate.governance.constants

Reference › orchestrata_ultimate › governance › constants

The governance constants (SPEC-007, Prolog governance), values only, with no imports from the project. Most modules of the governance package take their limits from here, including audit, cache, constitutional, monitoring, resource_access and the escalation handler's handler.

The groups: safe mode (3 violations in a 60-second window, a 300-second cooldown); cache sizes and time-to-live values (1000 local entries, 60 seconds local, 300 seconds in Redis) and the Redis key prefixes for cache, metrics, audit, safe mode, violations, violation rate and policy version; resource defaults (protected path prefixes such as /etc and /root, allowed write prefixes under /home/, /workspace/ and /tmp/, and a network allow list of localhost); the constitution (ARTICLE_COUNT of 12, the critical articles 1, 3 and 7, and groups of transparency, fairness and improvement articles); policy limits (at most 10000 rules and a 30-second reload limit); escalation defaults (300 seconds per hop and 3 retries); and severity names.

At a glance

Source src/orchestrata_ultimate/governance/constants.py
Lines of code 71
Classes 0
Functions 0
Imports (internal) none
Imported by orchestrata_ultimate.governance.audit, orchestrata_ultimate.governance.cache, orchestrata_ultimate.governance.constitutional, orchestrata_ultimate.governance.dynamic_policy, orchestrata_ultimate.governance.escalation_handler.handler, orchestrata_ultimate.governance.monitoring, orchestrata_ultimate.governance.resource_access, orchestrata_ultimate.governance.safe_mode, orchestrata_ultimate.governance.violations
Tests that import it tests/governance/test_cache_coverage.py, tests/governance/test_constants.py, tests/governance/test_constitutional.py, tests/governance/test_dynamic_policy_extended.py, tests/governance/test_resource_access.py, tests/test_governance.py

Class diagram

No classes; see Functions.

Dependency diagram

Dependency diagram orchestrata_ultimate.governance.constants

API

No public API: the module defines no classes, functions or constants.

Source

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

"""Governance constants for Orchestrata."""

# Spec: 007a - Prolog Governance

# Safe mode thresholds
SAFE_MODE_VIOLATION_THRESHOLD = 3
SAFE_MODE_WINDOW_SECONDS = 60
SAFE_MODE_COOLDOWN_SECONDS = 300

# Cache settings
CACHE_LOCAL_MAX_SIZE = 1000
CACHE_LOCAL_TTL_SECONDS = 60
CACHE_REDIS_TTL_SECONDS = 300
CACHE_REDIS_PREFIX = "orchestrata:governance:cache"

# Monitoring
MONITORING_WINDOW_SECONDS = 60
MONITORING_REDIS_PREFIX = "orchestrata:governance:metrics"

# Audit
AUDIT_REDIS_PREFIX = "orchestrata:governance:audit"

# Resource access
DEFAULT_PROTECTED_PATHS = [
    "/etc",
    "/usr",
    "/var",
    "/root",
    "/sys",
    "/proc",
    "/dev",
    "/boot",
]
DEFAULT_ALLOWED_WRITE_PREFIXES = ["/home/", "/workspace/", "/tmp/"]
DEFAULT_NETWORK_WHITELIST = ["localhost", "127.0.0.1"]

# Constitutional articles
ARTICLE_COUNT = 12
CRITICAL_ARTICLES = [1, 3, 7]
TRANSPARENCY_ARTICLES = [2, 6, 4]
FAIRNESS_ARTICLES = [5, 9, 10]
IMPROVEMENT_ARTICLES = [8, 11]

# Policy limits
MAX_POLICY_RULES = 10000
POLICY_RELOAD_TIMEOUT_SECONDS = 30

# Audit / violation query defaults
DEFAULT_AUDIT_QUERY_LIMIT = 100  # Default number of records returned per query

# Escalation defaults
DEFAULT_HOP_TIMEOUT_SECONDS = 300  # 5 minutes per escalation hop
DEFAULT_ESCALATION_MAX_RETRIES = 3  # Maximum escalation retry attempts

# Monitoring internal deque sizes
MONITORING_LATENCY_DEQUE_MAXLEN = 10000  # Max latency samples kept in memory

# Redis scan batch size
REDIS_SCAN_BATCH_SIZE = 100  # Number of keys fetched per Redis SCAN iteration

# Violation severity levels
SEVERITY_CRITICAL = "critical"
SEVERITY_HIGH = "high"
SEVERITY_MEDIUM = "medium"
SEVERITY_LOW = "low"

# Redis key prefixes for governance
REDIS_SAFE_MODE_KEY = "orchestrata:governance:safe_mode"
REDIS_VIOLATION_PREFIX = "orchestrata:governance:violations"
REDIS_VIOLATION_RATE_KEY = "orchestrata:governance:violation_rate"
REDIS_POLICY_VERSION_KEY = "orchestrata:governance:policy_version"