WeKnora/docs
wizardchen ff1f03ce0d feat(rbac): daily retention sweep for audit_logs (default 90 days)
The audit_logs table grows monotonically until something purges it.
PR 6 explicitly listed retention as out of scope for v1; this picks
that up.

Adds an `audit.retention_days` config (default 90, 0 disables) and a
small background goroutine `AuditLogRetentionRunner` that fires once
~10 minutes after boot and then every 24h, calling
`AuditLogService.Purge` which DELETEs rows older than the cutoff in a
single statement. The dependency surface is intentionally minimal —
no robfig/cron, no asynq, no migration — because retention has no
wall-clock alignment requirement.

Wiring is the same shape as the existing data source scheduler:
container `Provide(NewAuditLogRetentionRunner)`, an `Invoke` that
calls `Start`, and a `ResourceCleaner.RegisterWithName` for graceful
shutdown.

Defaults preserve operator intent:
  - `audit:` section omitted from YAML  -> retention_days=90.
  - explicit `audit.retention_days: 0` in YAML  -> purge disabled.
  - `WEKNORA_AUDIT_RETENTION_DAYS=N` env override (incl. N=0).
  - `retention_days < 0` is rejected by ValidateConfig.

Tests cover the service Purge contract (no-op when disabled, cutoff
math, error propagation) and the runner lifecycle (Start no-op when
disabled, idempotent Start/Stop, ticker cadence, runOnce swallows
errors). 10 new tests, all green.

docs/rbac.md updated with the new YAML / env / behaviour.

Refs: #1303
2026-05-18 17:28:58 +08:00
..
api feat(knowledge-base): validate vector store bindings on create, copy, and delete 2026-05-18 15:58:46 +08:00
cloud-image docs(cloud-image): add cloud-agnostic image packaging scripts 2026-05-11 12:25:19 +08:00
images docs(readme): enhance layout for Agent Mode and Observability sections across multiple languages 2026-04-27 15:27:24 +08:00
wiki docs(api): restore auth.md and update README/wiki links 2026-05-12 13:16:58 +08:00
zh feat(agent): human-in-the-loop approval for MCP tool calls (#1173) 2026-05-10 22:57:12 +08:00
BUILTIN_MCP_SERVICES.md feat: add built-in MCP service support 2026-03-05 21:57:01 +08:00
BUILTIN_MODELS.md feat:add several mainstream model providers 2026-01-14 17:08:26 +08:00
CHUNKING.md fix(chunking): post-review polish — error surfacing + doc accuracy 2026-05-06 17:17:07 +08:00
IM集成开发文档.md add oidc 2026-03-30 11:13:44 +08:00
KnowledgeGraph.md docs: 更新多语言文档,新增知识图谱与MCP配置指南及目录结构 2025-11-19 16:56:49 +08:00
LITE.md feat: add LAN access configuration for desktop app, allowing users to enable public API access with corresponding UI updates and translations 2026-04-11 18:51:16 +08:00
Langfuse集成.md feat(observability): instrument agent ReAct loop and tool calls in Langfuse 2026-04-24 19:58:08 +08:00
MCP功能使用说明.md feat: Revamp conversation configuration management and enhance localization 2025-11-18 23:18:43 +08:00
OIDC认证调用流程.md simplify oidc callback result payload 2026-04-01 20:47:18 +08:00
QA.md chore(release): v0.5.0 2026-04-27 12:23:02 +08:00
ROADMAP.md feat(roadmap): update progress on document parsing and IM integration 2026-03-31 20:22:34 +08:00
agent-skills.md feat: adjust sandbox setting of agentConfig 2026-02-04 20:08:49 +08:00
docs.go feat(system-info): surface DB migration errors with troubleshooting links 2026-05-14 16:34:50 +08:00
migration-troubleshooting.md feat(system-info): surface DB migration errors with troubleshooting links 2026-05-14 16:34:50 +08:00
rbac.md feat(rbac): daily retention sweep for audit_logs (default 90 days) 2026-05-18 17:28:58 +08:00
swagger.json feat(system-info): surface DB migration errors with troubleshooting links 2026-05-14 16:34:50 +08:00
swagger.yaml feat(system-info): surface DB migration errors with troubleshooting links 2026-05-14 16:34:50 +08:00
使用其他向量数据库.md feat: support Tencent VectorDB keyword retrieval 2026-05-10 00:02:05 +08:00
共享空间说明.md refactor(docs): streamline knowledge base access permissions documentation 2026-02-09 11:40:25 +08:00
开发指南.md feat: optimize security and deployment of agent skills 2026-02-04 20:08:49 +08:00
开启知识图谱功能.md feat: Update VLM configuration in knowledge base and API documentation 2025-11-20 20:08:24 +08:00
快速开发模式说明.md docs: update Air installation command from cosmtrek/air to air-verse/air 2026-02-04 19:27:44 +08:00
数据源导入开发文档.md docs: remove WeCom document integration from data source import documentation 2026-03-30 20:46:07 +08:00
添加新的网络搜索引擎.md feat(web-search): refactor web search provider 2026-03-31 20:22:34 +08:00