Commit Graph

144 Commits

Author SHA1 Message Date
SpecialX
3fac472a57 chore(push-gateway): ai02 module updates - config, hub, ws, kafka, health, docs 2026-07-10 17:36:53 +08:00
SpecialX
dc0a6feec4 docs(docs): coord 仲裁 api-gateway 8 项 ISSUE(ARB-022)
总裁确认采纳方案 A(双 /v1 前缀)。

- coord.md: 新增 §24 ARB-022(api-gateway 8 项 ISSUE 仲裁)
- coord.md: §24.4 ISSUE-003 方案 A 裁决 + 总裁确认记录
- matrix.md: §5 路径前缀修正为双 /v1(方案 A)
- api-gateway_issue.md: §2 状态更新为已裁决

AI: coord
2026-07-10 17:07:15 +08:00
SpecialX
855f35f84b chore: merge feat/api-gateway-ai01 review docs into main 2026-07-10 16:53:08 +08:00
SpecialX
9e767b4e95 chore(api-gateway): merge review docs and update dependencies 2026-07-10 16:50:33 +08:00
SpecialX
8e91039896 docs(api-gateway): 补充完整架构问题记录与裁决核查
完成api-gateway模块边界确认,添加W1-W8裁决遵循情况核查与架构不一致问题梳理
汇总8项待coord仲裁的issue,包含模块契约、依赖、版本、文档等问题
2026-07-10 16:41:57 +08:00
SpecialX
c179af64a6 docs(docs): coord 完成 15 模块 issue 仲裁与基础设施同步
coord.md 新增 ARB-019/020/021 三章仲裁章节,修正 ARB-001。

- coord.md: 新增 ARB-019/020/021(student/parent/admin-portal 24 项)
- coord.md: 修正 ARB-001(admin P2 预留/schema 文件名/classes 数据源)
- 004 §4: 依赖图加 PBFF→DataAna+Msg
- 004 §7.2: push-gateway→Redis 软失败标注
- 004 §11.4: 错误码前缀矩阵(11 服务+i18n key)
- 004 §11.5: ActionState 信封规范(降级模式方案 B)
- matrix §1: 依赖矩阵加 PBFF 边
- matrix §2: 移除 api-gateway 为 iam gRPC 消费方
- matrix §4: admin-portal→teacher-bff
- matrix §5: 移除 /sse+鉴权头统一
- matrix §6: 错误码表补 i18n key 列
- 15 个 issue.md: 仲裁结论回写
- push-gateway_contract: 移除 /sse+鉴权头改 X-Internal-Token
- packages/contracts: 新建包 ADMIN_* 权限点常量

AI: coord
2026-07-10 16:30:51 +08:00
SpecialX
df62ffc176 Merge worktree branch merge-15-modules-to-main-5ug5xJ 2026-07-10 15:28:20 +08:00
SpecialX
24c2860b41 docs(student-portal): add arbitration check and new objections to issue record
add verification of ARB-001 and ARB-002 impacts, and submit seven new disputed issues for coord arbitration
2026-07-10 15:10:16 +08:00
SpecialX
88f6822473 docs: update api-gateway workline and contract based on new arbitration
update workline to detail full P2-P6 tasks with clear milestones and dependencies
revise contract to correct route prefix, JWKS method and dependency descriptions
clean up outdated issue content
2026-07-10 15:06:22 +08:00
SpecialX
a7d8f92227 feat: auto committed 2026-07-10 15:06:12 +08:00
SpecialX
06e0f9139b feat: auto committed 2026-07-10 15:06:09 +08:00
SpecialX
5e0e20b1ce feat: auto committed 2026-07-10 15:05:58 +08:00
SpecialX
06a646ea4e feat: auto committed 2026-07-10 15:05:55 +08:00
SpecialX
21530dc7f6 feat: auto committed 2026-07-10 15:05:52 +08:00
SpecialX
b82593aac2 feat: auto committed 2026-07-10 15:05:50 +08:00
SpecialX
14d836beb0 feat: auto committed 2026-07-10 15:05:47 +08:00
SpecialX
c09d6fb7d2 feat: auto committed 2026-07-10 15:05:44 +08:00
SpecialX
b54bfd101b feat: auto committed 2026-07-10 15:05:41 +08:00
SpecialX
02d09c47fa feat: auto committed 2026-07-10 15:05:39 +08:00
SpecialX
033057a302 feat: auto committed 2026-07-10 15:05:37 +08:00
SpecialX
e5ca4c6c7b docs(student-bff): 更新架构问题记录、工作排期和对接契约,对齐已裁决规则
完成已有仲裁核查,新增待仲裁问题归档,细化全阶段排期与依赖,对齐coord B1-B8和总裁裁决,更新GraphQL规范、越权防御、DownstreamClient契约
2026-07-10 14:43:11 +08:00
SpecialX
60d7173545 docs(docs): 维护历史文档声明+workline重写为全并行模式+coord措辞修复 2026-07-10 14:13:47 +08:00
SpecialX
3852873964 docs(docs): 新增 AI 协作文档使用指南 2026-07-10 14:09:27 +08:00
SpecialX
5144ec7292 docs(docs): 更新分支策略为 17 长期分支 2026-07-10 14:07:02 +08:00
SpecialX
9ba368477d refactor(docs): 移除 ai07 classes 合并到 core-edu,16 AI 降为 15 AI 2026-07-10 14:04:49 +08:00
SpecialX
6051f84a65 docs: 恢复分支开发模式 - AI 不切换分支,默认多AI协作,经验沉淀不标注AI身份 2026-07-10 13:46:47 +08:00
SpecialX
f15912c7ee docs: 文档体系修正 - 模块边界强化与按需阅读架构 2026-07-10 13:33:31 +08:00
SpecialX
faaaf29f67 docs: ai 协作文档体系重构与多 ai 仲裁结果落地
1.AI 协作文档体系重构(objections/worklines/contracts+matrix.md)

2.coord 仲裁文档(final-decisions/cross-review/final-rulings/orchestration)

3.各服务 01/02 文档补全

4.共享包初始化(shared-ts/shared-go/hooks/ui-components/ui-tokens)

5.Proto 契约补全

6.004 架构影响地图更新

7.端口分配表

8.设计规格文档
2026-07-10 12:58:22 +08:00
SpecialX
2a2a56f541 docs: ai 协作文档体系重构与多 ai 仲裁结果落地
1.AI 协作文档体系重构(objections/worklines/contracts+matrix.md)

2.coord 仲裁文档(final-decisions/cross-review/final-rulings/orchestration)

3.issues.md 问题记录(ISSUE-001~035)

4.各服务 01/02 文档补全

5.共享包初始化(shared-ts/shared-go/hooks/ui-components/ui-tokens)

6.Proto 契约补全

7.004 架构影响地图更新

8.端口分配表

9.设计规格文档
2026-07-10 12:55:49 +08:00
SpecialX
db90b2e080 docs(parent-portal): ai15 阶段1+2 文档审计与补全
按 ai-allocation.md §3.2 接管 parent-portal,完成阶段 1+2 文档审计与补全。
修订端口(3002→4002)、所有权(ai07→ai15),补全 16 章长远架构。

AI Agent: ai15 (parent-portal remote)
Branch: docs/parent-portal-stage1-stage2-design-ai15
Coordinator: coord-ai
Predecessor: ai07
2026-07-09 18:51:10 +08:00
SpecialX
e691cd267d docs(teacher-portal): ai07 阶段1+2 拆分到4端portal的docs目录
删除合并版README,按portal拆分8份文档(每端01-understanding+02-architecture-design)

teacher-portal(shell/P2)+student-portal(remote/P3)+parent-portal(remote/P4)+admin-portal(remote/P6)

AI Agent: ai07 (4 portals)

Branch: docs/portals-stage1-stage2-design-ai07
2026-07-09 18:23:27 +08:00
SpecialX
fd5b6e19ae docs(data-ana): ai06 补充 AI Agent 身份标注(§14.7) 2026-07-09 17:30:49 +08:00
SpecialX
0a71b02e04 fix: code compliance audit and fix across all services
Some checks failed
CI / quality-ts (push) Failing after 48s
CI / quality-go (push) Failing after 4s
CI / quality-proto (push) Failing after 2s
CI / deploy (push) Has been skipped
NestJS (6 services): implement @RequirePermission decorator with
SetMetadata+Reflector, register APP_GUARD globally, fix as assertions
to type guards, add explicit return types, fix import type for express,
fix /metrics implicit any, replace native Error with ApplicationError,
remove typeorm remnants, register LifecycleService.

teacher-bff: add logger, ApplicationError, GlobalErrorFilter, forward
real userId to downstream, log downstream failures, migrate health
controller to shared/health.

Go (2 services): interface to any, doc comments, CORS dev whitelist,
JWT secret fail-fast, push-gateway internal API auth, metrics and
readyz endpoints, remove dead code.

Python (2 services): lifespan return type, dev_mode to bool, data-ana
APIRouter, ai POST body model, ClickHouse async wrapping.
2026-07-09 17:28:27 +08:00
SpecialX
b53a486c6e docs(teacher-portal): ai07 阶段1+2 模块理解确认书与架构设计文档
4端合并交付:理解确认书+架构设计+MF Shell/Remote架构+4端差异化对照表

AI Agent: ai07 (4 portals)

Branch: docs/teacher-portal-stage1-stage2-design-ai07
2026-07-09 17:24:58 +08:00
SpecialX
a0f6c228af docs(push-gateway): ai01 阶段1+2 模块理解确认书与架构设计文档
阶段1交付:services/push-gateway/docs/01-understanding.md
- 8节:架构位置/限界上下文/契约/技术栈/阶段归属P5骨架/审计
- 审计16项差距(6高/5中/5低)

阶段2交付:services/push-gateway/docs/02-architecture-design.md
- 13节:分层图/Connection+Hub模型/Redis key/WS端点
- 双通道协议/生命周期/心跳RFC6455/多实例PubSub
- 容量目标10w+连接

AI Agent: ai01 (api-gateway/push-gateway)
Branch: main
Coordinator: coord
2026-07-09 17:22:23 +08:00
SpecialX
834e2c61fd docs(api-gateway): ai01 阶段1+2 模块理解确认书与架构设计文档
阶段1交付:services/api-gateway/docs/01-understanding.md
- 8节内容:架构位置/限界上下文/契约/技术栈/阶段归属/黄金模板对齐审计
- 审计13项差距(3高:缺/metrics、/readyz stub、auth.go死代码;4中:log/slog缺失、go.mod版本不匹配、HS256待升RS256、DevMode风险;6低)

阶段2交付:services/api-gateway/docs/02-architecture-design.md
- 9节内容:内部分层图/路由表矩阵9下游/限流策略表/熔断阈值表/JWT RS256流程含JWKS缓存/CORS白名单/请求ID注入/metrics 7项指标/P0-P3实施优先级

同步更新 docs/troubleshooting/known-issues.md 工作经验日志(追加ai01条目)

AI Agent: ai01 (api-gateway/push-gateway)
Branch: main
Coordinator: coord
2026-07-09 17:21:03 +08:00
SpecialX
f1e466a772 fix(infra): resolve NestJS dist build and Prometheus target issues
Some checks failed
CI / quality-go (push) Failing after 5s
CI / quality-proto (push) Failing after 3s
CI / deploy (push) Has been skipped
CI / quality-ts (push) Failing after 50s
NestJS: disable incremental in 6 services tsconfig.json to fix dist
not emitted when nest-cli deleteOutDir conflicts with tsc tsbuildinfo.
classes/iam: import HealthModule in AppModule to fix /healthz 404.
classes: rewrite HealthController to Drizzle getDb from TypeORM DI.
teacher-bff: add /metrics endpoint for Prometheus scraping.
infra: add node/mysql/redis exporters to observability profile.
mysql-exporter v0.15.1 uses command-line flags not DATA_SOURCE_NAME.
prometheus: enable web.enable-lifecycle for hot reload.
2026-07-09 15:12:15 +08:00
SpecialX
b72c8d81d4 fix(infra): use conditional docker template to avoid Health key error
Some checks failed
CI / quality-ts (push) Failing after 1m0s
CI / quality-go (push) Failing after 4s
CI / quality-proto (push) Failing after 2s
CI / deploy (push) Has been skipped
Use {{if .State.Health}}...{{end}} instead of direct {{.State.Health.Status}}.
2026-07-09 13:58:55 +08:00
SpecialX
959d58a95d docs: add full-stack runbook and one-click scripts
Some checks failed
CI / quality-ts (push) Failing after 51s
CI / quality-go (push) Failing after 3s
CI / quality-proto (push) Failing after 2s
CI / deploy (push) Has been skipped
start-all/stop-all/health-check/test-cdc PowerShell scripts.

Compatible with PowerShell 5.1 (ASCII only, no emoji).
2026-07-09 13:47:46 +08:00
SpecialX
d8dab70406 feat(infra): add OTel auto-instrumentations across all services
Some checks failed
CI / quality-proto (push) Failing after 2s
CI / deploy (push) Has been skipped
CI / quality-ts (push) Failing after 1m11s
CI / quality-go (push) Failing after 5s
NestJS 6 services use getNodeAutoInstrumentations().

Python 2 services use FastAPIInstrumentor. Go 2 services use otelgin.
v0.6.2-otel
2026-07-09 13:25:46 +08:00
SpecialX
1f901c5b20 feat(data-ana): implement complete CDC pipeline MySQL to ClickHouse
Debezium + Kafka + aiokafka consumer with table routing.

E2E verified: MySQL INSERT to ClickHouse upsert.
v0.6.1-cdc
2026-07-09 13:02:59 +08:00
SpecialX
958b17c9d8 feat(infra): p6 hardening - metrics collection and registry mirror
- 4 services add collectDefaultMetrics for process metrics
- docker-compose.yml images prefixed with docker.m.daocloud.io
- Prometheus v0.51.0 (nonexistent) fixed to v2.51.0
- Grafana port remapped 3000 to 3030 to avoid teacher-portal conflict
- ClickHouse edu_analytics database initialized
- known-issues.md documents 7 new P6 scenario-to-rule mappings
2026-07-09 12:29:36 +08:00
SpecialX
566060fade feat(infra): p6 hardening - observability and deploy compose
- 5 NestJS services add /metrics endpoint via app.getHttpAdapter()
- prometheus.yml scales to 8 services with rule_files and alertmanager
- monitoring compose replaces blackbox with Loki+Promtail
- Grafana datasource adds Loki
- docker-compose.deploy.yml scales to 11 services
- deploy.env.example completes Neo4j/ES/ClickHouse/LLM vars
- teacher-bff adds health.controller
- CI removes continue-on-error on lint step
- teacher-portal lint script changed to eslint src
2026-07-09 10:21:06 +08:00
SpecialX
3ca654619f chore(infra): 配置ESLint 9 flat config并恢复lint-staged集成
- 新增 eslint.config.js(ESLint 9 flat config 格式)
- 安装 @eslint/js + typescript-eslint + eslint-config-prettier
- 6 个 TS 服务 lint 脚本:eslint src --ext .ts → eslint src
- lint-staged 恢复 eslint --fix
- .gitignore 忽略 docker-compose.minimal.override.yml
- known-issues.md 新增 P6 硬化条目
2026-07-09 09:14:44 +08:00
SpecialX
a70a74207e feat(ai): 完善AI网关服务并添加LLM降级模式
config.py 加openai_api_key/base_url/dev_mode

新建llm_client.py httpx异步调OpenAI REST API

main.py 业务路由加/ai前缀+降级模式+readyz端点

Gateway添加/notifications和/ai路由

docs: known-issues记录P5三服务经验
2026-07-09 09:09:27 +08:00
SpecialX
dfb6d2bfc1 feat(push-gateway): 修复WebSocket并发写竞争并添加DEV_MODE鉴权
hub.go 重写用send chan+单写协程模式避免并发写竞争

handler.go 加DEV_MODE dev-token支持+broadcast端点

config.go 加DevMode/RedisURL字段
2026-07-09 09:09:13 +08:00
SpecialX
416e1bc0b2 feat(msg): 修复通知服务并添加ES降级与Push Gateway推送
database.ts 导出db常量替代getDb()函数

env.ts JWT_SECRET/ES_URL改optional加DEV_MODE/PUSH_GATEWAY_URL

elasticsearch.ts ES降级: ES_URL未设置时esClient=null

notifications.service.ts 加createBatch+分页查询+Push Gateway推送调用

新建msg-init.sql创建2张表
2026-07-09 09:08:57 +08:00
SpecialX
421edd8a41 feat(data-ana): 完善学情诊断服务并添加ClickHouse降级模式
config.py ClickHouse连接改可选+加DEV_MODE/kafka_brokers

clickhouse_client.py 降级模式: host为空时返回None

main.py 端点先查ClickHouse降级返回骨架数据+新增errorbook

新增clickhouse-init.sql创建宽表和错题表

Gateway添加/analytics路由
2026-07-09 08:58:39 +08:00
SpecialX
5f18821302 feat(api-gateway): 添加content服务代理路由
main.go添加textbooks/chapters/knowledge-points/questions四组路由

config.go新增ContentServiceURL字段

docs: known-issues记录P4 content端到端验证经验
2026-07-09 08:52:30 +08:00
SpecialX
921fe82771 feat(content): 修复服务并添加chapters/knowledge-points/questions模块
- database.ts 导出db常量替代getDb()函数

- env.ts JWT_SECRET/ES_URL/NEO4J_URL改optional加DEV_MODE

- neo4j.ts driver惰性创建+try/catch+connectionTimeout:3000

- health/lifecycle改用Drizzle原生查询

- textbooks.schema修复integer到int+导出NewTextbook类型

- 新建chapters/knowledge-points/questions三模块CRUD

- knowledge-points含Neo4j前置依赖图非阻塞查询

- content-init.sql创建4张表

端到端验证: textbooks/chapters/knowledge-points/questions全CRUD通过
2026-07-09 08:52:15 +08:00