SpecialX
|
3b88e9cca5
|
ci(infra): 完整 CI/CD 流水线配置
- ci-ts.yml: lint/typecheck/test/build + arch-scan + docker-build(classes + teacher-portal)
- ci-go.yml: vet/build/test + docker-build(api-gateway)
- ci-proto.yml: buf lint + buf breaking(本地 .git 比较)
- docker.yml: main/tag 触发,构建推送 3 服务镜像到 Gitea Registry
- deploy.yml: workflow_dispatch + workflow_run 触发,Runner 直接 docker compose 部署,含健康检查与回滚
- 所有 workflow runs-on: ubuntu-latest 匹配 actrunner 标签
|
2026-07-08 15:13:53 +08:00 |
|
SpecialX
|
4a0893ef52
|
feat(infra): 新增生产 Dockerfile 与部署 compose
- api-gateway/Dockerfile: 多阶段构建,golang:1.22-alpine → alpine:3.20,CGO_ENABLED=0 静态编译,非 root 运行
- teacher-portal/Dockerfile: 多阶段构建,node:20-alpine builder → runner,含 HEALTHCHECK
- docker-compose.prod.yml: 本地生产编排,3 服务,强制 DEV_MODE=false
- docker-compose.deploy.yml: 服务器部署用,镜像来自 Gitea Registry,通过 edu-shared 外部网络连接 MySQL/Redis
- deploy.env.example: 部署环境变量模板
|
2026-07-08 15:12:34 +08:00 |
|
SpecialX
|
e5902ca2b3
|
fix(api-gateway): 修复尾斜杠重定向循环与 DEV_MODE 旁路
- main.go: 禁用 RedirectTrailingSlash,为 classes/iam/teacher 双注册无尾斜杠与通配符路由
- auth.go: DEV_MODE=true 时接受 Bearer dev-token 注入开发用户
- config.go: 新增 DevMode 配置项与 getEnvBool 工具
- page.tsx: 开发模式请求携带 Authorization: Bearer dev-token
- .env.example: 添加 DEV_MODE=false 默认值与生产警告
|
2026-07-08 15:11:47 +08:00 |
|
SpecialX
|
a4ec5b72c5
|
fix(classes): 修复依赖注入与 ESM 导入路径
- classes.module.ts: 移除 useFactory,改用直接 provider 注册
- classes.service.ts: 添加 @Inject 装饰器显式注入 Repository
- health.module.ts: 修复 import 添加 .js 后缀(ESM 模式)
- package.json: 补充 ioredis/kafkajs/typeform 等运行时依赖
|
2026-07-08 15:11:12 +08:00 |
|
SpecialX
|
2df2237d56
|
fix: 移除 pre-push hook
CI Python / test (push) Failing after 1m30s
CI Go / test (push) Failing after 31s
CI TypeScript / test (push) Failing after 7s
husky 9 的 pre-push hook 在 Windows Git Bash 下有 stdout 'Bad file descriptor' bug,
阻塞所有推送。Go 编译检查改由 CI 完成。
规范文档 docs/standards/git-workflow.md §3.4 保留 pre-push 设计说明,
待 husky 修复或迁移至 CI 后恢复。
|
2026-07-08 13:10:43 +08:00 |
|
SpecialX
|
6f68f9722e
|
fix: pre-push hook 在 go 不可用时跳过
Git Bash 环境可能未将 go 加入 PATH,导致 hook 失败阻塞推送。
改为 command -v 检测,不可用时跳过(CI 会做完整检查)。
|
2026-07-08 13:10:16 +08:00 |
|
SpecialX
|
ff0ae1ac9c
|
chore(deps): 同步 lockfile 与 teacher-portal 配置
|
2026-07-08 12:53:32 +08:00 |
|
SpecialX
|
b39095cbdd
|
docs: git-workflow v1.1 与 CODEOWNERS 规范
- git-workflow.md v1.1: scope-enum 对齐实际服务名(identity→iam 等)
- git-workflow.md: 新增 §4.7 模块 Owner 与 CODEOWNERS 章节
- git-workflow.md: husky hooks 与实际文件对齐,新增 pre-push 说明
- .github/CODEOWNERS: 定义各模块 owner team 与 PR 合并职责
- .github/pull_request_template.md: PR 模板
|
2026-07-08 12:53:18 +08:00 |
|
SpecialX
|
beedbaf686
|
docs: 同步 P6 工作日志、runbook 与服务 README
- known-issues.md: 追加 9 条 P6 工作经验日志,更新 arch-scan 经验
- post-p6-followup.md: 新增 P6 后续工作手册 runbook
- iam/core-edu/content/msg README: 补充健康检查端点说明
|
2026-07-08 12:53:05 +08:00 |
|
SpecialX
|
20b1afd9ab
|
fix(ai): ruff 自动修复 health 模块
|
2026-07-08 12:52:48 +08:00 |
|
SpecialX
|
4fea3de1d1
|
fix(data-ana): ruff 自动修复代码风格
|
2026-07-08 12:52:33 +08:00 |
|
SpecialX
|
3961a36308
|
fix(push-gateway): 同步 go.sum
|
2026-07-08 12:52:22 +08:00 |
|
SpecialX
|
a4cd970c54
|
fix(api-gateway): 升级 gobreaker v2 并更新 README
- go.mod: 新增 github.com/sony/gobreaker/v2 v2.1.0
- go.sum: 同步校验和
- README: 新增 P6 中间件链说明、健康检查端点表、测试说明、配置环境变量表
|
2026-07-08 12:52:08 +08:00 |
|
SpecialX
|
75804c7d64
|
fix: lint-staged 移除 Go gofmt 规则
Go 工具链不在 git hook(Git Bash)PATH 中,gofmt 执行失败。
Go 文件格式化由开发者手动执行 go fmt。
|
2026-07-08 12:51:46 +08:00 |
|
SpecialX
|
d831915f06
|
feat(infra): k8s Helm Chart 演化与备份脚本测试
- 新增 edu-platform 平台级 chart(namespace/configmap/secret/ingress/hpa)
- 新增 api-gateway 服务级 chart(完整迁移自原 manifest)
- 新增 6 个业务服务 chart 桩(iam/core-edu/content/msg/data-ana/ai)
- 删除原 api-gateway-deployment.yaml(已迁移至 helm chart)
- 更新 infra/k8s/README.md 为 Helm Chart 管理说明
- 新增 backup-mysql.sh dry-run 测试脚本(17 断言)
|
2026-07-08 12:50:56 +08:00 |
|
SpecialX
|
9b33303195
|
fix(infra): go.work 修复 BOM 与版本号
- 去除 UTF-8 BOM(导致 go 命令解析失败)
- go 版本更新为 1.26.0
|
2026-07-08 12:50:26 +08:00 |
|
SpecialX
|
bc3176cb05
|
fix(docs): 004 架构图补充分层/领域双视角与视口四层模型
- 1.1a 技术分层视角:用户层标注改为场景域用户
- 1.1b 业务领域视角:新增 6 领域 subgraph(D1-D6)
- 1.2 服务清单新增业务领域列
- 5.4 新增视口四层模型章节(L1-L4 + 场景域 BFF 复用策略)
|
2026-07-08 12:50:13 +08:00 |
|
SpecialX
|
3fbb97791d
|
fix(docs): 修复 project_rules.md P0 损坏并同步所有引用
- 根目录 project_rules.md 损坏(72 字节乱码),已删除
- 从 CICD 项目迁移完整版至 .trae/rules/project_rules.md(17881 字节)
- 更新 MIGRATION_GUIDE/README/coding-standards 引用至 .trae/rules/
- P0 紧急修复,影响所有 AI 工作流程
|
2026-07-08 12:50:00 +08:00 |
|
SpecialX
|
4629de1926
|
fix(arch-scan): 修复多语言扫描器并添加 DELETE 清空表
- scanner.ts: 添加 DELETE 清空旧数据语句,避免重复插入
- ts-scanner: 改用 regex 替代 ts-morph 解析(避免解析失败)
- go-scanner/py-scanner/proto-scanner: 完善实现
|
2026-07-08 12:49:43 +08:00 |
|
SpecialX
|
f554011af5
|
chore: 修复 lint-staged 与 husky 配置适配当前工具链
- lint-staged: TS 暂移除 eslint(ESLint 9 flat config 缺失)
- lint-staged: Go 暂移除 golangci-lint(未安装)
- lint-staged: gofmt 仅处理 .go(不处理 .mod/.sum)
- husky: 去除 commit-msg/pre-commit 的 UTF-8 BOM
- husky: 新增 pre-push hook(Go 编译检查)
|
2026-07-08 12:49:18 +08:00 |
|
SpecialX
|
e9ea34fe53
|
feat(p6): production hardening with circuit breaker, backup, monitoring and chaos engineering
CI Go / test (push) Has been cancelled
CI Python / test (push) Has been cancelled
CI TypeScript / test (push) Has been cancelled
CI Proto / lint (push) Failing after 8m7s
P6 生产硬化阶段交付物(46 文件):
## 1. API Gateway 中间件链(services/api-gateway/internal/middleware/)
- circuit-breaker.go: gobreaker v2 熔断器(5s 窗口/50% 错误率/30s OPEN→HALF_OPEN)
- ratelimit.go: 令牌桶限流(sync.Map + cleanup goroutine,默认 100rps/20 burst)
- cors.go: CORS 中间件(CORS_ORIGINS 环境变量)
- recovery.go: panic 恢复 + uuid request_id
- security.go: 安全头 + 请求体 10MB 限制
- requestid.go: 请求 ID 注入
- health/health.go: /healthz + /readyz 健康检查
- main.go: 重写注册全部中间件链(Recovery→RequestID→CORS→Security→BodyLimit→RateLimit→CircuitBreaker→Auth)
## 2. 基础设施硬化(infra/)
- backup/backup-mysql.sh: MySQL 全量备份(mysqldump+gzip,按服务独立)
- backup/restore-mysql.sh: 恢复脚本
- backup/backup-cron.sh: cron 调度入口(5 服务批量备份)
- alertmanager/alertmanager.yml: 告警路由(webhook + 邮件示例)
- prometheus/rules.yml: 8 条告警规则(服务可用性/性能/资源 3 组)
- grafana/dashboards/microservices-overview.json: 4 panel 仪表盘
- grafana/provisioning/: 数据源和仪表盘 provisioning
- k8s/namespace.yaml: 4 命名空间(edu-system/services/monitoring/ingress)
- k8s/api-gateway-deployment.yaml: Deployment + Service 骨架
- chaos/experiments.yaml: 3 个 Litmus 混沌实验(pod-kill/network-latency/disk-fill)
- docker-compose.monitoring.yml: 监控栈 profile
- security/secrets.example.env: 8 项密钥占位符
- security/waf-rules.conf: ModSecurity WAF 规则骨架
## 3. 业务服务健康检查 + 优雅停机(5 个 NestJS 服务)
- services/{iam,core-edu,content,msg,classes}/src/shared/health/: /healthz + /readyz
- services/{iam,core-edu,content,msg,classes}/src/shared/lifecycle/: OnModuleInit + OnApplicationShutdown
## 4. Python 服务健康检查
- services/{ai,data-ana}/src/health/health.py: FastAPI APIRouter
## 5. 运维文档
- docs/architecture/runbooks/p6-hardening.md: P6 总览 Runbook(9 章节)
- docs/architecture/runbooks/incident-response.md: 事件响应手册(5 章节)
- docs/architecture/004-p6-addendum.md: 004 架构补记 P6 章节
- docs/troubleshooting/known-issues-p6-addendum.md: 15 条 P6 场景→技术映射
## 验收信号
- RPO ≤ 15min(MySQL 备份 + binlog PITR)
- RTO ≤ 30min(K8s 滚动更新 + DNS 切换)
- P99 ≤ 500ms(熔断 + 限流 + 缓存)
- 熔断器错误率 > 50% 触发 OPEN
- 限流 100rps/20 burst
- 备份保留 7 天
- 混沌实验每月 1 次
v0.6.0-p6
|
2026-07-08 02:16:58 +08:00 |
|
SpecialX
|
7474a92e3b
|
feat(p5): messaging, push gateway and AI assistant services
P5 阶段交付物:
- services/msg: 消息通知服务(NestJS)
- notifications: 发送通知 + ES 全文检索 + search
- config/elasticsearch.ts: ES Client 单例
- package.json: 补充 @opentelemetry/sdk-node + exporter-trace-otlp-http
- services/push-gateway: WebSocket 推送网关(Go Gin)
- internal/hub/hub.go: WebSocket 连接池管理(Register/Unregister/SendToUser)
- internal/ws/handler.go: JWT 鉴权 + WebSocket 升级 + 内部推送 API
- services/ai: AI 辅助服务(Python FastAPI)
- /chat + /chat/stream(SSE 流式)
- /generate/question + /optimize/expression
- config.py: OpenAI 兼容 API 配置
- packages/shared-proto/proto/msg.proto: NotificationService 契约(send/search)
- packages/shared-proto/proto/ai.proto: AiService 契约(含 stream 方法)
v0.5.0-p5
|
2026-07-08 01:39:02 +08:00 |
|
SpecialX
|
9850bfcfd1
|
feat(p4): content analysis service with Neo4j knowledge graph and ClickHouse analytics
P4 阶段交付物:
- services/content: 内容资源服务(NestJS)
- textbooks: 教材 CRUD + 知识图谱绑定
- config/neo4j.ts: Neo4j driver 单例
- textbooks.service.ts: MySQL CRUD + Neo4j 知识图谱(createKnowledgeGraph/getPrerequisites)
- package.json: 补充 @opentelemetry/sdk-node + exporter-trace-otlp-http
- services/data-ana: 数据分析服务(Python FastAPI)
- main.py: FastAPI + /healthz + class_performance + student_weakness 骨架
- clickhouse_client.py: ClickHouse 客户端封装
- config.py: 环境变量配置
- packages/shared-proto/proto/content.proto: TextbookService + KnowledgeGraphService 契约
- packages/shared-proto/proto/analytics.proto: AnalyticsService 契约(class_performance/student_weakness)
v0.4.0-p4
|
2026-07-08 01:38:35 +08:00 |
|
SpecialX
|
23246ade6d
|
feat(p3): core teaching service with Outbox + Kafka event bus
P3 阶段交付物:
- services/core-edu: 教学核心服务(DDD 限界上下文:exams/grades/homework/classes)
- exams: 考试 CRUD + 事务内写 exam + outbox
- grades: 成绩 CRUD
- homework: 作业 CRUD
- classes.module: 复用 P1 classes 模块(聚合到 core-edu 服务)
- Outbox 模式实现:
- outbox.schema.ts: core_edu_outbox 表(id/aggregate_id/event_type/payload/status/retry_count)
- outbox.repository.ts: 支持事务参数 tx,确保业务+事件原子性
- outbox.publisher.ts: Kafka idempotent producer + transactionalId,TOPIC_MAP 路由 9 种事件,MAX_RETRY=5
- config/kafka.ts: idempotent producer + transactionalId 配置
- main.ts: 启动顺序 initTracer → connectKafka → outboxPublisher.start → app.listen
- packages/shared-proto/proto/core_edu.proto: ExamService/HomeworkService/GradeService 契约
- packages/shared-proto/proto/events.proto: ClassEvent/ExamEvent/HomeworkEvent/GradeEvent 领域事件契约
v0.3.0-p3
|
2026-07-08 01:38:07 +08:00 |
|
SpecialX
|
524204d30a
|
feat(p2): identity layer with IAM service and Teacher BFF
P2 阶段交付物:
- services/iam: 完整身份认证服务(users/roles/permissions/refresh_tokens 6 表 schema)
- register/login/refresh/getUserInfo 4 个核心 API
- bcrypt 密码哈希 + JWT 双 Token(access + refresh)
- 复用 classes 黄金模板(errors/observability/middleware 三件套)
- services/teacher-bff: 教师聚合 BFF
- Promise.allSettled 并行聚合 IAM + classes 数据
- /teacher/dashboard 单一聚合端点
- packages/shared-proto/proto/iam.proto: IamService 契约(Register/Login/RefreshToken/GetUserInfo)
- api-gateway: 新增 IamServiceURL/TeacherBffURL 配置 + /iam/* + /teacher/* 路由
v0.2.0-p2
|
2026-07-08 01:37:29 +08:00 |
|
SpecialX
|
2ba4250165
|
feat(p1): complete P1 foundation stage
CI Go / test (push) Has been cancelled
CI Proto / lint (push) Has been cancelled
CI Python / test (push) Has been cancelled
CI TypeScript / test (push) Has been cancelled
- monorepo: pnpm workspace + go.work + pyproject.toml + commitlint/husky
- infra: docker-compose (minimal + full profiles) + init-sql + prometheus
- arch-scan: multi-language scanner skeleton (TS/Go/Python/Proto)
- shared-proto: buf v2 + classes.proto (ClassService CRUD contract)
- api-gateway: Go/Gin + JWT HS256 auth + reverse proxy + request ID
- classes: NestJS golden template (error system + observability + middleware + CRUD + tests)
- teacher-portal: Next.js + paper-feel UI design system
- CI/CD: 4 workflows (go/ts/py/proto)
- docs: migration guide + project_rules + coding-standards + git-workflow + ui-design-system + 004 + 9 module READMEs + known-issues + spec/plan migration + roadmap
v0.1.0-p1
|
2026-07-07 23:39:37 +08:00 |
|