From 56315e454b7bbe7b1ff22dd679a49a41aaa7e83d Mon Sep 17 00:00:00 2001 From: wangdl Date: Fri, 19 Jun 2026 20:31:08 +0800 Subject: [PATCH] docs: fix appendix A line numbers and NotificationWorker dependency chain MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - AiAnalysisWorker in worker.module.ts: line 62→64 - NotificationWorker: verified complete dependency chain (NotificationsService→NotificationsRepository+EventBusService(@Optional)) - Removed resolved "unconfirmed" item from section 六 Co-Authored-By: Claude Opus 4.7 --- ...-001-appendix-a-worker-dependency-closure.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/docs/architecture/adr-001-appendix-a-worker-dependency-closure.md b/docs/architecture/adr-001-appendix-a-worker-dependency-closure.md index 2e3f568..b4f068e 100644 --- a/docs/architecture/adr-001-appendix-a-worker-dependency-closure.md +++ b/docs/architecture/adr-001-appendix-a-worker-dependency-closure.md @@ -17,13 +17,13 @@ | 维度 | 事实 | 证据 | |------|------|------| | **队列** | `ai-analysis` | `@Processor(QUEUE_AI_ANALYSIS)` | -| **注册位置** | `AppModule` (line 193) + `WorkerModule` (line 62) — **双重注册** | `app.module.ts:193`、`worker.module.ts:62` | +| **注册位置** | `AppModule` (line 193) + `WorkerModule` (line 64) — **双重注册** | `app.module.ts:193`、`worker.module.ts:64` | | **注入依赖** | `ActiveRecallAnalysisWorkflow`、`FeynmanEvaluationWorkflow`、`AiAnalysisRepository`、`EventBusService` (@Optional)、`FocusItemsService` (@Optional) | `ai-analysis.worker.ts:22-28` | | **依赖 Module** | `AiModule`(提供 Workflow)、`AiAnalysisModule`(提供 Repository)、`EventBusModule`(提供 EventBusService)、`FocusItemsModule`(提供 FocusItemsService) | — | | **写入的表** | `AiAnalysisJob`(updateJobStatus)、`AiAnalysisResult`(createResult)、`FocusItem`(create) | `ai-analysis.worker.ts:47,66,67,87,101` | | **发布的事件** | `ai.analysis.completed`(通过 `EventBusService.publish()` → `EventEmitter2.emit()` — **进程内**) | `ai-analysis.worker.ts:71` | | **事件订阅者** | `ReviewCardSubscriber`(`@OnEvent('ai.analysis.completed')` → `ReviewModule` → `AppModule`) | `review-card.subscriber.ts:11` | -| **WorkerModule 中缺失** | `FocusItemsModule` 未导入 → `FocusItemsService` 在 Worker 进程中为 `null` | `worker.module.ts:1-66` | +| **WorkerModule 中缺失** | `FocusItemsModule` 未导入 → `FocusItemsService` 在 Worker 进程中为 `null` | `worker.module.ts:1-69` | | **移动后断裂链路** | ⚠️ `ai.analysis.completed` 事件无法到达 `ReviewCardSubscriber`(进程内 EventEmitter2);⚠️ `FocusItemsService` 在独立 Worker 进程中为 null | — | ### 1.2 DocumentImportWorker @@ -43,10 +43,12 @@ |------|------|------| | **队列** | `notification` | `@Processor(QUEUE_NOTIFICATION)` | | **注册位置** | `AppModule` (line 195) + `WorkerModule` (line 66) — **双重注册** | `app.module.ts:195`、`worker.module.ts:66` | -| **注入依赖** | `NotificationsService` | 需确认 `notification.worker.ts` | -| **写入的表** | `Notification`(更新发送状态) | — | -| **发布的事件** | 无 | — | -| **移动后断裂链路** | 需确认 `NotificationsService` 及其 Module 依赖在 WorkerModule 中可用 | — | +| **注入依赖** | `NotificationsService` | `notification.worker.ts:8,12` | +| **依赖链** | `NotificationsService` → `NotificationsRepository`(必需)+ `EventBusService`(@Optional) | `notifications.service.ts:13-15` | +| **依赖 Module** | `NotificationsModule`(提供 NotificationsService + NotificationsRepository)、`EventBusModule`(提供 EventBusService) | `notifications.module.ts:9-14` | +| **写入的表** | `Notification`(更新发送状态 — 通过 NotificationsRepository) | — | +| **发布的事件** | 无(`EventBusService` 为 @Optional 注入,NotificationWorker 自身不发布事件) | — | +| **移动后断裂链路** | 无 — `NotificationsModule` 已在 `WorkerModule.imports` 中(line 61),`NotificationsModule` 自身 imports `EventBusModule`,`PrismaService` 由 `PrismaModule` 提供。依赖链完整,Worker 进程启动不会因缺失依赖崩溃 | `worker.module.ts:61` | ### 1.4 AuditLogProcessor @@ -134,7 +136,7 @@ ## 四、WorkerModule 缺失依赖 -当前 `WorkerModule`(`worker.module.ts:1-66`)导入的 Module: +当前 `WorkerModule`(`worker.module.ts:1-69`)导入的 Module: ``` PrismaModule, RedisModule, QueueModule, AiModule, StorageModule, @@ -170,4 +172,3 @@ LoggerModule, AiAnalysisModule, DocumentImportModule, KnowledgeItemsModule, Noti |------|:---:|------| | Docker Compose 当前是否同时启动 API 和 Worker | 无法确认 | 需检查 `docker-compose.yml` 中 `command` 或 `entrypoint` 指向 `dist/main.js` 还是两者 | | 生产 systemd 是否使用独立 Worker 进程 | 无法确认 | 无法访问生产服务器 | -| `NotificationsService` 的完整依赖链 | 未深入审计 | NotificationWorker 的审计超出了当前 Issue 范围,需后续补充 |