feat: 审核规则持久化到DB + 全面配置去硬编码化

- AuditRule模型: 新增code/config_json字段,支持规则编码和阈值参数持久化
- audit_engine_v2: _load_rules从DB读config_json覆盖默认config
- audit_rule_sync: 启动时自动从_RULE_REGISTRY同步规则到DB(239条)
- settings API: update后刷新query_service配置缓存
- query_service: MAX_ROWS/QUERY_TIMEOUT/MAX_QUERY_LENGTH/MAX_RESULT_MEMORY改为动态读取system_settings
- ticket_executor: SQL_TIMEOUT/REDIS_TIMEOUT/MONGO_TIMEOUT改为动态获取
- settings_seeds: 新增executor分组(sql/redis/mongo超时) + query_result_max_memory_mb
- audit_rule endpoint: 移除无效的AuditEngine缓存清理(每次audit是新实例)
- 测试: 1057 passed(修复所有新引入失败,17个历史遗留)
This commit is contained in:
logan committed 2026-05-25 02:29:52 +08:00
1 parent ddf4856a85
commit a9e214ef1a
11 files changed
+342 -62

No files matched your search

+8
View File
@@ -120,6 +120,14 @@ async def update_settings(
updated.append(setting.key)
await db.commit()
# 刷新 query_service 的配置缓存,使新设置立即生效
try:
from app.services.query_service import refresh_config
await refresh_config()
except Exception:
pass
return {"updated": updated}