Files
dth/openspec/changes/chg_0012_lms_multiscene_v2/spec.md
T
xstudio agent 78feb39316 chg_0012(T4): gate gap=0 + 5 回归 + 1 新 全 PASS
- openspec 5 件套完整(proposal/spec/tasks/testcases/testcases.map.yaml)
- check_spec_coverage.sh: 10 scenarios / 10 cases OK, gap=0
- tsc backend: 0 新错(仅预存 chg_0002 vertical-lr.ts:52)
- tsc frontend: 0 错
- 9 e2e 套件 PASS (DTH_BASE=127.0.0.1:30051):
  - chg_0002 (16) + chg_0005 (27) + chg_0006 (17) + chg_0007 (33)
  - chg_0008 (15) + chg_0009 (27) + chg_0010 (37) + chg_0011 (24)
  - chg_0012 (45 sub-assertion / 10 case)
- 报告落 /tmp/chg_0012-qa.log

5 回归 + 1 新 = 6 套(brief 要求):chg_0006 + chg_0008 + chg_0009 + chg_0010 + chg_0011 + chg_0012 ✓
加固跑了 chg_0002 / chg_0005 / chg_0007 也全 PASS — chg_0012 改动未触及 19 算子/auth/books/shop
Co-Authored-By: Claude <[email protected]>
2026-09-29 16:18:36 +08:00

4.0 KiB
Raw Blame History

Spec: lms_v2

Requirement

THE SYSTEM SHALL provide a multi-scene LMS v2 platform where each course is an ordered scene sequence of 4 types (slide / quiz / simulation / pbl), with append-only progress tracking and a built-in FRC 6-scene template that maps chg_0010's 6-step federated risk control flow into embeddable iframe scenes, so that 业务方能把"算子协同 + 教学编排"封装成可复用课程 WITHOUT introducing new operators / endpoints / dependencies.

ADDED Scenarios

S1 LMS v1 数据模型基础

  • WHEN admin GET /api/ssw/dth/lms/students
  • THEN 响应 data 数组长度 ≥ 2,含固定 seed UUID 11111111-1111-1111-1111-111111111111
  • AND schema 含 id / student_no / name / email / created_at
  • AND admin GET /api/ssw/dth/lms/courses 同样 ≥ 2 + schema 含 code / credits / instructor

S2 多场景数据模型 v2

  • WHEN admin GET /api/ssw/dth/lms-v2/courses/:id/scenes
  • THEN 响应 code = 200(lms_course_scene 表存在)
  • AND admin POST /lms-v2/courses with scene_type="video" → 422 INVALID_SCENE_TYPE(CHECK 约束拒绝)

S3 创建多场景课程

  • WHEN admin POST /lms-v2/courses with code + name + scenes[{slide,quiz}]
  • THEN 回 200 + course + 2 scenes(按 order_index 升序)
  • AND 重复 code → 409 DUPLICATE_COURSE_CODE
  • AND admin POST /lms-v2/courses/from-frc-template → 回 200 + course + 6 simulation scenes

S4 选课 + 进度 append-only 幂等

  • WHEN admin POST /lms/courses/:courseId/enroll with student_id
  • THEN 回 200,lms_enrollment 记录建立(progress_scene_ids = [])
  • AND POST /lms-v2/scenes/:sceneId/complete with student_id + course_id → progress_count = 1
  • AND 再次 complete 同一 scene → progress_count 仍 = 1(append-only 幂等)
  • AND complete 不同 scene → progress_count = 2

S5 SlideScene Markdown 渲染(MiniMD 5 节点)

  • WHEN slide payload 含 markdown:# Title\n## Sub\n- a\n- b\nnormal\n\``\ncode\n```\nillegal`
  • THEN GET /lms-v2/courses/:courseId/scenes/:sceneId/render 返回 html: <h1>Title</h1><h2>Sub</h2><ul><li>a</li><li>b</li></ul><p>normal</p><pre><code>code</code></pre><p>illegal</p>
  • AND "illegal" 节点作为 <p> 原样保留(非 5 类节点不抛错、不删字符)

S6 QuizScene 判分

  • WHEN quiz 含 choice 题(answer="2")+ short 题(keywords=["私有不泄露","交集"])
  • THEN grade(answers={q1:"2"}) → score=1.0(choice 全对)
  • AND grade(answers={q1:"1"}) → score=0.0(choice 全错)
  • AND grade(answers={qs1:"PSI 求交集"}) → score=1.0(1/2 关键词命中 = 50% ≥ 满分)
  • AND grade(answers={qs1:"完全不相关"}) → score=0.0(0 关键词命中)

S7 SimScene iframe + embed_url 校验

  • WHEN admin POST /lms-v2/courses with simulation scene + embed_url="https://example.com/embed"
  • THEN 回 200
  • AND GET /render → 回 embed_url 字段 = "https://example.com/embed"
  • AND admin POST with embed_url="javascript:alert(1)" → 400 INVALID_EMBED_URL(非 http(s):// 前缀)

S8 FRC 6-scene 模板(严格对位 chg_0010 S1-S6)

  • WHEN admin POST /lms-v2/courses/from-frc-template with course_code + teacher
  • THEN 创建 1 门课程 + 6 simulation scenes
  • AND order_index 严格 = 1,2,3,4,5,6
  • AND 6 embed_url 严格对位:
    • s1: did-tds
    • s2: psi
    • s3: paillier
    • s4: threshold
    • s5: abac
    • s6: audit

S9 E2E 完整流程

  • WHEN admin login → from-frc-template → student login → enroll → 6 render + 6 complete
  • THEN 每个 scene 的 complete 回 200
  • AND 最终 progress_count = 6 / 6 = 1.0

S10 PBL 占位一致性

  • WHEN admin POST /lms-v2/courses with scene_type="pbl"
  • THEN GET /render 回 code=501 NOT_IMPLEMENTED + msg="PBL 场景 v2 实现,当前仅作课程占位"
  • AND 前端 PBLScene.tsx 占位文案 "PBL 场景 v2 实现,当前仅作课程占位" 与后端 501 文案字面一致