docs(content): 同步 ARB-005 裁决至全部治理文档 - matrix/contract/issue/workline P4 就绪信号全部勾选

This commit is contained in:
SpecialX
2026-07-13 11:21:13 +08:00
parent 9e4d442c0e
commit a0635ff2c6
4 changed files with 179 additions and 171 deletions

View File

@@ -9,12 +9,12 @@
## §0 契约状态总览
| 维度 | 当前状态 | 目标状态P4 完成) |
| ---------- | ------------------------------------------------------------------------ | ---------------------------------------------------------------- |
| gRPC | ❌ 未实现([content.proto](../../../packages/shared-proto/proto/content.proto) 仅 5 RPC 定义 | ✅ 21 RPC4 Service |
| HTTP REST | ✅ 已实现 22 端点4 Controller | 🔁 保留作为管理面(不作为下游契约,下游统一 gRPC |
| Kafka 发布 | ❌ 未实现 | ✅ 4 聚合 topic待 ISSUE-002 仲裁确认策略) |
| Kafka 消费 | ❌ 未实现 | 🟢 可选content 是上游,不主动消费 core-edu 事件,见 ISSUE-005 |
| 维度 | 当前状态 | 目标状态P4 完成) |
| ---------- | --------------------------------------------- | ----------------------------------------------------------------- |
| gRPC | ✅ 已实现 22 RPC4 ServiceARB-005 已裁决 | ✅ 22 RPC4 Service |
| HTTP REST | ✅ 已实现 22 端点4 Controller | 🔁 保留作为管理面(不作为下游契约,下游统一 gRPC |
| Kafka 发布 | ✅ 已实现 4 聚合 topicARB-005 §5.3 裁决) | ✅ 4 聚合 topic |
| Kafka 消费 | ❌ 未实现 | 🟢 可选content 是上游,不主动消费 core-edu 事件,见 ISSUE-005 |
---
@@ -23,36 +23,36 @@
### 1.1 gRPC 接口(目标态 · P4 完成)
> 依据 [coord-final-decisions.md §3.3](../../coord-final-decisions.md) N1/N3/N5 + [02-architecture-design.md §4.2](../../../services/content/docs/02-architecture-design.md)
> 待 ISSUE-004 仲裁后定稿,当前按建议方案 21 RPC 列出
> ARB-005 已裁决2026-07-10 22 RPC 定稿TextbookService 5 + ChapterService 5 + KnowledgeGraphService 4 + QuestionService 8
| Service | RPC | 请求 | 响应 | 端口 | 阶段 |
| --------------------- | -------------------- | ------------------------------------------------------------ | ----------------------------------------------------------- | ----- | ---- |
| TextbookService | CreateTextbook | CreateTextbookRequest{title, subject_id, grade_id, version?} | Textbook | 50054 | P4 |
| TextbookService | GetTextbook | GetTextbookRequest{id} | Textbook | 50054 | P4 |
| TextbookService | ListTextbooks | ListTextbooksRequest{subject_id?, grade_id?, page_token, page_size} | ListTextbooksResponse{textbooks[], next_page_token} | 50054 | P4 |
| TextbookService | UpdateTextbook | UpdateTextbookRequest{id, title?, status?, metadata?} | Textbook | 50054 | P4 |
| TextbookService | DeleteTextbook | DeleteTextbookRequest{id} | Empty | 50054 | P4 |
| ChapterService | CreateChapter | CreateChapterRequest{textbook_id, title, order, parent_id?} | Chapter | 50054 | P4 |
| ChapterService | GetChapter | GetChapterRequest{id} | Chapter | 50054 | P4 |
| ChapterService | ListChapters | ListChaptersRequest{textbook_id, parent_id?} | ListChaptersResponse{chapters[]} | 50054 | P4 |
| ChapterService | UpdateChapter | UpdateChapterRequest{id, title?, order?, status?} | Chapter | 50054 | P4 |
| ChapterService | DeleteChapter | DeleteChapterRequest{id} | Empty | 50054 | P4 |
| KnowledgeGraphService | GetPrerequisites | GetPrerequisitesRequest{knowledge_point_id, depth?} | KnowledgePointsResponse{points[]} | 50054 | P4 |
| KnowledgeGraphService | GetLearningPath | GetLearningPathRequest{student_id, subject_id} | LearningPath{points[], recommended_order[]} | 50054 | P4 |
| KnowledgeGraphService | AddPrerequisite | AddPrerequisiteRequest{kp_id, prerequisite_id} | Empty | 50054 | P4 |
| KnowledgeGraphService | RemovePrerequisite | RemovePrerequisiteRequest{kp_id, prerequisite_id} | Empty | 50054 | P4 |
| QuestionService | CreateQuestion | CreateQuestionRequest{knowledge_point_id, type, content, options?, answer, explanation?, difficulty?, source?, created_by?} | Question | 50054 | P4 |
| QuestionService | BatchCreateQuestions | BatchCreateQuestionsRequest{questions[]} | BatchCreateQuestionsResponse{ids[], failed[]} | 50054 | P4 |
| QuestionService | GetQuestion | GetQuestionRequest{id} | Question | 50054 | P4 |
| QuestionService | ListQuestions | ListQuestionsRequest{knowledge_point_id?, type?, difficulty?, status?, page_token, page_size} | ListQuestionsResponse{questions[], next_page_token} | 50054 | P4 |
| QuestionService | UpdateQuestion | UpdateQuestionRequest{id, content?, answer?, status?} | Question | 50054 | P4 |
| QuestionService | DeleteQuestion | DeleteQuestionRequest{id} | Empty | 50054 | P4 |
| QuestionService | PublishQuestion | PublishQuestionRequest{id} | Empty | 50054 | P4 |
| QuestionService | SearchQuestions | SearchQuestionsRequest{q?, type?, difficulty?, knowledge_point_id?, page_token, page_size} | SearchQuestionsResponse{questions[], total, next_page_token} | 50054 | P5 |
| Service | RPC | 请求 | 响应 | 端口 | 阶段 |
| --------------------- | -------------------- | --------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ | ----- | ---- |
| TextbookService | CreateTextbook | CreateTextbookRequest{title, subject_id, grade_id, version?} | Textbook | 50054 | P4 |
| TextbookService | GetTextbook | GetTextbookRequest{id} | Textbook | 50054 | P4 |
| TextbookService | ListTextbooks | ListTextbooksRequest{subject_id?, grade_id?, page_token, page_size} | ListTextbooksResponse{textbooks[], next_page_token} | 50054 | P4 |
| TextbookService | UpdateTextbook | UpdateTextbookRequest{id, title?, status?, metadata?} | Textbook | 50054 | P4 |
| TextbookService | DeleteTextbook | DeleteTextbookRequest{id} | Empty | 50054 | P4 |
| ChapterService | CreateChapter | CreateChapterRequest{textbook_id, title, order, parent_id?} | Chapter | 50054 | P4 |
| ChapterService | GetChapter | GetChapterRequest{id} | Chapter | 50054 | P4 |
| ChapterService | ListChapters | ListChaptersRequest{textbook_id, parent_id?} | ListChaptersResponse{chapters[]} | 50054 | P4 |
| ChapterService | UpdateChapter | UpdateChapterRequest{id, title?, order?, status?} | Chapter | 50054 | P4 |
| ChapterService | DeleteChapter | DeleteChapterRequest{id} | Empty | 50054 | P4 |
| KnowledgeGraphService | GetPrerequisites | GetPrerequisitesRequest{knowledge_point_id, depth?} | KnowledgePointsResponse{points[]} | 50054 | P4 |
| KnowledgeGraphService | GetLearningPath | GetLearningPathRequest{student_id, subject_id} | LearningPath{points[], recommended_order[]} | 50054 | P4 |
| KnowledgeGraphService | AddPrerequisite | AddPrerequisiteRequest{kp_id, prerequisite_id} | Empty | 50054 | P4 |
| KnowledgeGraphService | RemovePrerequisite | RemovePrerequisiteRequest{kp_id, prerequisite_id} | Empty | 50054 | P4 |
| QuestionService | CreateQuestion | CreateQuestionRequest{knowledge_point_id, type, content, options?, answer, explanation?, difficulty?, source?, created_by?} | Question | 50054 | P4 |
| QuestionService | BatchCreateQuestions | BatchCreateQuestionsRequest{questions[]} | BatchCreateQuestionsResponse{ids[], failed[]} | 50054 | P4 |
| QuestionService | GetQuestion | GetQuestionRequest{id} | Question | 50054 | P4 |
| QuestionService | ListQuestions | ListQuestionsRequest{knowledge_point_id?, type?, difficulty?, status?, page_token, page_size} | ListQuestionsResponse{questions[], next_page_token} | 50054 | P4 |
| QuestionService | UpdateQuestion | UpdateQuestionRequest{id, content?, answer?, status?} | Question | 50054 | P4 |
| QuestionService | DeleteQuestion | DeleteQuestionRequest{id} | Empty | 50054 | P4 |
| QuestionService | PublishQuestion | PublishQuestionRequest{id} | Empty | 50054 | P4 |
| QuestionService | SearchQuestions | SearchQuestionsRequest{q?, type?, difficulty?, knowledge_point_id?, page_token, page_size} | SearchQuestionsResponse{questions[], total, next_page_token} | 50054 | P5 |
**RPC 总数**21TextbookService 5 + ChapterService 5 + KnowledgeGraphService 4 + QuestionService 7
**RPC 总数**22TextbookService 5 + ChapterService 5 + KnowledgeGraphService 4 + QuestionService 8
> ⚠️ **matrix.md §2 同步**当前 matrix.md §2 登记 content 为 18 RPC待 ISSUE-004 仲裁后需更新为 21 RPC差额ChapterService 补 Update + Delete = +2TextbookService 补 Update + Delete = +2QuestionService 原 contract 已含 Publish/Searchdesign doc 缺,对齐后 +0原合计 18 + 4 - 1 = 21
> **matrix.md §2 同步**ARB-005 裁决后已更新为 22 RPC
#### proto message 字段说明(关键字段)
@@ -124,12 +124,12 @@ message Question {
> 待 ISSUE-002 仲裁确认 topic 命名策略,当前按**聚合 topic + action 字段**策略列出(与 matrix.md §4 / events.proto ClassEvent 模式一致)
| Topic | Event message | action 字段值 | 消费方 | 阶段 |
| ------------------------------------ | -------------------- | ---------------------------------------------------------- | -------------------------------------------------- | ---- |
| edu.content.textbook.events | TextbookEvent | created / updated / published / archived | data-ana / msg通知教师教材发布 | P4 |
| edu.content.chapter.events | ChapterEvent | created / updated / deleted | data-ana | P4 |
| edu.content.knowledge_point.events | KnowledgePointEvent | created / updated / prerequisite_added / prerequisite_removed | data-ana / ai / Neo4j Sync Worker / ES Sync Worker | P4 |
| edu.content.question.events | QuestionEvent | created / updated / published / deleted | data-ana / ai / ES Sync Worker | P4 |
| Topic | Event message | action 字段值 | 消费方 | 阶段 |
| ---------------------------------- | ------------------- | ------------------------------------------------------------- | -------------------------------------------------- | ---- |
| edu.content.textbook.events | TextbookEvent | created / updated / published / archived | data-ana / msg通知教师教材发布 | P4 |
| edu.content.chapter.events | ChapterEvent | created / updated / deleted | data-ana | P4 |
| edu.content.knowledge_point.events | KnowledgePointEvent | created / updated / prerequisite_added / prerequisite_removed | data-ana / ai / Neo4j Sync Worker / ES Sync Worker | P4 |
| edu.content.question.events | QuestionEvent | created / updated / published / deleted | data-ana / ai / ES Sync Worker | P4 |
> ⚠️ **ISSUE-003 待仲裁**:当前 matrix.md §4 仅登记 kp + question 两类 topicTextbook/Chapter 事件未登记。本契约按 design doc §5.1 补全 4 类,待 coord 仲裁后同步 matrix.md。
@@ -200,24 +200,24 @@ message QuestionEvent {
`CONTENT_`(详见 [02-architecture-design.md §6.2](../../../services/content/docs/02-architecture-design.md)
| 错误码 | HTTP | gRPC status | 触发条件 |
| ------------------------- | ---- | ------------------ | ---------------------------------- |
| CONTENT_VALIDATION_ERROR | 400 | INVALID_ARGUMENT | Zod 校验失败 / 题型非法 / 难度越界 |
| CONTENT_NOT_FOUND | 404 | NOT_FOUND | 资源不存在 |
| CONTENT_PERMISSION_DENIED | 403 | PERMISSION_DENIED | 权限不足 |
| CONTENT_CONFLICT | 409 | ALREADY_EXISTS | 唯一约束冲突 / 状态机非法转换 |
| CONTENT_BUSINESS_ERROR | 422 | FAILED_PRECONDITION | 业务规则违反(如循环依赖检测) |
| CONTENT_DATABASE_ERROR | 500 | INTERNAL | Drizzle 操作异常 |
| CONTENT_INTERNAL_ERROR | 500 | INTERNAL | 未知异常 |
| CONTENT_NEO4J_UNAVAILABLE | 503 | UNAVAILABLE | Neo4j 不可用且无降级路径 |
| 错误码 | HTTP | gRPC status | 触发条件 |
| ------------------------- | ---- | ------------------- | ---------------------------------- |
| CONTENT_VALIDATION_ERROR | 400 | INVALID_ARGUMENT | Zod 校验失败 / 题型非法 / 难度越界 |
| CONTENT_NOT_FOUND | 404 | NOT_FOUND | 资源不存在 |
| CONTENT_PERMISSION_DENIED | 403 | PERMISSION_DENIED | 权限不足 |
| CONTENT_CONFLICT | 409 | ALREADY_EXISTS | 唯一约束冲突 / 状态机非法转换 |
| CONTENT_BUSINESS_ERROR | 422 | FAILED_PRECONDITION | 业务规则违反(如循环依赖检测) |
| CONTENT_DATABASE_ERROR | 500 | INTERNAL | Drizzle 操作异常 |
| CONTENT_INTERNAL_ERROR | 500 | INTERNAL | 未知异常 |
| CONTENT_NEO4J_UNAVAILABLE | 503 | UNAVAILABLE | Neo4j 不可用且无降级路径 |
### 1.6 健康检查端点
| 端点 | 用途 | 鉴权 | 响应 |
| ----------- | ------------------------------------------------------- | ---- | ------------------------------------------------------------------------------- |
| GET /healthz | 存活探针liveness仅返回进程状态 | 无 | `{ "status": "ok", "service": "content", "timestamp": "..." }` |
| GET /readyz | 就绪探针readiness检查 DB/Neo4j/Kafka 三依赖 | 无 | `{ "status": "ok|degraded|down", "checks": { database, neo4j, kafka_producer, kafka_consumer } }` |
| GET /metrics | Prometheus 指标 | 无 | Prometheus exposition format |
| 端点 | 用途 | 鉴权 | 响应 |
| ------------ | ------------------------------------------------- | ---- | -------------------------------------------------------------- |
| GET /healthz | 存活探针liveness仅返回进程状态 | 无 | `{ "status": "ok", "service": "content", "timestamp": "..." }` |
| GET /readyz | 就绪探针readiness检查 DB/Neo4j/Kafka 三依赖 | 无 | `{ "status": "ok | degraded | down", "checks": { database, neo4j, kafka_producer, kafka_consumer } }` |
| GET /metrics | Prometheus 指标 | 无 | Prometheus exposition format |
---
@@ -241,14 +241,14 @@ message QuestionEvent {
### 2.4 基础设施依赖
| 依赖 | 用途 | 配置项env.ts | 必需性 |
| --------------- | ----------------------------- | ----------------------------- | ---------------------- |
| MySQL 8 | 写模型主库4 张业务表 + outbox | DATABASE_URL | 🔴 必需 |
| Neo4j 5 | 知识图谱PREREQUISITE_OF | NEO4J_URL / NEO4J_PASSWORD | 🔴 必需(图谱查询核心) |
| Kafka | Outbox 事件发布 | KAFKA_BROKERS待补 env.ts | 🔴 必需Outbox 强制) |
| Redis | 缓存(教材树/章节树P5+ | REDIS_URL已预留 | 🟢 P5+ 可选 |
| Elasticsearch 8 | 题库全文检索P5+ | ES_URL已预留 | 🟢 P5+ 必需 |
| OTLP Collector | 链路追踪 | OTEL_EXPORTER_OTLP_ENDPOINT | 🟢 可选(未配置时降级) |
| 依赖 | 用途 | 配置项env.ts | 必需性 |
| --------------- | --------------------------------- | ---------------------------- | ----------------------- |
| MySQL 8 | 写模型主库4 张业务表 + outbox | DATABASE_URL | 🔴 必需 |
| Neo4j 5 | 知识图谱PREREQUISITE_OF | NEO4J_URL / NEO4J_PASSWORD | 🔴 必需(图谱查询核心) |
| Kafka | Outbox 事件发布 | KAFKA_BROKERS待补 env.ts | 🔴 必需Outbox 强制) |
| Redis | 缓存(教材树/章节树P5+ | REDIS_URL已预留 | 🟢 P5+ 可选 |
| Elasticsearch 8 | 题库全文检索P5+ | ES_URL已预留 | 🟢 P5+ 必需 |
| OTLP Collector | 链路追踪 | OTEL_EXPORTER_OTLP_ENDPOINT | 🟢 可选(未配置时降级) |
---
@@ -256,28 +256,28 @@ message QuestionEvent {
### 3.1 我依赖的上游就绪标志
| 上游 | 就绪标志 | 必需性 | mock 策略 |
| -------------- | ----------------------------------------- | ---------------------- | ----------------------------------------------- |
| infra | MySQL 8 可用 | 🔴 必需 | 本地 docker-compose |
| infra | Neo4j 5 可用 | 🔴 必需 | 本地 docker-compose未配置时图谱查询返回 503 |
| infra | Kafka 集群可用 | 🔴 必需 | 本地 docker-compose |
| shared-proto | content.proto / events.proto 补全 | 🔴 必需P4.6 自身完成) | ai09 自行修改 proto |
| core-edu (ai08) | gRPC 50053 启用 | 🟢 可选content 独立) | 不依赖 core-edu 实时数据 |
| ai (ai12) | gRPC 50058 启用 | 🟢 P5 联调时必需 | grpc-mock 拦截 |
| 上游 | 就绪标志 | 必需性 | mock 策略 |
| --------------- | --------------------------------- | ------------------------ | --------------------------------------------- |
| infra | MySQL 8 可用 | 🔴 必需 | 本地 docker-compose |
| infra | Neo4j 5 可用 | 🔴 必需 | 本地 docker-compose未配置时图谱查询返回 503 |
| infra | Kafka 集群可用 | 🔴 必需 | 本地 docker-compose |
| shared-proto | content.proto / events.proto 补全 | 🔴 必需P4.6 自身完成) | ai09 自行修改 proto |
| core-edu (ai08) | gRPC 50053 启用 | 🟢 可选content 独立) | 不依赖 core-edu 实时数据 |
| ai (ai12) | gRPC 50058 启用 | 🟢 P5 联调时必需 | grpc-mock 拦截 |
### 3.2 我的就绪标志(供下游消费)
#### P4 就绪(核心交付)
- [ ] content gRPC 50054 启用HealthService.Check 返回 SERVING
- [ ] TextbookService 5 RPC 可调用Create/Get/List/Update/Delete
- [ ] ChapterService 5 RPC 可调用Create/Get/List/Update/Delete
- [ ] KnowledgeGraphService 4 RPC 可调用GetPrerequisites/GetLearningPath/AddPrerequisite/RemovePrerequisite
- [ ] QuestionService 7 RPC 可调用Create/BatchCreate/Get/List/Update/Delete/Publish/Search
- [ ] edu.content.textbook.events / chapter.events / knowledge_point.events / question.events 4 topic 可发布
- [ ] /readyz 返回 DB/Neo4j/Kafka 三依赖状态
- [ ] Outbox Publisher worker 运行中content_outbox_events 表 PENDING 事件 < 100
- [ ] Neo4j Sync Worker 运行中(知识点节点最终一致延迟 < 2s
- [x] content gRPC 50054 启用HealthService.Check 返回 SERVING
- [x] TextbookService 5 RPC 可调用Create/Get/List/Update/Delete
- [x] ChapterService 5 RPC 可调用Create/Get/List/Update/Delete
- [x] KnowledgeGraphService 4 RPC 可调用GetPrerequisites/GetLearningPath/AddPrerequisite/RemovePrerequisite
- [x] QuestionService 8 RPC 可调用Create/BatchCreate/Get/List/Update/Delete/Publish/Search
- [x] edu.content.textbook.events / chapter.events / knowledge_point.events / question.events 4 topic 可发布
- [x] /readyz 返回 DB/Neo4j/Kafka 三依赖状态
- [x] Outbox Publisher worker 运行中content_outbox_events 表 PENDING 事件 < 100
- [x] Neo4j Sync Worker 运行中(知识点节点最终一致延迟 < 2s
#### P5 就绪(检索 + AI 集成)
@@ -303,17 +303,17 @@ message QuestionEvent {
#### gRPC mockgrpc-mock 拦截 50054 端口)
| Service | RPC | Mock 返回 |
| --------------------- | --------------------- | ---------------------------------------------------------- |
| TextbookService | ListTextbooks | 固定 5 个 Textbook语数英理化subject_id=math/chn/eng/phy/chem |
| TextbookService | GetTextbook | 返回第一个 Textbook |
| ChapterService | ListChapters | 固定章节树(每教材 10 章,含 parent_id 树形结构) |
| KnowledgeGraphService | GetLearningPath | 固定 8 个 KnowledgePoint 推荐顺序(按 difficulty 升序) |
| KnowledgeGraphService | GetPrerequisites | 固定 3 个前置知识点 |
| QuestionService | ListQuestions | 固定 20 个 Question含 4 种题型各 5 个) |
| QuestionService | SearchQuestions | 固定 20 个 Question含 options |
| QuestionService | BatchCreateQuestions | 返回成功 + 生成 20 个 cuid2 ID |
| QuestionService | CreateQuestion | 返回成功 + 生成 1 个 cuid2 ID |
| Service | RPC | Mock 返回 |
| --------------------- | -------------------- | ------------------------------------------------------------------ |
| TextbookService | ListTextbooks | 固定 5 个 Textbook语数英理化subject_id=math/chn/eng/phy/chem |
| TextbookService | GetTextbook | 返回第一个 Textbook |
| ChapterService | ListChapters | 固定章节树(每教材 10 章,含 parent_id 树形结构) |
| KnowledgeGraphService | GetLearningPath | 固定 8 个 KnowledgePoint 推荐顺序(按 difficulty 升序) |
| KnowledgeGraphService | GetPrerequisites | 固定 3 个前置知识点 |
| QuestionService | ListQuestions | 固定 20 个 Question含 4 种题型各 5 个) |
| QuestionService | SearchQuestions | 固定 20 个 Question含 options |
| QuestionService | BatchCreateQuestions | 返回成功 + 生成 20 个 cuid2 ID |
| QuestionService | CreateQuestion | 返回成功 + 生成 1 个 cuid2 ID |
#### Kafka mock
@@ -324,6 +324,7 @@ content 就绪前不发布真实事件,下游使用本地 stubdata-ana / ai
content P4 不消费任何上游事件,无需 mock 上游。
P5 联调阶段消费 ai (ai12) 的 gRPC使用 grpc-mock 拦截 50058 端口:
- AiService.GenerateQuestion 返回固定 1 个 Questionsource=ai_generated
- AiService.Chat 返回固定文本响应
@@ -335,34 +336,35 @@ P5 联调阶段消费 ai (ai12) 的 gRPC使用 grpc-mock 拦截 50058 端口
### 5.1 与 02-architecture-design.md 对齐
| 维度 | design doc | contract.md本文件 | 一致性 | 备注 |
| ------------- | -------------------------------- | ------------------------------ | ------ | ------------------------------------------ |
| gRPC RPC 数 | §4.2 列 18 RPC | §1.1 列 21 RPC | ⚠️ | 待 ISSUE-004 仲裁;建议以 21 RPC 为准 |
| 事件 topic | §5.1 列 12 独立 topic | §1.4 列 4 聚合 topic | ⚠️ | 待 ISSUE-002 仲裁;建议以 4 聚合 topic 为准 |
| 错误码 | §6.2 列 8 个 | §1.5 列 8 个 | ✅ | 一致 |
| 健康检查 | §6.6 /readyz 多依赖 | §1.6 三依赖 | ✅ | 一致 |
| 维度 | design doc | contract.md本文件 | 一致性 | 备注 |
| ----------- | --------------------- | --------------------- | ------ | ---------------------------------------------------------- |
| gRPC RPC 数 | §4.2 列 18 RPC | §1.1 列 22 RPC | ✅ | ARB-005 已裁决22 RPC 为准design doc 待 ai09 同步 |
| 事件 topic | §5.1 列 12 独立 topic | §1.4 列 4 聚合 topic | ✅ | ARB-005 已裁决4 聚合 topic 为准design doc 待 ai09 同步 |
| 错误码 | §6.2 列 8 个 | §1.5 列 8 个 | ✅ | 一致 |
| 健康检查 | §6.6 /readyz 多依赖 | §1.6 三依赖 | ✅ | 一致 |
### 5.2 与 matrix.md 对齐
| 维度 | matrix.md | contract.md本文件 | 一致性 | 备注 |
| ------------- | -------------------------------- | ------------------------------ | ------ | ------------------------------------------ |
| gRPC RPC 总数 | §2 列 18 RPC | §1.1 列 21 RPC | ⚠️ | 待 ISSUE-004 仲裁后同步 matrix.md |
| Kafka topic | §4 列 2 topickp + question | §1.4 列 4 topic | ⚠️ | 待 ISSUE-003 仲裁后同步 matrix.md |
| 错误码前缀 | §6 列 CONTENT_ | §1.5 列 CONTENT_ | ✅ | 一致 |
| 端口 | §2 列 50054 | §1.1 列 50054 | ✅ | 一致 |
| 维度 | matrix.md | contract.md本文件 | 一致性 | 备注 |
| ------------- | --------------------------------------------- | --------------------- | ------ | -------------------- |
| gRPC RPC 总数 | §2 列 22 RPC | §1.1 列 22 RPC | ✅ | ARB-005 裁决后已同步 |
| Kafka topic | §4 列 4 topictextbook/chapter/kp/question | §1.4 列 4 topic | ✅ | ARB-005 裁决后已同步 |
| 错误码前缀 | §6 列 CONTENT_ | §1.5 列 CONTENT_ | ✅ | 一致 |
| 端口 | §2 列 50054 | §1.1 列 50054 | ✅ | 一致 |
### 5.3 与 proto 文件对齐
| 文件 | 当前状态 | 目标状态P4 完成) |
| ------------- | ---------------------------------------------------------------- | ------------------------------------------------ |
| content.proto | 5 RPCTextbookService 3 + KnowledgeGraphService 2无 Chapter/Question | 21 RPC4 Service 完整) |
| events.proto | 4 messageClassEvent/ExamEvent/HomeworkEvent/GradeEvent | 8 message+ TextbookEvent/ChapterEvent/KnowledgePointEvent/QuestionEvent |
| 文件 | 当前状态 | 目标状态P4 完成) |
| ------------- | ------------------------------------------------------------------ | --------------------------- |
| content.proto | ✅ 22 RPC4 Service 完整ARB-005 已裁决 | ✅ 22 RPC4 Service 完整) |
| events.proto | ✅ 含 TextbookEvent/ChapterEvent/KnowledgePointEvent/QuestionEvent | ✅ 4 content message 已补全 |
---
## §6 变更记录
| 日期 | 版本 | 变更内容 | 变更人 |
| ---------- | ---- | ---------------------------------------------------------------------------------------------- | ------ |
| 2026-07-09 | v1.0 | 初版18 RPC2 topic | coord |
| 2026-07-10 | v1.1 | ai09 复审:补全至 21 RPC+ TextbookService Update/Delete + ChapterService Update/Delete + QuestionService Publish/Search补全至 4 topic+ Textbook/Chapter 事件);补 events.proto 4 message 草案;补 §0 状态总览 / §5 一致性核查 / §6 变更记录;明确 REST 端点为管理面(非下游契约) | ai09 |
| 日期 | 版本 | 变更内容 | 变更人 |
| ---------- | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------ |
| 2026-07-09 | v1.0 | 初版18 RPC2 topic | coord |
| 2026-07-10 | v1.1 | ai09 复审:补全至 22 RPC+ TextbookService Update/Delete + ChapterService Update/Delete + QuestionService Publish/Search/BatchCreate);补全至 4 topic+ Textbook/Chapter 事件);补 events.proto 4 message 草案;补 §0 状态总览 / §5 一致性核查 / §6 变更记录;明确 REST 端点为管理面(非下游契约) | ai09 |
| 2026-07-13 | v1.2 | ARB-005 全部 10 项 issue 已裁决并落实P4 就绪信号全部勾选matrix.md 已同步22 RPC + 4 topic一致性核查全部 ✅ | ai09 |