Files
eip4-platform/flowable-service
zhengwr 3cf58fe72c refactor(flow): id 净化抽 BpmnIdSanitizer,补可逆 restore+碰撞消解(D7 地基)
ProcessDiagramController.sanitizeBpmnIds 的中文 id→安全 ASCII 净化逻辑抽成
BpmnIdSanitizer(sanitize 返 Result{xml,idMap} / restore 逆向还原),为 D7「发布存量
流程 key 不变」打地基。

- 双射保证:同文档两个不同中文 id hash 碰撞时基名追加 -2/-3 序号,生成 id 亦不与既有
  合法 id 冲突;非碰撞场景净化输出与旧实现逐字节一致(查看器零回归)。
- restore 前缀安全:复用 ID_ATTR 正则逐属性值精确匹配,不裸 String.replace 子串替换
  (n1 不误伤 n1x);映射外 ASCII id(设计器新增节点)原样保留。
- ProcessDiagramController.sanitizeBpmnIds 改为委托,原包级签名/行为不变。

测试:新增 BpmnIdSanitizerTest 7 例(中文全引用面 restore 逐字节还原/撞哈希 中Aa~中BB
双射/restore n1~n1x 前缀安全/合法 NCName 不改写/混合只映射中文/空 XML 防御);
既有 ProcessDiagramControllerTest 4 例零修改仍绿;flowable-service 全模块 65 测试通过。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 10:10:47 +08:00
..