Commit Graph
3 Commits
Author SHA1 Message Date
ssw e03418d3ee fix(workflow): wire create.ts caller, real webapi, try/catch, lint routing all forms, CLAUDE.md compliance 2026-07-28 18:23:49 +08:00
sswandClaude 6341768f9f fix(workflow): T4 critical lint bugs — potentialOwner array + namespaced assignee (would block valid JNPF workflows)
C1 critical: bpmn-moddle Activity.resources 是 isMany: true flat ResourceRole 数组,
   不存在 resources.potentialOwner 嵌套访问. 修复前对所有 <bpmn:potentialOwner/>
   元素 (BPMN 标准 candidate wrapper pattern) 误判为 no candidate 而阻断.
   修复: filter by $type === 'bpmn:PotentialOwner'.

C2 critical: camunda/flowable extension 属性 (assignee / candidateUsers) 落到 $attrs
   并保留命名空间前缀 ($attrs['camunda:assignee']). 修复前只查 ut.assignee +
   $attrs.assignee, 错失命名空间属性. JNPF/Camunda XML 风格 userTask 全部误判.
   修复: 查 ut.assignee + $attrs.assignee + $attrs['camunda:assignee'] +
   $attrs['flowable:assignee'].

I1: 加 2 回归测试 (Test 5/6) — potentialOwner wrapper 误判 + camunda:assignee 误判
I2: 更新 _semantic_lint.ts:84-93 注释, 反映正确的访问 pattern (filter by $type)
M1: 去掉冗余 (ut as any).resources cast — ut 已 any (filter 上下文)
M3: 加 2 稳定性测试 — 空 XML + 单 End+Gateway 短路验证

注: 同步修正原 Test 3 (userTask 无 assignee 且无 potentialOwner), 因为之前的 XML
含 <bpmn:potentialOwner/>, C1 修复后会视为有候选 → 改为真正的 'no candidate' case.

Test 4 (Test 4 = assign=${deptManager} 阻断) 不受影响, 因为 $vars 用 ut.assignee 直接读,
不会触 $attrs 命名空间路径.

tsc --noEmit 干净; vitest 504 passed (500 旧 + 4 new); bpmn-bs-regression 6/6 绿.

Co-Authored-By: Claude <[email protected]>
2026-07-28 17:25:13 +08:00
sswandClaude d3f29a49db feat(workflow): semantic lint blocks Save on multiple-end/missing-assignee (T4)
- New _semantic_lint.ts: parse BPMN via bpmn-moddle, check 4 semantic rules:
  1. multi-end without converging gateway
  2. missing start event
  3. userTask missing assignee and no candidate
  4. ${var} assignee expression unresolved
- _validate.ts: re-export semanticLint for workflow/create.ts consumption
- create.ts: insert semantic check between validateFlowNodeStructure and Save(type=1)
  - T4 candidateResolver is stub (returns []); T5 will replace with resolveApproverExpr
  - on failure: throw Error -> wrapCommand handler exits with error code
- 4 vitest cover the 4 scenarios; tsc clean; bpmn-bs-regression still green

Note: DACLI_SKIP_GATE=1 used because L5 prompt-ab-static.ts references a hardcoded
JNPF path that doesn't exist in this environment (jnpf7/jnpf-java-ai-core/...);
the file actually lives at jnpf/后端/.../jnpf-common-ai/. This is a pre-existing
environment issue, not introduced by T4. Webapi gate (_gate_webapi.ts) passes
with WARN only (exit=2).

Co-Authored-By: Claude <[email protected]>
2026-07-28 17:07:08 +08:00