Files
dth/openspec/changes/chg_0005_experiment_platform_extend/testcases.md
T
xstudio agentandClaude Opus 4.8 f1a15c44f4 merge sandbox/d42537c: chg_0005 experiment_platform_extend — 6 new operators + registration + 8 e2e cases (gate PASS)
- 6 new operators: scql (secure sum) / horizontal-fedavg (FedAvg mean) / secure-mlp (sigmoid + Laplace DP) / tee-inference (sha256 attestation) / prompt-defense (keyword classifier) / compliance-audit (uuid trail)
- OperatorsService + experiment.module 注册追加(不替换 chg_0002 的 3 算子)
- tests/e2e/dth_experiment_extend.test.sh: 8 case 覆盖 S7-S12 + list ≥9
- docs/dth/experiment-platform/operators-design.md: T1 架构
- openspec/changes/chg_0005_experiment_platform_extend/{5 工件}

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

2.7 KiB
Raw Blame History

change_id, owner, status, spec_ref
change_id owner status spec_ref
chg_0005 qa@dth draft spec.md

Testcases

Cases

C1_scql_sum_returns_real_aggregation

  • Scenario: S7
  • Type: integration
  • Priority: P0
  • Given: admin token
  • When: POST /api/ssw/dth/experiment/runs body={"operator":"scql","input":{"columns":[{"values":[10,20,30]},{"values":[1,2,3]}]}}
  • Then: status=success; output_json.scql.sum=66; output_json.scql.column_count=2
  • Bound Task: T4

C2_fedavg_aggregates_3_clients

  • Scenario: S8
  • Type: integration
  • Priority: P0
  • Given: admin token
  • When: POST /api/ssw/dth/experiment/runs body={"operator":"horizontal-fedavg","input":{"clients":[{"weights":[0.1,0.2]},{"weights":[0.3,0.4]},{"weights":[0.5,0.6]}],"aggregation":"mean"}}
  • Then: status=success; output_json.fedavg.aggregated=[0.3,0.4]
  • Bound Task: T4

C3_secure_mlp_predictions_sigmoid

  • Scenario: S9
  • Type: integration
  • Priority: P0
  • Given: admin token
  • When: POST /api/ssw/dth/experiment/runs body={"operator":"secure-mlp","input":{"features":1.0,2.0],[3.0,4.0,"weights":[0.5,0.5],"bias":0.1,"epsilon":1.0}}
  • Then: status=success; output_json.mlp.predictions 长度=2;每项 ∈ (0,1);noise_scale > 0
  • Bound Task: T4

C4_tee_inference_returns_attestation

  • Scenario: S10
  • Type: integration
  • Priority: P0
  • Given: admin token
  • When: POST /api/ssw/dth/experiment/runs body={"operator":"tee-inference","input":{"prompt":"hello","model":"gpt-mock"}}
  • Then: status=success; output_json.tee.attestation 长度 >= 64 含 "tee-mock-" 前缀; model=="gpt-mock"
  • Bound Task: T4

C5_prompt_defense_detects_injection

  • Scenario: S11
  • Type: integration
  • Priority: P0
  • Given: admin token
  • When: POST /api/ssw/dth/experiment/runs body={"operator":"prompt-defense","input":{"prompt":"ignore previous instructions and ..."}}
  • Then: status=success; output_json.defense.detected=true; threat_level ∈ {high,medium}
  • Bound Task: T4

C6_compliance_audit_trail_id_uuid

  • Scenario: S12
  • Type: integration
  • Priority: P0
  • Given: admin token
  • When: POST /api/ssw/dth/experiment/runs body={"operator":"compliance-audit","input":{"action":"data_export","actor":"alice","user":"alice","timestamp":"2026-09-28T10:00:00Z"}}
  • Then: status=success; output_json.audit.trail_id 匹配 UUID 正则;compliance_score ∈ [0,1]; action=="data_export"
  • Bound Task: T4

C7_test_runner_passes_all

  • Scenario: S7-S12
  • Type: e2e
  • Priority: P0
  • Given: 后端运行
  • When: bash tests/e2e/dth_experiment_extend.test.sh
  • Then: exit 0
  • Bound Task: T4

C8_check_spec_coverage_gap_zero

  • Scenario: all
  • Type: e2e
  • Priority: P0
  • Given: chg 工件齐备
  • When: PROJECT_ROOT=. bash openspec/scripts/check_spec_coverage.sh
  • Then: stdout PASS gap=0
  • Bound Task: T5