Skip to content

Commit a148337

Browse files
author
Lexecon Dev
committed
fix: make EvidenceConfig.DEFAULT_RETENTION_PERIODS conditional on model imports
When model_governance_pack import fails, ArtifactType is None. The DEFAULT_RETENTION_PERIODS dict was trying to use ArtifactType.DECISION_LOG which threw AttributeError. Now it's conditional on GOVERNANCE_MODELS_AVAILABLE.
1 parent 5b54b26 commit a148337

1 file changed

Lines changed: 14 additions & 11 deletions

File tree

src/lexecon/evidence/service.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,20 @@ def compute_sha256(content: Union[str, bytes]) -> str:
6060
class EvidenceConfig:
6161
"""Configuration for evidence service."""
6262

63-
# Default retention periods by artifact type (in days)
64-
DEFAULT_RETENTION_PERIODS = {
65-
ArtifactType.DECISION_LOG: 2555, # 7 years
66-
ArtifactType.POLICY_SNAPSHOT: 2555, # 7 years
67-
ArtifactType.CONTEXT_CAPTURE: 365, # 1 year
68-
ArtifactType.SCREENSHOT: 365, # 1 year
69-
ArtifactType.ATTESTATION: 2555, # 7 years
70-
ArtifactType.SIGNATURE: 3650, # 10 years
71-
ArtifactType.AUDIT_TRAIL: 2555, # 7 years
72-
ArtifactType.EXTERNAL_REPORT: 2555, # 7 years
73-
}
63+
# Default retention periods by artifact type (in days) — only define if models available
64+
if GOVERNANCE_MODELS_AVAILABLE:
65+
DEFAULT_RETENTION_PERIODS = {
66+
ArtifactType.DECISION_LOG: 2555, # 7 years
67+
ArtifactType.POLICY_SNAPSHOT: 2555, # 7 years
68+
ArtifactType.CONTEXT_CAPTURE: 365, # 1 year
69+
ArtifactType.SCREENSHOT: 365, # 1 year
70+
ArtifactType.ATTESTATION: 2555, # 7 years
71+
ArtifactType.SIGNATURE: 3650, # 10 years
72+
ArtifactType.AUDIT_TRAIL: 2555, # 7 years
73+
ArtifactType.EXTERNAL_REPORT: 2555, # 7 years
74+
}
75+
else:
76+
DEFAULT_RETENTION_PERIODS = {}
7477

7578
# Maximum content size (in bytes)
7679
MAX_CONTENT_SIZE = 100 * 1024 * 1024 # 100 MB

0 commit comments

Comments
 (0)