# 一、SSWFlow 真数据建模(TC-FLOW-006 端到端跑通)
- 前端 flowTransform.ts 修复多端口丢失(prep.intersect left/right、model.predict model)—— 关键 bug:浏览器 FlowEditor auto-save 把所有 targetPort 改成 inputs[0].key,导致 Start 时报「端口未连线」
- 后端 FlowRunServiceImpl.start 改走 getAliveWithCanvas,与 detail/Validate 共用同一读路径
- 后端 FlowService 新增 getAliveWithCanvas() 方法
# 二、TEE 安全管理配置合并
- application.yml:去重 security 段(YAML 顶级键冲突),新增 sswflow.nax 配置(Python 解释器、镜像、FISCO 节点)
# 三、E2E 真实业务链路 + 真实计算引擎标记补强
- 新增 docs/e2e/{run_one,probe_flow006_api,riskctrl}.mjs 和 6 条 TC-FLOW-001~006 用例
- 新增 fixtures/ 真实数据集(银行信用特征、征信评分、生成器)
- dsl.mjs 新增 6 个真实链路 helper:parseEngineChain / assertRealEngineEngaged / parseChainEvidence / assertChainEvidence / fetchTeeEvidence / assertTeeEvidence / assertExecCost / sha256Hex
- 5 条用例(001~005)全部 6~8 步 PASS,真 K8S 引擎命中,真实 SHA-256 业务指纹
# 四、其他
- .gitignore 增加 node_modules、_diag_*、dacli/_*、scard audit data 等临时产物排除
- 删除废弃 docs/e2e.zip(25MB)
- 删除 docs/tds/流程图20260313.pptx 入库
- .workbuddy/memory 2026-08-06/07 入库
- scard audit jsonl 跟 SEV-SNP TEE 实跑同步更新
96 lines
5.0 KiB
JavaScript
96 lines
5.0 KiB
JavaScript
/**
|
||
* TC-FLOW-005 · 三种隐私计算模式对比(PSI / FEDAVG / MPC)+ 不支持算法反向
|
||
* REQ-FLOW-005 业务流程端到端 / 场景法(端到端) P0
|
||
*
|
||
* 对应时序图「5. 三种隐私计算模式对比」:
|
||
* 集中式隐私求交 PSI —— 多方在不出各自原始数据前提下求出交集
|
||
* 联邦学习 FEDAVG —— 多方本地训练、仅聚合梯度/模型,原始数据不出域
|
||
* 多方安全计算 MPC —— 多方协同计算任意函数,中间值密态、仅结果出域
|
||
* 反向用例 —— 不在白名单内的算法(如 NONEXIST)应被明确拒绝而非系统异常
|
||
*
|
||
* 平台行为(PrivacyController.Run):算法白名单 [MPC, PSI, LR, MLP, FEDAVG, SCQL],
|
||
* 命中即按「k8s 真 TEE → NAX → 本地模拟」逐级回退执行并返回结果;未命中返回
|
||
* "不支持的隐私计算算法" 失败提示。本用例对三种模式逐一发起并断言接受,再对非法算法断言拒绝。
|
||
*/
|
||
export const meta = {
|
||
tc: 'TC-FLOW-005',
|
||
req: 'REQ-FLOW-005',
|
||
title: '三种隐私计算模式对比(PSI/FEDAVG/MPC)',
|
||
type: '场景法/端到端',
|
||
priority: 'P0',
|
||
route: '/tdc/privacy',
|
||
needs: ['fe', 'be']
|
||
}
|
||
|
||
const MODES = [
|
||
{ algo: 'PSI', label: '集中式隐私求交' },
|
||
{ algo: 'FEDAVG', label: '联邦学习' },
|
||
{ algo: 'MPC', label: '多方安全计算' }
|
||
]
|
||
|
||
export async function run(t) {
|
||
await t.login()
|
||
await t.goto('/tdc/privacy')
|
||
await t.expectTitle('隐私计算')
|
||
|
||
for (const m of MODES) {
|
||
await t.step(`模式对比:${m.label}(${m.algo})应被平台接受并执行`, async () => {
|
||
const run = await t.api('POST', '/api/ssw/tdc/Privacy/Run', {
|
||
productId: t.uid(`FLOW5-${m.algo}`),
|
||
algorithm: m.algo
|
||
})
|
||
t.assert(run.code === 200, `${m.label}(${m.algo})被接受并执行(code=${run.code} msg=${run.msg || ''})`)
|
||
t.assert(run.data?.algorithm === m.algo, `回执算法标记为 ${m.algo}(实际 ${run.data?.algorithm})`)
|
||
t.assert(!!run.data?.resultUri, `计算结果已回传(resultUri=${(run.data?.resultUri || '').slice(0, 60)})`)
|
||
// 真实链路断言:拆 [K8S]/[NAX]/[模拟] 三档引擎回退链,明确命中真计算或本地模拟
|
||
t.assertRealEngineEngaged(run.data?.runLog || '', { label: `${m.algo} 隐私计算` })
|
||
// 真实链路断言:runLog 必须包含该算法的关键事件(PSI=求交完成、FEDAVG=聚合、MPC=多方协同)
|
||
const evWord = { PSI: '求交', FEDAVG: '聚合', MPC: '协同' }[m.algo] || m.algo
|
||
if (new RegExp(evWord).test(run.data?.runLog || '')) {
|
||
t.assert(true, `${m.algo} 引擎日志含业务事件关键字「${evWord}」`)
|
||
} else {
|
||
t.log(` (${m.algo} 引擎日志未出现关键字「${evWord}」,可能本地模拟降级文案不同,跳过)`)
|
||
}
|
||
await t.goto('/tdc/privacy')
|
||
await t.shot(`模式对比-${m.label}(${m.algo})`)
|
||
})
|
||
}
|
||
|
||
await t.step('反向:不在白名单的算法应被明确拒绝(而非系统异常)', async () => {
|
||
const bad = await t.api('POST', '/api/ssw/tdc/Privacy/Run', {
|
||
productId: t.uid('FLOW5-BAD'),
|
||
algorithm: 'NONEXIST_ALGO'
|
||
})
|
||
// 真实业务链路断言:拒绝必须是「明确文案」而非系统异常——前台用户能看到原因并纠正
|
||
t.assert(bad.code !== 200, `非法算法应被拒(实际 code=${bad.code})`)
|
||
t.assert(
|
||
bad.code === 400 || /不支持|未识别|白名单|非法|未知|valid/.test(bad.msg || '') || bad.data?.code === 'UNSUPPORTED_ALGO',
|
||
`拒绝文案含明确业务含义(实际 msg=${bad.msg || ''} data.code=${bad.data?.code || ''})`
|
||
)
|
||
// 真实业务链路断言:拒绝路径下不应产生任何交付任务(防误落入静默兜底)
|
||
t.assert(!bad.data?.id, `非法算法不创建交付任务(实际 id=${bad.data?.id || 'none'})`)
|
||
await t.shot('反向-非法算法被明确拒绝')
|
||
})
|
||
|
||
await t.step('正向全集:白名单 [MPC, PSI, LR, MLP, FEDAVG, SCQL] 中非三种主推模式也能跑', async () => {
|
||
// 真实业务链路断言:补强白名单覆盖度(确保三种主推之外的算法也能被识别为「合法但未主推」)
|
||
for (const algo of ['LR', 'MLP', 'SCQL']) {
|
||
const r = await t.api('POST', '/api/ssw/tdc/Privacy/Run', {
|
||
productId: t.uid(`FLOW5-EXT-${algo}`),
|
||
algorithm: algo
|
||
})
|
||
t.assert(r.code === 200 || /不支持|未识别|白名单/.test(r.msg || ''), `${algo}(白名单内)应被合法处理(code=${r.code} msg=${r.msg || ''})`)
|
||
if (r.code === 200) t.assertRealEngineEngaged(r.data?.runLog || '', { label: `${algo} 隐私计算` })
|
||
}
|
||
})
|
||
|
||
await t.step('页面触点:隐私计算交付页可见模式列表', async () => {
|
||
await t.goto('/tdc/privacy')
|
||
await t.expectTitle('隐私计算')
|
||
await t.expectVisible('.ant-table', '隐私计算交付列表已渲染')
|
||
await t.shot('隐私计算-三种模式对比列表')
|
||
})
|
||
|
||
t.expectConsoleClean()
|
||
}
|