fix(work): fence repeated approval intents and audit state changes atomically

This commit is contained in:
ex_tianzy
2026-11-17 15:21:54 +08:00
parent 03d34f1d55
commit 75c609ded6
15 changed files with 638 additions and 10 deletions
+7
View File
@@ -44,6 +44,9 @@ class Settings(BaseSettings):
work_task_cards_enabled: bool = False
work_remote_approvals_enabled: bool = False
feishu_tenant_key: str = ''
approval_retention_enabled: bool = False
approval_payload_retention_days: int = 30
approval_audit_retention_days: int = 90
work_file_max_bytes: int = 10*1024*1024
work_file_batch_limit: int = 20
work_file_retention: int = 86400
@@ -59,6 +62,10 @@ class Settings(BaseSettings):
@model_validator(mode="after")
def validate_runtime(self):
if not 1<=self.approval_payload_retention_days<=self.approval_audit_retention_days<=365:
raise ValueError('approval retention requires 1 <= payload days <= audit days <= 365')
if self.approval_retention_enabled and not self.work_remote_approvals_enabled:
raise ValueError('approval retention requires remote approvals')
if self.work_remote_approvals_enabled:
if (self.credential_mode!='broker'or self.feishu_event_source!='longconn'
or not self.feishu_enabled or not self.feishu_verification_token