Skip to content

Commit c1d1a6f

Browse files
author
Lexecon Dev
committed
fix(deploy): fix all conditional class attributes for missing models
Fix AttributeError in evidence, escalation, and risk services when model_governance_pack is not available. All class-level attributes that depend on imported types now check both GOVERNANCE_MODELS_AVAILABLE AND that the specific type is not None before use.
1 parent d76ec62 commit c1d1a6f

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/lexecon/escalation/service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class EscalationConfig:
7272
AUTO_ESCALATE_RISK_LEVEL = RiskLevel.CRITICAL if GOVERNANCE_MODELS_AVAILABLE else None
7373

7474
# SLA deadlines by priority (in hours) — only define if models available
75-
if GOVERNANCE_MODELS_AVAILABLE:
75+
if GOVERNANCE_MODELS_AVAILABLE and EscalationPriority is not None:
7676
SLA_DEADLINES = {
7777
EscalationPriority.CRITICAL: 2, # 2 hours
7878
EscalationPriority.HIGH: 8, # 8 hours

src/lexecon/evidence/service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class EvidenceConfig:
6161
"""Configuration for evidence service."""
6262

6363
# Default retention periods by artifact type (in days) — only define if models available
64-
if GOVERNANCE_MODELS_AVAILABLE:
64+
if GOVERNANCE_MODELS_AVAILABLE and ArtifactType is not None:
6565
DEFAULT_RETENTION_PERIODS = {
6666
ArtifactType.DECISION_LOG: 2555, # 7 years
6767
ArtifactType.POLICY_SNAPSHOT: 2555, # 7 years

src/lexecon/risk/service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class RiskScoringEngine:
7575
}
7676

7777
# Risk level thresholds (defined conditionally to avoid import errors)
78-
if GOVERNANCE_MODELS_AVAILABLE:
78+
if GOVERNANCE_MODELS_AVAILABLE and RiskLevel is not None:
7979
RISK_THRESHOLDS = {
8080
RiskLevel.CRITICAL: 80, # >= 80
8181
RiskLevel.HIGH: 60, # 60-79

0 commit comments

Comments
 (0)