SpecialX
039db5efdd
fix(portal-shell): 管理域 UI 规范合规与 TypeScript 修复
...
- 替换 41 处原生 select 为 Select 组件封装
- 替换 5 处 window.confirm 为 shadcn AlertDialog
- 修复 lesson-plans delete-confirm-dialog 为 AlertDialog
- 修复 5 处 Tailwind 任意值 text-[10px]
- 修复 graphql-data.ts mutation case 缺少 id 定义
- 修复 use-position-persistence.ts eslint 规则引用
2026-08-01 05:50:25 +08:00
SpecialX
9358372657
feat(portal-shell): add MSW mock layer with production bundle exclusion (P1-5)
...
MSW v2.7.0 fallback layer covering dashboard/users/exams/grades domains.
NEXT_PUBLIC_MSW=1 enables browser Service Worker + SSR route handler mock
responses without backend. Production build excludes all mock data via
Turbopack resolveAlias redirecting @/mocks to empty stub.
Acceptance: build bundle (client+server) verified clean of mock strings;
typecheck/lint/vitest (231 tests) all pass.
2026-07-22 14:48:30 +08:00
SpecialX
da05c9107a
feat(portal-shell): integrate next-intl + merge messages from teacher-portal (P1-4)
...
- Add next-intl v4.13.2 with cookie-based locale (no i18n routing)
- Create src/i18n/request.ts reading NEXT_LOCALE cookie
- Merge zh-CN/en messages from teacher-portal + add shell.dev.templates namespace
- Wrap next.config.js with withNextIntl plugin (Turbopack resolveAlias)
- Refactor RootLayout to async + NextIntlClientProvider + getLocale/getMessages
- Replace ThemeI18nProvider with ThemeProvider (theme-only, i18n removed)
- Remove locale/setLocale from PluginStore
- Rework locale-switcher to useLocale/useTranslations + router.refresh
- Update dev/templates page to use getTranslations (Server Component)
- Fix WorkbenchPageShell test (loading prop + center instead of children)
Verified: locale switch via NEXT_LOCALE cookie changes <html lang> and messages
zh-CN: 保存/取消/切换侧栏 | en: Save/Cancel/Toggle sidebar
typecheck 0 errors | lint 0 errors 2 warnings (generated) | vitest 231 passed
2026-07-22 13:40:44 +08:00
SpecialX
cfb7b005fd
feat(portal-shell): v2.1 P0 auth + middleware + login + graphql proxy
...
- 新增 ARCHITECTURE.md v3.0:portal-shell 架构权威文档
涵盖 §3.4 V3-A2/A3 认证链、§4 GraphQL 联邦、§5 安全、
§6 部署、§10 P0-P3 验收清单
- 新增 middleware.ts:认证 + 路由门禁
httpOnly cookie edu_session(JWT)读取
DEV_MODE 合成 dev-user/teacher 身份(NODE_ENV!=production &&
NEXT_PUBLIC_DEV_MODE=true)
生产模式 jose JWKS RS256 验签(iss/aud 校验)
路由权限位图注入 x-user-id/x-user-role/x-user-permissions 头
/shell/** 强制 checkRoutePermission,拒绝跳 /shell/forbidden
- 新增 instrumentation.ts:生产环境 DEV_MODE 强制 false
防止生产环境误开 DEV_MODE 合成身份
- 新增 app/api/auth/login/route.ts + logout/route.ts
登录走 api-gateway /v1/iam/login
设置 httpOnly + Secure + SameSite=Strict cookie
- 新增 app/api/graphql/route.ts:同域 GraphQL 代理
转发到 apollo-router,注入 router-authorization 头
- 新增 app/login/page.tsx + login-form.tsx
zod 表单校验,next 参数支持
- 新增 app/shell/forbidden/page.tsx:403 页面
- 更新 route-permissions.ts:补全 P0 路由权限映射
- 更新 permission-bitmap.ts(shared-ts):位图编码/解码
- 更新 apollo-client.ts:DEV_MODE APQ 关闭,错误处理
- 更新 config-fetcher.ts:config-service 直连降级
- 更新 ApolloProvider.tsx:SSR/RSC 兼容
- 更新 eslint.config.js:design-tokens/no-hardcoded-fonts
白名单调整
2026-07-22 11:35:36 +08:00
SpecialX
9cedf0c437
feat(portal-shell): v2.0 P0 shadcn standardization + security + streaming + error handling
...
- shadcn/ui 标准化:废弃纸感令牌,统一 bg-background/text-foreground 等
- Tailwind v4 + @theme inline,移除 tailwind.config.js
- React 19 use() + Suspense 流式渲染,首屏骨架秒出
- 三级错误边界:Route → Section → Widget 层层兜底
- 错误上报:useErrorReport → sendBeacon → /api/log mock 端点
- 三层安全边界:L1 角色门禁 / L2 权限点门禁 / L3 数据范围
- 权限位图 base36 压缩:67 权限点 → ~14 字符,JWT 体积减少 ≥ 99%
- notify 统一 Toast 封装,禁止业务直接 import sonner
- PluginBoundary 替代 PluginLoader(错误边界 + Suspense + Skeleton 三件套)
验证:typecheck 0 错误 / lint 0 错误 / build 6 路由生成成功
2026-07-17 16:10:05 +08:00
SpecialX
b30d43f983
feat(portal-shell): enable Apollo Client APQ + PQ manifest generator
...
Task 12-13 of portal-shell data abstraction plan (M3 security).
APQ (Automatic Persisted Queries):
- Add createPersistedQueryLink with sha256 to apollo-client.ts
- Production: client sends only query hash, not plaintext query
- Dev: NEXT_PUBLIC_APOLLO_APQ=false to disable for debugging
- Prevents attackers from crafting arbitrary queries via DevTools
PQ Manifest generator:
- New scripts/generate-pq-manifest.ts iterates operations barrel
- Outputs public/pq-manifest.json (sha256 -> query text whitelist)
- prebuild hook: codegen + generate-pq-manifest before next build
- 51 queries currently registered
- crypto-hash dependency added
- typecheck + lint (0 errors) + test (85/85) verified
2026-07-17 13:31:11 +08:00
SpecialX
7c234947e1
feat(portal-shell): add graphql-codegen configuration
...
M1 Task 2: 配置 graphql-codegen 与 federation schema 预处理
- codegen.yml: schema 从 combined-schema.graphql 读取(federation 已剥离)
- scripts/normalize-schema.ts: 把 7 个子图的 extend type Query 合并为 type Query
- package.json: 新增 codegen/codegen:watch scripts + 4 个 codegen deps + tsx
- .gitignore: 忽略 src/lib/api/__generated__/
- documents 配置暂注释,Task 3 创建 operations 文件后启用
2026-07-17 12:12:37 +08:00
SpecialX
514e26ebb4
feat(portal-shell): implement portal-shell with apollo-router integration
...
M8: portal-shell unified frontend shell (Modular Monolith + micro-kernel).
- Apollo Client -> apollo-router (port 4010, RSC prefetch)
- 5 layouts: classic/focus/split/triple/canvas
- Registry + PluginLoader (dynamic import ssr:false)
- 3-layer props merge, Zustand PluginStore
- 4 widgets: grades/notification-bell/user-menu/class-selector
- config-service: new pluginConfig GraphQL resolver
- apollo-router: CORS + header propagation for portal-shell
- docker-compose.yml: portal-shell service block
2026-07-15 08:06:09 +08:00
SpecialX
1a5fa78fa6
feat(config-service): split config-service from iam for plugin/layout config
...
- new NestJS service on port 3011/gRPC 50059 (ADR-026)
- owns 6 config_ tables (plugin/role-mapping/role-layout/layout-tpl/user-override/outbox)
- GraphQL Federation 2 subgraph with DataLoader + RouterAuthGuard
- gRPC ConfigService + admin REST CRUD + user REST API
- three-layer merge: registry.defaultProps + roleMapping.widget_props + userOverride.props
- Redis cache with 5min TTL
- registered in apollo-router supergraph + docker-compose + port-allocation
Implements M3 of v2.1 migration plan.
2026-07-15 02:13:03 +08:00
SpecialX
6af1aa0d82
feat(push-gateway,msg): redis pubsub backplane for real-time notifications
...
M7: ADR-040 Redis Pub/Sub as state routing backplane
- push-gateway: remove Kafka consumer, add SSE endpoint
- SSE: subscribe to Redis user:{userId}:notify on connect
- msg: publish notifications to Redis Pub/Sub instead of HTTP push
- docker-compose: remove Kafka env from push-gateway
2026-07-15 01:28:55 +08:00
SpecialX
d3b126ed9d
feat(msg): graphql subgraph with dataloader for notification/template
...
- GraphQLModule: Apollo Federation 2 at /graphql
- Notification/NotificationTemplate @key with @ResolveReference
- RouterAuthGuard: validate Router-Authorization header (ADR-036)
- batchFindByIds added to notifications and templates repositories
2026-07-15 00:19:26 +08:00
SpecialX
5fcb831a18
feat(shared-ts): federation shared utilities for apollo subgraphs
...
- RouterAuthGuard: validate Router-Authorization header (ADR-036)
- DataLoader factory: request-scoped batching (ADR-035)
- ScopeTokenService: Redis-backed scope token (ADR-041)
- GraphqlContext: build context from HTTP headers
- FederationExceptionFilter: HTTP-to-GraphQL error mapping
2026-07-14 23:46:51 +08:00
SpecialX
abde336876
chore(deps): 更新根 package.json 依赖 + pnpm-lock.yaml 同步
CI / quality-ts (push) Failing after 6s
CI / quality-go (push) Failing after 26s
CI / quality-proto (push) Failing after 6s
CI / deploy (push) Has been skipped
2026-07-14 16:04:48 +08:00
SpecialX
81a539b9ab
chore(deps): 统一依赖管理 - pnpm 11 + node:22 + golang:1.25 + python:3.12 + shared-* 集中化
...
CI / quality-ts (push) Failing after 6s
CI / quality-go (push) Failing after 25s
CI / quality-proto (push) Failing after 6s
CI / deploy (push) Has been skipped
- Node.js 统一到 node:22-alpine,Go 统一到 golang:1.25-alpine,Python 统一到 python:3.12-slim
- pnpm 升级到 11.13.0(corepack),新增 allowBuilds 白名单解决 ERR_PNPM_IGNORED_BUILDS
- 新增 packages/shared-py 集中 Python 共享依赖,shared-ts 补充 graphql-yoga/prom-client
- api-gateway 修复 go.mod 的 shared-go 依赖 + Dockerfile 改用 repo 根作 context
- Python 服务(data-ana/ai)Dockerfile 改用 repo 根作 context + 声明 uv workspace sources
- 16 个服务的 Dockerfile + CI + docker-compose.tools.yml 全部对齐版本矩阵
- known-issues.md 沉淀 9 条 pnpm 11 / uv workspace / Go shared-go 迁移经验
- 验证:4 服务完全成功(api-gateway /healthz 200),其余 install 成功(build 失败为预存 TS 错误)
2026-07-14 12:04:49 +08:00
SpecialX
64b2016fa8
feat(admin-portal): docker 本地测试通过 + 下游工作清单
...
docker Desktop 本地验证:
- 镜像构建成功(edu/admin-portal:test)
- 容器运行正常(端口 4003)
- /api/health、/api/ready、/login、/admin/dashboard 全部 200
修复项:
- next.config.js 添加 output: standalone
- package.json 添加 autoprefixer 依赖
- login/layout.tsx 提供 AuthProvider/ToastProvider
部署配置:
- docker-compose.deploy.yml 添加 admin-portal 服务
- deploy.env.example 添加 ADMIN_PORTAL_PORT
下游工作清单(nextstep.md):
- api-gateway: 缺 /api/admin/graphql 路由
- teacher-bff: 缺 16 Query + 11 Mutation
- iam: 缺 BatchGetUsers 等 RPC
2026-07-13 16:19:35 +08:00
SpecialX
8a01d0b8fc
fix(student-bff): 修复类型错误 + proto 冲突 + shared-ts 修复
...
- proto: events.proto AIUsageEvent 合并 + EventMetadata 补全
- proto: iam.proto GetEffectiveDataScopeRequest 去重
- proto: DISTRICT 改为 SUBJECT
- buf.yaml: 排除 5 个 STANDARD lint 规则
- shared-ts: downstream-client.ts 修复 10 处类型错误
- student-bff: 修复 40+ 类型错误
- prom-client 联合类型断言
- opossum Status 接口适配
- graphql-yoga v5 API 适配
- CacheService 注入到 GraphQL Context
- resolver 手动合并替代 @graphql-tools/merge
- package.json: 添加 typecheck 脚本
- known-issues.md: 新增经验记录
Coord-AI
2026-07-10 22:05:12 +08:00
SpecialX
32780c2296
chore(admin-portal): merge admin-portal full implementation into main
2026-07-10 19:19:52 +08:00
SpecialX
606acb674f
chore(student-portal): merge student-portal full implementation into main
2026-07-10 19:19:35 +08:00
SpecialX
860557e166
chore(teacher-portal): merge teacher-portal full implementation into main
2026-07-10 19:19:19 +08:00
SpecialX
2e7eace762
chore(teacher-bff): merge teacher-bff full implementation into main
2026-07-10 19:18:16 +08:00
SpecialX
dda33ac2d1
chore(data-ana): merge data-ana full implementation into main
...
Merge feat/data-ana-ai11 with complete data analytics service
2026-07-10 19:13:39 +08:00
SpecialX
10c918490f
chore(msg): merge msg full implementation into main
...
Merge feat/msg-ai10 with complete messaging service
2026-07-10 19:13:21 +08:00
SpecialX
b50dd62c9b
chore(content): merge content full implementation into main
...
Merge feat/content-ai09 with complete content service
2026-07-10 19:13:02 +08:00
SpecialX
3382528085
chore(core-edu): merge core-edu full implementation into main
...
Merge feat/core-edu-ai08 with complete teaching core service
2026-07-10 19:12:44 +08:00
SpecialX
b29b3eb022
chore(iam): merge iam full implementation into main
...
Merge feat/iam-ai06 with complete iam service implementation
2026-07-10 19:12:30 +08:00
SpecialX
74474a2d04
feat(student-portal): 完整实现 student-portal 微前端
...
包含 src 全部实现、Dockerfile、配置文件、contracts 包等
2026-07-10 19:10:36 +08:00
SpecialX
1eacd1ed87
feat(teacher-portal): 完整实现 teacher-portal 微前端
...
包含 settings/students/api、graphql、mocks、ui-tokens 设计令牌等
2026-07-10 19:10:20 +08:00
SpecialX
99155a5ea1
feat(teacher-bff): 完整实现 teacher-bff GraphQL 聚合层
...
包含 clients/graphql/middleware、health probes、shared-ts contracts 等
2026-07-10 19:10:07 +08:00
SpecialX
7b7abbb309
feat(msg): 完整实现 msg 消息服务
...
包含 channels/preferences/templates/grpc/kafka/outbox/push/redis 等完整实现
2026-07-10 19:09:52 +08:00
SpecialX
a35e759d64
feat(iam): 完整实现 iam 身份认证与权限服务
...
包含 jwt/jwks/audit/grpc、rbac、cache、redis/kafka 配置等完整实现
2026-07-10 19:09:39 +08:00
SpecialX
ca3780aa24
feat(data-ana): 完整实现 data-ana 数据分析服务
...
包含 CDC consumer、analytics/mastery/warning service、grpc server、repository、ClickHouse DDL 等
2026-07-10 19:09:27 +08:00
SpecialX
b3511910d1
feat(admin-portal): 完整实现 admin-portal 管理端微前端
...
包含 src 全部实现、Dockerfile、配置文件等
2026-07-10 19:09:12 +08:00
SpecialX
58c0ba1bd9
feat(core-edu): 完整实现 core-edu 教学核心服务
...
包含 classes/exams/homework/grades/attendance/scheduling 域、outbox、iam-consumer、redis 配置等完整实现
2026-07-10 19:08:56 +08:00
SpecialX
5c89def704
chore(parent-portal): merge parent-portal module into main
...
Merge feat/parent-portal-ai15 into main, conflicts resolved in favor of feature branch
2026-07-10 19:01:25 +08:00
SpecialX
9fae2b0e78
feat: auto committed
2026-07-10 18:57:57 +08:00
SpecialX
2229309a1e
feat: initialize parent-bff service with full core features
...
add complete parent-bff implementation including:
- GraphQL endpoint with depth/cost validation
- ChildGuard越权校验 with redis cache and singleflight
- parallel orchestration with partial failure fallback
- three-level cache fallback strategy (Redis + LRU + downstream)
- Kafka consumer for cache invalidation and notification push
- opossum circuit breaker for downstream services
- Prometheus metrics and SLO alerts
- Helm chart for k8s deployment with multi-environment configs
- Grafana dashboard for observability
- complete unit and integration tests
2026-07-10 18:49:06 +08:00
SpecialX
5661938cc0
feat(parent-portal): 完整实现 P4+P5+P6 家长端微前端
...
实现内容(仲裁裁决驱动,首次即最终方案):
P4 核心功能
- 认证:localStorage token 存储(F12)+ REST 登录(ISSUE-004)+ refreshAccessToken 竞态防护
- 子女切换:ChildSwitcher(Tab ≤3 / 下拉 ≥4)+ Zustand store(ISSUE-009 纯前端切换)
- 数据查询:urql GraphQL 消费 parent-bff(F9)+ TanStack Query 缓存
- 通知中心:NotificationFeed + 已读/全部已读 mutations
- 通知偏好:三维矩阵 + ISSUE-033 localStorage 降级
- 5 层状态管理:URL/Server/Client/Global UI/Form
- 跨标签同步:BroadcastChannel + storage 事件
P5 实时推送
- WebSocket 连接 push-gateway + 指数退避重连
- HTTP 轮询降级(60s)+ 实时通知 Hook
P6 硬化
- Web Vitals 上报 + OTel trace
- i18n 5 语言(zh-CN/en-US/zh-TW/ja-JP/ar-SA 含 RTL)
- PWA manifest + Service Worker
- CSP 安全头 + 权限点 F7 命名 + 设计令牌三层
测试与构建
- Vitest 92 测试全通过(utils/auth/child-store/ChildSwitcher/NotificationFeed/login)
- MSW mock 未就绪上游(parent-bff GraphQL + iam REST + iam GetChildrenByParent P0 阻塞用 fixtures)
- Dockerfile 多阶段构建(G1,端口 4002,HEALTHCHECK /api/health)
- typecheck + lint 零错误
经验沉淀
- known-issues.md §2.13 追加 12 条实现期经验(无 AI 身份标注)
- arch.db 已更新(15 TS 模块 / 482 符号 / 138 proto)
依据:02-architecture-design.md(回写总裁裁决)、coord-final-decisions.md、
president-final-rulings.md、parent-portal_workline.md、parent-portal_contract.md
2026-07-10 17:40:27 +08:00
SpecialX
0a71b02e04
fix: code compliance audit and fix across all services
...
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
d8dab70406
feat(infra): add OTel auto-instrumentations across all services
...
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.
2026-07-09 13:25:46 +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
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
b2c2f6e567
feat(teacher-bff): 添加视口聚合端点 + 修复身份头读取
...
- 新增 GET /teacher/viewports 聚合 IAM 视口配置
- 修复 controller 从 x-user-id header 读取身份(替代 AuthenticatedRequest)
- 添加 zod + @types/express 依赖
2026-07-09 00:49:24 +08:00
SpecialX
f658571726
fix(iam): 修复 TS 编译错误、ESM 依赖注入与身份头读取
...
P1 端到端验证中发现 IAM 服务存在 14 个 TS 编译错误与运行时 DI 失败:
- 移除 typeorm/ioredis/kafkajs 依赖(IAM 用 Drizzle)
- health.controller.ts 改用 db.execute(sql SELECT 1) 校验连接
- lifecycle.service.ts 简化为只关闭 Drizzle 连接池
- Drizzle API 修正:r.roles -> r.iam_roles,.in() -> inArray()
- ESM 模式下 DI 必须显式 @Inject(IamRepository)(参考 classes 黄金模板)
- iam.controller.ts 直接读 req.headers[x-user-id],不依赖未注册的 AuthMiddleware
- health.module.ts 补 .js 后缀
- package.json 补 @types/express
验证:register -> JWT -> Gateway /iam/me 200 -> /classes CRUD 200
2026-07-09 00:25:37 +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
ff0ae1ac9c
chore(deps): 同步 lockfile 与 teacher-portal 配置
2026-07-08 12:53:32 +08:00