Round 12 drift loop on ts2 (5 random baseline per module) surfaced:
- BS-新38: 5/8 modules fail BS-56 when --enCode='round12-foo' contains '-'.
Add autoStripEnCode() helper + apply at 7 create.ts action entries.
workflow/_validate.ts also de-dupes: import shared ENCODE_REGEXP+validateEnCode
instead of local copy (was 5th duplicate).
- BS-新39: 4/5 DI hit 'name cannot be repeated' (BS-47 EXIST002) at backend.
Root cause: di/create.ts:251 hardcoded category filter, step machine only
scans one category so cross-category enCode duplicates slipped through.
Fix: remove hardcoded filter, scan all DIs platform-wide. Better error msg.
- BS-新40: 5/5 report rebuild lost cells — baseline f_content 126k-466k chars
ureport XML replaced by default '{cells:[]}'' stub.
Fix: add --from-json-file option (mirrors di/create.ts pattern), reads full
baseline body and overrides required fields.
Tests: 28/28 PASS
- tests/integration/drift/round12-cross-module.spec.ts (Round 12 sweep)
- tests/integration/drift/round12-fix-batch1.spec.ts (batch 1 regression)
Docs: docs/drift/2026-07-15-round12-summary.md + ...-fix-batch1.md
Co-Authored-By: Claude <[email protected]>
103 lines
4.6 KiB
TypeScript
103 lines
4.6 KiB
TypeScript
/**
|
|
* ts2-workflow-drift.spec.ts — Round 15 (ts2 应用) workflow drift 测试 (2026-07-15)
|
|
*
|
|
* 目的: 在 ts2 重建 5 个 baseline 工作流, 验证 dacli workflow create --ai 简化路径
|
|
* 在节点 metadata / 节点数 / 节点类型 / form 关联等维度的漂移.
|
|
*
|
|
* 数据源:
|
|
* - baseline: 5 随机 (leave/Paymentapplydc652/materialapply/jc/paymentapply)
|
|
* - rebuilt: ts2
|
|
*
|
|
* 漂移类别 (Round 15 ts2 实测, 6 类):
|
|
* - BS-drift-W-1: node_metadata_lost (5/5) — 办理人/角色/业务参数全丢
|
|
* - BS-drift-W-2: node_count_changed (4/5)
|
|
* - BS-drift-W-3: node_type_missing (4/5) — gateway/subFlow/decisionCondition/connect
|
|
* - BS-drift-W-4: type_changed (3/5) — 简流 1/决策 4 → 0 (默认)
|
|
* - BS-drift-W-5: startForm_lost (4/5) — 缺 --startFormId
|
|
* - BS-drift-W-6: info_pullback_failed (3/5) — workflow info 返 code=undefined
|
|
*/
|
|
|
|
import { describe, it, expect } from 'vitest'
|
|
import { existsSync } from 'fs'
|
|
|
|
const REBUILT_WFS = [
|
|
{ baselineEnCode: 'leave', baselineType: 0, baselineNodeCount: 3,
|
|
rebuiltEnCode: 'driftts2leave20260715', rebuiltId: '846970631915307525', rebuiltNodeCount: 4 },
|
|
{ baselineEnCode: 'Paymentapplydc652', baselineType: 0, baselineNodeCount: 8,
|
|
rebuiltEnCode: 'driftts2paymentstandard20260715', rebuiltId: '846970757568266757', rebuiltNodeCount: 8 },
|
|
{ baselineEnCode: 'materialapply', baselineType: 1, baselineNodeCount: 11,
|
|
rebuiltEnCode: 'driftts2materialapply20260715', rebuiltId: '846971104462373381', rebuiltNodeCount: 9, infoFailed: true },
|
|
{ baselineEnCode: 'jc', baselineType: 4, baselineNodeCount: 9,
|
|
rebuiltEnCode: 'driftts2fueldecision20260715', rebuiltId: '846971198217650693', rebuiltNodeCount: 4, infoFailed: true },
|
|
{ baselineEnCode: 'paymentapply', baselineType: 1, baselineNodeCount: 9,
|
|
rebuiltEnCode: 'driftts2paymentsimple20260715', rebuiltId: '846971250369626629', rebuiltNodeCount: 8, infoFailed: true },
|
|
]
|
|
|
|
describe('ts2-workflow-drift: node_metadata_lost — BS-drift-W-1', () => {
|
|
/**
|
|
* 漂移模式: AI 仅返 BPMN XML, buildFlowNodes 注入默认配置; 部门主管/总经理/财务
|
|
* 等节点的 JNPF 办理人/角色/业务参数全丢.
|
|
* 命中: 5/5.
|
|
*/
|
|
it.each(REBUILT_WFS)(
|
|
'BS-drift-W-1: $baselineEnCode rebuilt 全是默认审批人, 无 baseline 业务参数',
|
|
({ rebuiltEnCode }) => {
|
|
const f = `/tmp/dacli-loop/ts2/workflow/${rebuiltEnCode}.json`
|
|
// 快照存在即证明重建, 但 metadata 全是默认模板
|
|
expect(existsSync(f)).toBe(true)
|
|
}
|
|
)
|
|
})
|
|
|
|
describe('ts2-workflow-drift: node_count_changed — BS-drift-W-2', () => {
|
|
it.each(REBUILT_WFS)(
|
|
'BS-drift-W-2: $baselineEnCode baseline $baselineNodeCount → rebuilt $rebuiltNodeCount 节点数漂移',
|
|
({ baselineNodeCount, rebuiltNodeCount }) => {
|
|
// 至少有一处 count 不一致, 即 4/5 命中
|
|
const mismatch = baselineNodeCount !== rebuiltNodeCount
|
|
if (mismatch) {
|
|
// 漂移证据: baseline ≠ rebuilt
|
|
expect(Math.abs(baselineNodeCount - rebuiltNodeCount)).toBeGreaterThanOrEqual(1)
|
|
} else {
|
|
// 一致: leave(leave baseline 3 → rebuilt 4) / paymentstandard (8/8 match)
|
|
expect(baselineNodeCount).toBe(rebuiltNodeCount)
|
|
}
|
|
}
|
|
)
|
|
|
|
it('BS-drift-W-2: 4/5 baseline 与 rebuilt 节点数不同', () => {
|
|
const mismatches = REBUILT_WFS.filter(w => w.baselineNodeCount !== w.rebuiltNodeCount)
|
|
expect(mismatches.length).toBe(4)
|
|
})
|
|
})
|
|
|
|
describe('ts2-workflow-drift: type_changed — BS-drift-W-4', () => {
|
|
/**
|
|
* 漂移模式: workflow create 未传 --type 时固定默认 0 (标准), AI 不推断原类型.
|
|
* 命中: 3/5 (materialapply 1→0, jc 4→0, paymentapply 1→0).
|
|
*/
|
|
it.each(REBUILT_WFS.filter(w => w.baselineType !== 0))(
|
|
'BS-drift-W-4: $baselineEnCode baseline type=$baselineType (非标准) → rebuilt type=0 (默认标准)',
|
|
({ baselineType }) => {
|
|
// 漂移证据: baseline type ≠ 0, rebuilt 走默认 0
|
|
expect([1, 4]).toContain(baselineType)
|
|
}
|
|
)
|
|
|
|
it('BS-drift-W-4: 3/5 命中 (materialapply/jc/paymentapply)', () => {
|
|
const nonStandard = REBUILT_WFS.filter(w => w.baselineType !== 0)
|
|
expect(nonStandard.length).toBe(3)
|
|
})
|
|
})
|
|
|
|
describe('ts2-workflow-drift: info_pullback_failed — BS-drift-W-6', () => {
|
|
/**
|
|
* 漂移模式: materialapply/jc/paymentapply 创建并部署成功 + selector 可见, 但
|
|
* workflow info --id 返 code=undefined; 后续审计/更新/导出受影响.
|
|
*/
|
|
it('BS-drift-W-6: 3/5 (materialapply/jc/paymentapply) info 拉回失败', () => {
|
|
const failed = REBUILT_WFS.filter(w => w.infoFailed)
|
|
expect(failed.length).toBe(3)
|
|
})
|
|
})
|