docs: 补充 AuditLogProcessor 行为分析 + ContentSafetyService 未使用依赖
All checks were successful
Deploy API Server / build-and-unit (push) Successful in 33s
Deploy API Server / current-integration (push) Successful in 29s
Deploy API Server / backward-compat (push) Successful in 0s
Deploy API Server / deploy (push) Successful in 1m0s

- W4 新增 process() 方法完整代码和行为说明
- 标注因队列无生产者,Processor 从未被触发
- 新增 ContentSafetyService 注入未使用 QueueService 的依赖清理建议

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
wangdl 2026-06-20 17:03:28 +08:00
parent 64659825ae
commit 8e5108751c

View File

@ -165,6 +165,35 @@ async send(data: { userId: string; type: string; title: string; body: string })
- 行 6577: 逐个创建 `KnowledgeItem` - 行 6577: 逐个创建 `KnowledgeItem`
- 行 7982: `updateStatus(importId, 'completed')` - 行 7982: `updateStatus(importId, 'completed')`
**W4** `src/modules/admin-audit-log/audit-log.processor.ts:8-27`
```typescript
async process(job: Job) {
await this.prisma.adminAuditLog.create({
data: {
adminUserId: job.data.adminUserId,
action: job.data.action,
resourceType: job.data.resourceType,
resourceId: job.data.resourceId,
beforeJson: job.data.beforeJson,
afterJson: job.data.afterJson,
ip: job.data.ip,
userAgent: job.data.userAgent,
riskLevel: job.data.riskLevel,
reason: job.data.reason,
},
});
}
```
- 行为:直接从 BullMQ Job payload 写入 `AdminAuditLog`
- **当前因队列无生产者,此 Processor 从未被触发**
### 未使用的依赖注入
| 文件 | 注入 | 状态 | 建议 |
|------|------|------|------|
| `content-safety.service.ts:17` | `QueueService` | ❌ 未使用 — 构造函数注入但全文无 `this.queue.add()``this.queue.getJob()` 调用 | 若模块未来不计划使用队列,可清理以减少依赖 |
| `content-safety.module.ts:6,12` | `QueueService` 导入 + 注册为 provider | 仅为满足 `ContentSafetyService` 构造函数 | 同上 |
--- ---
## 4. AiRuntimeJob 完整链路System B — REST Poll ## 4. AiRuntimeJob 完整链路System B — REST Poll
@ -502,6 +531,7 @@ pending → locked → running → succeeded / failed / cancelled
| DocumentImport 使用独立 model | 🟡 中 | 不在 M-AI-03 范围,但未来统一需注意 | | DocumentImport 使用独立 model | 🟡 中 | 不在 M-AI-03 范围,但未来统一需注意 |
| RuntimeInternal 无事务保证 | 🔴 高 | result + job update 分两步,非原子 | | RuntimeInternal 无事务保证 | 🔴 高 | result + job update 分两步,非原子 |
| 孤儿队列notification/domain-events/audit-logs | 🟡 中 | Consumer 已注册但无活跃 Producer`NotificationWorker``AuditLogProcessor` 实为永久空转 | | 孤儿队列notification/domain-events/audit-logs | 🟡 中 | Consumer 已注册但无活跃 Producer`NotificationWorker``AuditLogProcessor` 实为永久空转 |
| `ContentSafetyService` 注入未使用的 `QueueService` | 🟢 低 | 构造函数注入但全文无 `this.queue.*` 调用;`content-safety.module.ts` 仅为满足此注入而注册 provider可清理以减少依赖 |
--- ---