Files
dth/openspec/changes/chg_0004_experiment_platform_frontend/proposal.md
T
xstudio agentandClaude Opus 4.8 10acc8114d merge sandbox/7975338+28c26c5+cd2cfc4: chg_0004 experiment_platform_frontend — React SPA 4 views + 5 components + Vite proxy + 14 e2e cases (gate PASS)
- docs/dth/experiment-platform/web-design.md: T1 架构设计
- src/frontend/src/main.tsx + App.tsx: 入口 + 路由
- src/frontend/src/api/{auth,operators,runs,client}.ts: 4 文件
- src/frontend/src/components/{AuthContext,ProtectedRoute,OperatorCard,RunResult,Radar}.tsx: 5 组件(Radar SVG 自绘 139 行)
- src/frontend/src/views/{Login,Dashboard,OperatorList,Run}.tsx: 4 页
- src/frontend/src/styles.css: 159 行(< 200 预算,无 UI 库)
- src/frontend/vite.config.ts: proxy /api → :30000
- tests/e2e/dth_frontend.test.sh: 14 case (5 API + 4 routes + 2 static + 3 list)
- openspec/changes/chg_0004_experiment_platform_frontend/{5 工件}
- package-lock.json: +react/react-dom/react-router-dom/axios + vite/typescript

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-09-28 11:42:47 +08:00

2.0 KiB
Raw Blame History

change_id, status, owner, stakeholders, priority, target_release, created, skip_coverage
change_id status owner stakeholders priority target_release created skip_coverage
chg_0004 proposed pm@dth
pd
dev
qa
P1 v0.3 2026-09-28 false

Change: SP-1 实验台 React 前端 MVP(4 页 + 3 组件)

Why

chg_0002 落地了后端(NestJS + PGlite,3 个 demo 算子 hello-mpc / pir / vertical-lr,admin 登录,21 条 perm-smoke 全绿)。前端现在只有 package.json + index.html 壳,没法给用户 / 教师 / 学生用。本 chg 落地完整 React 前端。

Who

  • 高校教师:浏览器跑实验、查看可视化结果
  • 学生:发起 run、查看 run_id 与结果
  • 平台运营:管理界面基础

Scope

  • 4 页:Login / Dashboard / OperatorList / Run
  • 3 组件:OperatorCard / RunResult / Radar(能力雷达图,mock 数据)
  • 路由:react-router-dom v6
  • API 客户端:axios,token 走 localStorage
  • Vite proxy:/api/* → http://127.0.0.1:30000
  • e2e:tests/e2e/dth_frontend.test.sh 走 curl + 后端真接口(不需 Playwright)

Non-Goals

  • 不做组件库沉淀
  • 不做 E2E 浏览器测试(Playwright 等下次)
  • 不做实时 WebSocket / run 进度推送(用 polling / GET 拉结果)
  • 不做后端修改(chg_0002 已定)

Impact

  • 新 capability experiment_platform_web(独立元能力,不与 backend 共享 S 编号)

Acceptance

  • npm run dev 在 5173 起来,浏览器能登录(admin/123456)
  • Dashboard 显示 3 个统计卡(mock:实验总数 / 算子数 / 学员数)
  • OperatorList 列出 3 个算子卡片(hello-mpc / pir / vertical-lr)
  • 点 hello-mpc 卡片到 Run 页,submit 表单 → 拿 run_id → GET /runs/:id 显示 output_json
  • 能力雷达图 mock 数据按算子类型差异化(hello-mpc=基础;pir=检索;vertical-lr=LR 5 项)
  • 未登录访问 /dashboard 等非 /login 路由 → 跳 /login
  • bad login 显示 401 文案
  • check_spec_coverage.sh gap=0

Rollout

合并 main;./run.sh dev 同启 backend 30000 + frontend 5173。