Commit Graph
134 Commits
Author SHA1 Message Date
sswandClaude 2d499fa19a feat(dacli): form update --ai schema-aware 增量加字段
v0.23+ 扩展 form update (无新命令, 避免 25→26 个命令的记忆负担), 复用既有 PUT
+ merge + dirty check + strict relationForm 校验 流程, 仅注入 LLM 推理环节:

- _ai.ts: 新增 inferAddFields() + FORM_COMPONENT_WHITELIST (23 项镜像 JNPF7
  AiConstants.GEN_MODEL_COMPNENT) + extractJsonArray() (JSON fence 容错)
- update.ts: --ai <desc> 拉现有 schema → LLM 仅生成新字段 (强相关上下文)
                  → 服务端 4 重安全网 (vmodel 命名/重名/jnpfKey 白名单/label 重名)
                  → 注入 opts.fields, 走既有 mergeFormFieldUpdates
- 链 P0-2 (--optimize) + P0-6 (--preview) + P0-7 (Login expired fallback) 复用
- 兜底设计修正 (用户反馈 2026-07-27): 短描述 (<10字符) 拒绝走 LLM
- 友好区分 0-字段错误: "全被剔除" vs "LLM 没生成" 两种语义

实测 (testspace): form p06s09 1→4 字段 (f_source/f_reporter_phone/f_urgency_level
LLM 生成 snake_case+select+必填); 重提相同描述 → LLM 识别重复返 0 → 友好报错。

新增 5 个 vitest 覆盖 JSON fence 容错; quality-gate: tsc 0 · vitest 488 · baseline L1-L5。

Co-Authored-By: Claude <[email protected]>
2026-07-27 16:55:39 +08:00
ssw 206f1fd86c auto(14b5ea1b9bd9): session end @ 2026-07-27T16:31:03 (+4f) 2026-07-27 16:31:03 +08:00
sswandClaude 3f1cb3a03b feat(dacli): JNPF7 验证闭环 Stage 0 + P0-6 preview + workflow canvas 回归修复
Stage 0 (验证基础设施):
- 5 层验证工具链 (tools/) + JSON Schema + validate-baseline.sh CI gate
- P0-9: components-whitelist.yaml 单一来源 + parseFlowXml 消漂移 (create.ts tag 改消费 component-map.json)
- E-2: docs/components.md 文档化 6 个 pass-through 组件
- P1-16: validate-baseline 接入 quality-gate.sh
- L3 回归测试 (bs117 / bpmn-bs / antipattern-output) + mock LLM 库

P0-6 (user-in-the-loop):
- form create --ai --preview: 提交前渲染字段表格 (CJK 对齐) + TTY 交互确认 (_preview.ts)

workflow canvas 回归修复 (v0.22+ SSW 迁移引入):
- parseFlowXml 命名空间无关 (flowNodes 缺口)
- _autoLayout 无 DI 时合成完整 BPMNDiagram+Shape+Edge + bpmn2 归一化 (canvas 缺口)
- 真实后端 + 浏览器设计器验证画布渲染; 详见 jnpf7-analysis §14

quality-gate 全绿: tsc 0 · vitest 483 · doc:check · baseline L1-L5

Co-Authored-By: Claude <[email protected]>
2026-07-27 12:49:44 +08:00
ssw f0a3179ace auto(14b5ea1b9bd9): session end @ 2026-07-27T10:43:30 (+2f) 2026-07-27 10:43:30 +08:00
ssw e2a8369490 v0.22+ (2026-07-25) P1-5 + BS-新43 闭环 + NCPF 全面清理
[pre-existing vitest failures: 5 drift 检测 (BS-drift-F-5), 与本会话改动无关, 不阻塞提交]

形式:
- 9 个修复 (P0-1/2/3, P1-4/6/7/5, P2-8/9)
- 整合 NCPF 时代 band-aid: callNcpfBackendWithRetry / callSswAiRepair / callSswAiWorkflowRepair
- NCPF 引用 53 → 0 (仅 README 1 行历史叫法)
- form/workflow --ai 单一 SSW 路径 (callSswBuildForm + callSswBuildWorkflow)
- 删 dead code -226 行

新增 (10 untracked):
- tests/unit/ai_ssw_build_form.test.ts (4 测试)
- tests/unit/output_filter_stderr.test.ts
- tests/unit/relationform_auto_tdd3.test.ts
- tests/unit/role_assign_p0_1.test.ts
- tests/unit/role_list_null_data.test.ts
- tests/unit/test_browser_appcode_default.test.ts
- tests/unit/user_create_password.test.ts
- src/commands/form/_relationform_completeness.ts
- docs/decisions/0017-tdd2-end-to-end-findings.md
- docs/dacli-hardening-2026-07-25-tdd2.md

修改:
- src/commands/form/_ai.ts (-226 行 dead code, +180 行简化)
- src/commands/form/create.ts (12 处 NCPF 描述清理)
- src/commands/_post_reminders.ts / _ssw_retry.ts (1-2 处 NCPF 清理)
- src/commands/app/status.ts (3 处 NCPF 清理)
- src/commands/form/{_form_repair,_validate,_smart_props}.ts (各 1-2 处清理)
- README.md 5 大铁律 §2 + 架构核心 + 高频命令 + 命名规范 4 处描述更新
- docs/尚数网基本开发规范v3.0.md (1 处 NCPF 清理)
2026-07-26 10:04:16 +08:00
ssw 0b14466681 fix(dacli): 5 项 tdd8 smoke test 命中修复 — relationForm 4 字段闭环
#1 新增 dacli form relation-form-complete 命令
  - 自动补 relationForm 4 字段 (jnpfKey/modelId/propsValue/relationField)
  - propsValue 从 target 表 f_*_name 字段自动推
  - relationField 默认 = source FK 字段自身
  - --dry-run 模式只推导不写
  - 19 个单测覆盖 (isRelationFormComplete/pickDisplayField/deriveCompletion)

#2 form update --fields 加 --strict 校验 (默认 ON)
  - relationForm 4 字段缺任一 → ctx.fail + 提示用 relation-form-complete 自动补
  - --no-strict 兼容老用法
  - 7 个单测覆盖 (validateRelationFormFields)

#4 --json 模式 log.* 走 stderr
  - log.ts 加 setJsonMode()/isJsonMode()
  - info/ok/warn/dim/raw 在 jsonMode 时走 stderr
  - setupOutputFilter 自动联动
  - 修 menu/info.ts 启用 setupOutputFilter (之前直接 log.* 污染 stdout)
  - 修 4 个测试 mock 补 setJsonMode + isJsonMode

#6 menu info 加 formEnCode 反查
  - 从 propertyJson.moduleId → form list 反查
  - 输出 relatedForms[] 含 formEnCode/formId/fullName
  - 解决 form enCode 与 menu enCode hash 后缀不一致问题

#8 TC-A 报告 PASS 显式标 SKIP/FAIL 区分
  - '通过: 4/5 (4 PASS + 0 FAIL + 1 SKIP)' 而非仅 '4/5'

实测 tdd8 (本轮 smoke test) 43/46 → 应能提升 (TC-C relationForm FAIL 修复)

质量门 (scripts/quality-gate.sh):
  [1/4] tsc --noEmit: 0 错误
  [2/4] vitest run tests/unit: 415 passed (含 26 个新测)
  [3/4] doc:check: 0 drift (272 文件扫过)
  [4/4] backend smoke: dacli form list PASS
2026-07-24 22:29:54 +08:00
ssw cf4af60806 feat(dacli): Tier 1 跟进 4 项 — 容错/dbPing/menuIntegrity --fix/reuse wrapper
回应用户"都去完善" — 落地 4 项 tdd8 smoke test 暴露的痛点:

[1/4] non-JSON 容错 (src/core/client.ts)
  - 修 schedule list / monitor flow 等命令报"unexpected response shape"崩
  - parseJson(): HTTP 2xx + 空 body → 返 envelope-style {code:200, data:null} (JNPF 端点 bug 已知)
  - HTTP 2xx + 非 JSON body → graceful degrade 同上, 不 throw
  - 实战: schedule list 之前 100% 崩, 现在返 200 + 空 data (语义清晰)

[2/4] dbPing 真实实现 (src/commands/app/status.ts)
  - 替换 /system/DataSource/TestConnection (404) → /system/DataModel/{dbLinkId}/Tables
  - 端点真实, dm list 端点, 走通即 DB 连得上
  - 4xx/5xx 都报真错误, 不再 skip
  - 实战: dbPing 75ms 真检查 (之前永远 skip, 防不住 BS-E14)

[3/4] menuIntegrity --fix 跟进 (src/commands/app/status.ts)
  - 新选项: --fix-menu-url 自动重建空 urlAddress 菜单
  - 策略: 拉 form list → enCode 匹配 → PUT /system/Menu/{id} urlAddress=model/{enCode}
  - 非 form 菜单 (enCode 不在 formList) → skip + log "需手填"
  - tdd8 实测: 4 项空 urlAddress 可自动修 (需你确认执行)
  - DacliHelp 同步更新 notes

[4/4] --reuse-if-exists 通用化 (src/commands/_reusable_create.ts)
  - 新增通用 wrapper: reusableCreate({cmdName, enCode, findExisting, runCreate})
  - form/dict/menu create 全部接入 (各 ~20 行)
  - 6 个新单元测试 (复用场景, 异常容错, 空 enCode 等)
  - 4 个命令统一 shape: ctx.success({enCode, id, fullName, state, reused: true, mode: 'reuse-if-exists'})
  - dm/workflow 跳过 (enCode 概念不直接适用, tableName/flowId 走不同路径)

验证:
- typecheck 0 errors
- vitest 39 文件 / 389 tests pass (含 6 个新 reusable_create 测试)
- doc:check 0 drift (扫描 271 文件)
- quality gate 4/4 (tsc + vitest + doc:check + smoke)

意外: dict/typecreate.ts 文件在 case-insensitive fs 上 cp 时被误删, git restore 恢复 — 提醒后续 case-sensitivity 风险
2026-07-24 19:53:27 +08:00
ssw 87a246ed9e feat(dacli): Tier 1 固化 3 项 — hook + idempotent + health check
回应用户"还有哪些要 dacli 固化的" — 落地 Tier 1 全部 3 件:

[1/3] Pre-commit hook 加 doc:check (scripts/quality-gate.sh)
  - 质量门从 [1/3] tsc + [2/3] vitest + [3/3] smoke → [1/4]+[2/4]+[3/4]+[4/4]
  - 新 [3/4] doc:check (npx tsx scripts/check-doc-drift.ts) — 防回归
  - 任何 doc drift 立即阻断 commit (呼应 audit 2026-07-24 §6 治本建议)
  - DACLI_SKIP_GATE=1 紧急绕过 (与现有 tsc/vitest 一致)
  - 注释同步更新 pre-commit (scripts/githooks/pre-commit)

[2/3] form create --reuse-if-exists (src/commands/form/create.ts)
  - 防 BS-新131 AI agent 反复跑场景返工
  - 命中已存在 enCode → 跳过创建, 返回现有 id + state (state=0/1 都支持)
  - 抽 findExistingForm() 纯函数 + 6 个单元测试 (exact match, 不 fuzzy)
  - 新选项: --reuse-if-exists (默认 false, 向后兼容)

[3/3] app status 加 3 项深度健康检查 (src/commands/app/status.ts)
  - dbPing: GET /system/DataSource/{dbLinkId}/Actions/TestConnection (防 BS-E14)
    · 404/405 视为 skip (端点可能未暴露, 不阻断)
    · dbLinkId=0 视为 skip (主库, 不需测试)
  - llmPing: GET /visualdev/ai/health (防 --ai 路径 LLM 挂掉)
    · 404 视为 skip (端点可能未部署 health)
  - menuIntegrity: /oauth/CurrentUser menuList.urlAddress 不空 (防 BS-56 SPA 404)
    · 任意 fail → 退出码 1 (AI agent 应停下修复)
  - 人类可读模式 + --json 模式都展示 deepChecks 数组
  - 实战验证: tdd8 跑出 menuIntegrity 真问题 (4 项 menu urlAddress 空)

验证:
- typecheck 0 errors
- vitest 39 文件 / 393 tests pass (含 6 新 reuse-if-exists 测试)
- doc:check 0 drift
- 实战: dacli app status 跑出 3 项深度检查 + 1 个真 backend finding

测试未跑 (需要 live JNPF):
- form create --reuse-if-exists 端到端 (受 auto-classifier 误判限制)
2026-07-24 18:26:45 +08:00
sswandClaude 891a600245 test(guards): P2.5 — verify guards effective, reconcile stale test, un-quarantine
Verified (evidence, not guess): the guards ARE effective — command-scoped by design,
wired into form/create, form/release, dm/create, menu/create; BS-47/BS-50 fire
correctly when called with their command (as all production callers + verify_option.test.ts do).
The 12 failures were a STALE test, not broken guards:
- 8 'should-trigger' used pre-command-scoping calls → added command args (BS-47 'dict typeCreate', BS-50 'menu create')
- BS-15b / BS-28 / BS-32b: guards removed from registry long ago → dropped stale assertions
- BS-5: real check is ctx===null (not 'empty existingEnCodes') → fixed test
- BS-51 WARN / BS-44 INFO / BS-60 ERROR: test asserted wrong levels → fixed
- BS-60 repurposed (invalid jnpfKey / placeholder columnOptions, not missing vmodel) → fixed trigger
Impl: fixed objective dup-id bug — renamed 2nd 'BS-14' (type=4 view-release WARN) → 'BS-14b'.
Un-quarantined: removed --exclude from scripts/quality-gate.sh.

Verified: full gate green WITH blindspot_guards (tsc 0 + all unit incl. 41/41 guards + smoke).

Co-Authored-By: Claude <[email protected]>
2026-07-24 13:45:48 +08:00
sswandClaude fc16d93114 test(fixtures): restore tests/fixtures/plan.md (deleted in d982753, tests still ref it)
doc-md-slice.test.ts reads this fixture; cleanup commit removed the file but
left 7 tests referencing it → they fell back to placeholder and failed.
Restored from d982753^. doc-md-slice now 14/14 green. Honest fix (test always
needed this asset), not fake-green.

Co-Authored-By: Claude <[email protected]>
2026-07-24 09:50:39 +08:00
sswandClaude 6210a273c6 fix(tests): P2 — test tsc errors 18→0 (tsc now fully 0/51)
- 4 AppContext fixtures (blindspot_guards/bs54_guard/dbLinkId/verify_option):
  add topLevelMenus:[] + currentSystemId:'' (fields added in BS-109, fixtures drifted)
- CreateOpts: add internal __aiBuildFormData?:{formData} hook (was (opts as any));
  fixes 3 form_create_smartprops_ai.test.ts errors
- e2e/_helpers/nav.ts: /// <reference lib=dom /> for page.evaluate browser context
  (resolves document/HTMLElement + item/e unknown)
- bs66-70 test: type formVm as Set<string>
- auto_fix.test: gX1!.candidates!  ; defhttp test: HeadersInit → Record<string,string>
- output_filter.test: cast stdout spy to declared MockInstance type

Verified: tsc 0 errors; vitest unit 361 pass / 19 fail == pre-existing
(blindspot_guards registry drift + doc-md-slice fixture, audit §12.2) — no regression.

Co-Authored-By: Claude <[email protected]>
2026-07-24 09:47:46 +08:00
ssw 51ffaf00ba feat(dacli): hard-bind form smartProps, DI list enCode, codegen sub-table searchList, form info --bindings, test run dictionary mapping
- form create: extract applyFinalSmartProps/shouldRunFinalSmartProps so
  --ai-only paths also re-run smart props after the final buildFormData.
  Adds unit test for the gate predicate.
- form update: mergeFormFieldUpdates deep-merges __config__ and matches
  vmodel/__vModel__, preventing schema loss on partial diffs.
- form info: new --bindings projection flattens field configs to
  {field, jnpfKey, dataType, dictionaryType, modelId, required} for
  callers without jq piercing the JNPF nested formData JSON.
- form codegen: normalizeCodegenSearchList now walks children/tableList
  payloads; new _codegen_schema helper repairs searchList id/prop across
  nested scopes, avoiding SearchTypeModel.id NPE in JNPF CodeGenerateFactoryV3.
- di list: enrichDataInterfaceListWithEnCode backfills the enCode field
  selector omits; walks every category folder so callers can filter on
  enCode reliably.
- test run: pickChoiceValue routes select/radio/checkbox through
  loadDict.getDictionaryDataSelector (cached) before falling back to
  options[0].value, removing the brittle dependency on option order.

Tests: 56/56 PASS across 9 unit specs.
2026-07-23 13:59:11 +08:00
ssw ff259efdd5 auto(14b5ea1b9bd9): session end @ 2026-07-23T13:28:26 (+5f) 2026-07-23 13:28:27 +08:00
sswandClaude fa605579f3 test: cover eventhub blocker fixes
Co-Authored-By: Claude <[email protected]>
2026-07-22 16:51:06 +08:00
ssw a756b009a8 auto(14b5ea1b9bd9): session end @ 2026-07-22T16:46:31 (+7f) 2026-07-22 16:46:32 +08:00
ssw 8efb4a55e0 feat(dacli): form/update.ts 完整 wrapCommand 迁移 + _dirty_check 改 throw + test 更新
form/update.ts (5 处 process.exit → ctx.fail):
- releaseOnly 模式 后端 code !== 200
- BS-49 enCode 冲突
- --fields JSON 解析失败
- --fields 不是非空数组
- PUT 后端 code !== 200 (含 enhanceFromBackend 错误增强)

关联改动:
1. src/commands/_dirty_check.ts: dirtyCheckFailAndExit 改 throw DirtyCheckError
   (替代原 process.exit(2), 让 wrapCommand handler catch → ctx.fail)
   新增 DirtyCheckError 类 (entityType/entityId/errorCount 字段供 handler 区分)
2. tests/unit/report_wired.test.ts: 更新 report/create.ts 契约 (3 处断言)
   - printCommandEnd 6+ → wrapCommand + ctx.fail 5+
   - 成功路径 printCommandEnd success → ctx.success
   - 删 printCommandEnd 直接 import 断言 (wrapCommand 内部已包)

form/update 整合 DirtyCheckError 实例化:
  try { dirtyCheckFailAndExit(...) }
  catch (e) {
    if (e instanceof DirtyCheckError) return ctx.fail(e.message, { id, errorCount })
    throw e
  }

修改方式: Write 整文件重写.

验证:
  - TS compile 0 新错误 (baseline 57 不变)
  - 73/73 单元测试 PASS (含 test 更新)
  - workflow/update.ts 也用 dirtyCheckFailAndExit, 仍兼容 throw (下次迁 wrapCommand 时一并处理)
2026-07-21 20:16:59 +08:00
ssw a9b7dd5083 feat(dacli): P4 v2 log.printRawTable primitive + 3 文件迁移
P4 v2 (2026-07-21): 加 log.printRawTable(headers, rows, opts) 收口 350 处
console.log 表格输出散布.

API:
  log.printRawTable(
    ['ID', 'NAME', 'TYPE'],
    [['123', 'myapp', 'MySQL'], ['456', 'test', 'PG']],
    { indent: '', maxColWidth: 36 }
  )
  - 自动按列宽对齐 (max(header.length, max(cell.length)) 但不超过 maxColWidth)
  - 长字段 truncate 省略号 (… 替换最后 1 char, 总长 = maxColWidth)
  - 跳过 quiet 模式 (跟 log.raw 同, 直出 stdout)
  - 2-space 分隔符, 行末 newline

迁移 3 文件 (示范, 1-2h 后续可推广):
  - datasource/list.ts (4 列 表格)
  - dm/list.ts (2 列)
  - dm/fields.ts (5 列)

新单测 5 个 (基础/长字段 truncate/maxColWidth 自定义/quiet 模式/空 rows).
原 wrapCommand 单测 + auto_fix + report_wired 全部仍 PASS.

验证:
  - TS compile 56 baseline 不变 (含原 (s: string) => boolean pre-existing 错)
  - 22/22 output_filter 单测 PASS
  - 端到端: printRawTable primitive 独立验证输出对齐 + truncate

剩余 P4 v2 范围: 剩 ~330 处 console.log 表格输出待批量迁移, 建议下次 session
继续 (dacli 文档/迁移指南应出 'console.log → log.printRawTable 迁移对照表').
2026-07-21 18:06:36 +08:00
ssw 11f94a3dd0 feat(dacli): P6 sample 续 7 文件 → wrapCommand + 测试同步
P6 sample 续迁移 7 文件 (累计 14 文件):
  - form/list.ts (--summary + --json + 表格 三路径)
  - report/list.ts (webapi 化 + DacliError 已有)
  - report/info.ts (同上)
  - storage/list.ts (无 appCode, wrapCommand 仍能收口 stdout 5c)
  - integration/emailtest.ts (DacliError 已有 + 新 wrapCommand)
  - integration/smstest.ts (同上)
  - integration/webhooktest.ts (DacliError 已有 + 新 wrapCommand)

P5 全量 (commit c6b7fe8):
  - portal/create.ts:76,93 (2 throws businessType 字典 + 业务分类)
  - bigscreen/construct.ts:269 (1 throw validProps empty)

测试 fix-up:
  - tests/unit/report_wired.test.ts 更新 6 个老 pattern 静态契约
  - 老 pattern (printCommandEnd + try/finally + cmdError + process.exit(1))
  - 新 pattern (wrapCommand + ctx.success/fail + no process.exit)

验证:
  - TS compile 56 baseline 不变
  - 68/68 单元测试 PASS (output_filter + auto_fix + report_wired + workflow)
  - 端到端: form list --summary / report list / storage list / workflow list 都正常
2026-07-21 18:01:00 +08:00
ssw c637a589a4 feat(dacli): wrapCommand helper 收口 5c 样板 (P0)
P0 of ADR 0015 (源码遗留清单): 39+ 命令文件散布 printCommandEnd + process.exit
样板, 5 个重复字段 (command/appCode/fixes/duration_ms/verbose+json) 在每个出错
分支都要 copy-paste + 配 process.exit(1). 加 wrapCommand helper:

  wrapCommand({command, appCode, startTime, verbose, json, fixes}, async (ctx) => {
    if (failure) ctx.fail('msg', summary)        // exit 1
    else if (partial) ctx.partial('msg', summary)
    else ctx.success(summary)
  })

替换 6 命令文件样板:
  - datasource/{create, delete, list, test}.ts
  - dict/typecreate.ts (含 partial case)
  - menu/create.ts (原本有 local printEnd, 现在切到 wrapCommand)

17 单测覆盖 (5c × 3 路径 + 必填项 + 透传参数).

后续 P1-P6 (见 ADR 0015):
  - P1: storage/info.ts + dm/drop.ts 2 小坑
  - P3: 18 个 per-module _validate.ts 改为统一 import 错误码
  - P4: addOutputOptions 迁移 38 文件 (L1 stdout 文案统一)
  - P5: console.log + throw new Error 统一收口
  - P6: 350+ 裸 process.exit 跨 session 治理 (大坑)

测试: 17/17 wrapCommand 单测 + 65/65 跨模块 + 0 新 TS 错误.
端到端: datasource list/delete/test --help + menu create --help 验证.
2026-07-21 17:04:29 +08:00
ssw a104101a8a feat(dacli): info 类接 CommandLog + README 路径速查更新 + drift 日志归档
src/commands/form/info.ts: --json 特殊语义 (BS-新1 解码 formData escaped) 用手动 .option(--verbose) 避开 addOutputOptions 重复 --json 注册
src/commands/dict/datalist.ts: try/catch/finally + CommandLog L3
src/commands/dm/{list,fields}.ts: 同模式

README.md: 路径速查表加 datasource/storage/integration/report + G-X1 workflow 扩展提示 (2026-07-21 nginx 尾 slash 调整后)

docs/drift/2026-07-20-d0720-jxcj.md: jxcj drift 日志归档
tests/unit/defhttp_shim_envelope.test.ts (新): defhttp shim envelope 单元测试
2026-07-21 13:00:16 +08:00
ssw 40e04eb4fd feat(dacli): report 三层接入 + static contract 测试
src/commands/report/{create,list,info}.ts: 4 步 pattern (imports → addOutputOptions → setupOutputFilter + runCommandAutoFix → printCommandEnd)
- report/create.ts: 删 inline autoStripEnCode (改由 runCommandAutoFix S-X1 统一)
- report/create: 5 失败 + 1 成功 printCommandEnd 调用
- report/list + info: try/catch/finally, process.exit(1) 在 finally 兜底

tests/unit/report_wired.test.ts (新): 22 个静态契约测试
- 防止未来被悄悄撤掉 3 个 helper (regression detection)
- runtime smoke: --help 注册 --verbose/--json
2026-07-21 13:00:16 +08:00
ssw 508cabface feat(dacli): v2.1+ 命令输出 + auto-fix helper (含 workflow G-X1 扩展)
src/commands/_output_filter.ts (新): 跨命令输出过滤 + CommandLog 落盘
  - setupOutputFilter: 默认 quiet, --verbose/--json 解除
  - addOutputOptions: 注册 --verbose/--json
  - printCommandEnd: 落 L3 CommandLog + 打印 L1 summary + 'dacli log last' 提示
  - 三档 result: success / partial / failure

src/commands/_auto_fix.ts (改): workflow enCode 也参与 G-X1 BS-47 重名查重
  - CommandFixContext 新增 existingWorkflows 字段
  - fetchExistingLists 加 workflows flag + GET /workflow/template 调用
  - fixUniquenessSuggest 把 workflows 加入 allExisting 冲突检查

tests/unit/output_filter.test.ts (新): 11 个 helper 单元测试

tests/unit/auto_fix.test.ts (新): 23 baseline + 3 本 session workflow G-X1 测试
2026-07-21 13:00:16 +08:00
ssw e10086fcea auto(bfc0cfa2c3a4): session end @ 2026-07-20T22:23:58 (+10f) 2026-07-20 22:23:58 +08:00
ssw ef1bb0a137 merge p1-8-browser-auto-login (2026-07-20)
合并内容:
- 27d508a BS-18 BUG 修 (modelId 用 formId 而非 enCode) + BS-新62 失败兜底 (applyHeuristicRelationForm) + form/update 物理表同步 log
- bbcdf9f M2 实战固化 (jxcj 2026-07-20)

修复 jxcj 2026-07-16 阶段 7 + 2026-07-20 实战:
- 9 张新表 relationForm 字段自动含 modelId (不靠 AI Login expired 失败的 smartProps)
- form create '✓ 物理表已建' log 透明化物理表状态
- form update '⚠ 物理表未同步' 警告 + 修复路径提示

详见 .claude/skills/dacli-ts/references/anti-patterns §15.1 §15.2 + form-physical-table-sync.md + form-create-ai-prompt-template.md

Co-Authored-By: Claude <[email protected]>

# Conflicts:
#	src/core/help.ts
#	tests/core/help.spec.ts
2026-07-20 19:37:52 +08:00
ssw d659fa2a80 feat(dacli): integrate enrichHelp into installHelpHook via installHelpHookWithPatterns 2026-07-17 11:49:25 +08:00
ssw 394b8ce867 feat(dacli): implement enrichHelp() to merge ANTI_PATTERNS into DacliHelp 2026-07-17 11:46:07 +08:00
ssw 4c114229a8 feat(dacli): populate ANTI_PATTERNS for 11 commands (25 total entries) 2026-07-17 11:43:54 +08:00
ssw a45145e5b9 feat(dacli): populate ANTI_PATTERNS['form create'] with 8 patterns 2026-07-17 11:40:40 +08:00
ssw 5d7efca370 feat(dacli): define AntiPattern interface + ANTI_PATTERNS skeleton 2026-07-17 11:36:19 +08:00
ssw 3adbd656d6 fix(dacli): restore _aiMeta side effect + Phase 1 JSDoc + outputHelp test
- installHelpHook: restore _aiMeta side effect (170 call sites depend on
  --ai-help/--example/--source flag interception, all broken at HEAD)
- installHelpHook: add empty-content guard (skip addHelpText if renderDacliHelp
  returns empty string to avoid blank trailing newline in --help)
- help.ts: restore Phase 1 architecture JSDoc (Task 1.1/1.2/1.3 + legacy compat
  notes for Task 1.6)
- tests/core/help.spec.ts: re-add outputHelp integration test (verifies
  addHelpText content actually reaches --help output, not just helpInformation)
2026-07-16 22:02:41 +08:00
ssw cc64e13d86 test(dacli): strengthen installHelpHook test with outputHelp capture 2026-07-16 21:27:25 +08:00
ssw da8c1db076 feat(dacli): add installHelpHook with backward-compat alias 2026-07-16 20:44:44 +08:00
ssw cfa3135986 feat(dacli): render pitfalls rationale + clarify purpose JSDoc 2026-07-16 17:07:46 +08:00
ssw 319221148b feat(dacli): implement renderDacliHelp with 4 new sections 2026-07-16 16:58:31 +08:00
ssw c16bd298a7 feat(dacli): extend DacliHelp with 4 fields + add tests/core to vitest include 2026-07-16 16:26:29 +08:00
Claude a767d2bea8 P1-7: form create AI Login expired 自动 fallback web buildFormData 默认空 schema
## bug (jxcj M1 复盘, 2026-07-16)
NCPF 后端 AI (POST /visualdev/ai/form) Login expired 全局阻塞, 报
  code=400 msg=组件属性推理异常: OpenAI 响应无 choices: {"msg":"Login expired, please log in again","code":600}
SSW /ssw/ai/repair 也用同 token 必 fail (5s/10s/20s 浪费).
后果: jxcj M1 11 form 全部受影响, --ai 路径 exit 2, user 必须手动 --enCode + --fullName 重跑建空表单.

## 修复 (3 文件 + 1 单测, +75/-3)
1. _ssw_retry.ts: 加 isLoginExpired() helper (与 isTokenPlanExhausted 同模式)
2. form/_ai.ts:
   - AiFormResponse 加 loginExpired?: boolean 标记
   - callAiForm: NCPF Login expired 跳过 SSW fallback, 返 loginExpired=true
   - callSswAiRepair: SSW Login expired 跳过剩余重试, 同上
3. form/create.ts: --ai 段检测 loginExpired=true → user 传了 --enCode/--fullName 走 web buildFormData 默认空 schema (0 字段, state=1 可用), 未传 exit 2 提示
4. tests/unit/p1-7-ai-login-fallback.test.ts: 12 单测覆盖 isLoginExpired + callAiForm Login expired fallback (mock JnpfClient.postJson)

## 试通命令 (testspace)
- 12 单测 PASS (含 5s 退避)
- testspace 实跑 P17v3 form 创建+发布 PASS (正常 AI 路径不破坏)
- 回归: form-drift 21 + field-builder 18 + blindspot 16 + round12/13/15/17 = 121 tests PASS, 0 regression
- TS 编译: 46 errors baseline = 46 errors after (无新增)

## 关键决策
- 跳过 SSW fallback: SSW 同 token 必 fail, retry 浪费
- fallback 走 web buildFormData 默认空 schema: Login expired 不阻断 form 创建, user 后续用 form update --fields 加字段
- user 未传 --enCode/--fullName → exit 2: AI 不可用无法自动生成 enCode, 比 silent fallback 安全
- 用 (r as any).code 局部 cast: 不修 pre-existing 'let r: AiFormResponse' 类型 bug (留给后续 cleanup PR)
- 不动 BS-新113 5s/10s/20s retry 策略: 仍适用于 429 token plan (临时限流可恢复)
2026-07-16 06:43:32 +08:00
sswandClaude 9e21fea692 feat(form): R17 P1 启发式扩展 — AI 4 限制闭环 (jxcj M1 实战驱动)
P1-1 vm-to-jnpfKey 启发式 (form/_form_repair.ts):
- 新增 VM_RULES 6 条 + mapVmToJnpfKey 函数
- 优先级: vm 启发式 > label 启发式 (客观 > 主观)
- 修 AI 控件类型错选:
  - datetime + timePicker → datePicker (jxcj f_start_time)
  - text + 富文本 label → editor (jxcj f_introduction)
  - int + dict + 状态字段 → radio (jxcj f_state)
  - int + 数字字段名 → inputNumber
  - decimal → inputNumber
  - varchar(>500) + 长文本 → textarea

P1-2 upload 控件不标 required (form/_smart_props.ts):
- 新增 SKIP_REQUIRED_JNPFKEYS 白名单 (12 jnpfKey)
- 白名单: uploadImg/uploadFile/editor/relationForm/popupTable/
  popupSelect/autoComplete/sign/rate/colorPicker/link/iframe
- 即使 label 含"必" 也不标 required (jxcj f_wechat_qrcode 修复)
- 返回值加 skipped 字段 (log 跳过计数)

P1-3 category 关键词匹配 (form/create.ts):
- autoDeriveCategoryFromBusinessType 优先用 appCode + formName 关键词
- 例: jxcj + "数据要素" / "大赛" → 找 businessType 字典匹配
- fallback: AI 推理 → items[0]
- 解决跨 appCode 默认"车辆管理" 问题

vitest (tests/integration/drift/round17-fix-batch5.spec.ts):
- 13 fixture 全部 PASS (P0 wire-up + P1-1/2/3 + TS 编译基线)
- 累计 vitest: 70 → 83 (+13)

drift (docs/drift/2026-07-15-round17-plan.md):
- R17 全部完成 (P0+P1+P2 部分)
- 累计 21 项修复, AI 4 限制闭环

验证:
- TS compile: 49 errors (baseline) == 49 errors after (0 新错) ✅
- jxcj M1 对照: f_competition_id (R17 P0) / f_start_time (R17 P1-1) /
  f_wechat_qrcode (R17 P1-2) / category 默认"车辆管理" (R17 P1-3) 全部修复

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
2026-07-15 16:41:09 +08:00
ssw 3e279325f3 feat(dacli): R16 in-process FormRepair (TS 镜像 ssw, 替代 HTTP)
- 新增 dacli/src/commands/form/_form_repair.ts (137 行):
  - mapLabelToJnpfKey: 18 条 label→jnpfKey 启发式 (镜像 ssw FormRepairServiceImpl)
  - repairFormDataFields: type_drift 修复 + F_ 前缀还原
  - repairFormDataFromString: JSON string 接口对齐 ssw endpoint
- form/create.ts: 删 R14 HTTP fetch (auth blocked by JNPF Sa-Token),
  改 in-process repairFormDataFromString 调用
- 镜像架构: ssw-common (Java) 是权威, dacli (TS) 是镜像,
  同步维护; 加新规则时两边一起改
- 新增 vitest:
  - tests/integration/drift/round15-fix-batch4.spec.ts (18 tests)
  - tests/unit/workflow/create_stale_retry.test.ts (3 tests)
- 累计 70 vitest 全部 PASS, TS 编译 0 新错

R15 验证: form type_drift 5→0, column_drift 58→0 预期 (R17 重跑验证)
2026-07-15 15:45:20 +08:00
ssw 259580b240 fix(dacli): R14 BS-新44/52/41/43b/45 drift fixes + 25 vitest
- BS-新44 (P0): di/_lookup.ts 用 getDataInterfaceSelector 优先 + category iterate fallback (collectDiCategories)
- BS-新52 (P1): fullName autoStrip helper 加 _encode_validator.ts, 4 caller 集成 (form/dict/workflow/menu)
- BS-新41 (P1): menu type=9 moduleId 注入 (isFormMenuType = [3,4,9,11])
- BS-新43b (P2): workflow stale pre-validate cleanup + retry ONCE
- BS-新45 (R14): form/create.ts 调 ssw FormRepair /api/ssw/form/repair-fields post-create
- 25 vitest in tests/integration/drift/round13-fix-batch3.spec.ts
2026-07-15 12:12:44 +08:00
sswandClaude aee1a72c12 fix: Round 12 drift batch 2 (smartProps fallback + lookup helpers + workflow trivial detection)
Round 12 batch 1 修了 F1/F2/F6 + workflow ENCODE_REGEXP 去重, batch 2 闭环剩 3 项.

- BS-新41 (form smartProps fallback): 5/5 form required=false drift 因 NCPF 后端返
  'Login expired' → source='none' → 0 字段填 → required 保持 web 默认 false.
  加 applyHeuristicRequired(formData): label 含 */必 → required=true,
  vmodel 末为 id/code/key/name/num/serial → 通常必填. create.ts 在 source='none'
  时 fallback 跑启发式.

- BS-新42/43 (role/di lookup): role/di inline list-and-find 抽取到 _lookup.ts 跟
  dict/menu 一致. lookupRoleIdByEnCode / lookupDataInterfaceIdByEnCode. 5/5 id=undefined
  在 Round 13 应收敛.

- BS-新43 (workflow --ai trivial detection): NCPF backend /workflow/ai LLM prompt
  缺节点规格, 5/5 都生 StartEvent→Task_1→EndEvent 3-node trivial, 业务流 4-10 节点
  全丢. web 端 workflow API 没暴露 getAiInfo (探索发现注释是误导), 无法 webapi 化.
  加客户端 detectTrivialFlowXml: 数 userTask 元素 <2 视为 trivial, 强 WARN 推荐
  --flowXml 直传 baseline.

Tests: 38/38 PASS
- tests/integration/drift/round12-fix-batch2.spec.ts (10 tests, NEW)
- existing: round12-fix-batch1.spec.ts + round12-cross-module.spec.ts

Docs: docs/drift/2026-07-15-round12-fix-batch2.md

Co-Authored-By: Claude <[email protected]>
2026-07-15 10:34:37 +08:00
sswandClaude f840f2961a fix: Round 12 drift batch 1 (enCode autoStrip + DI uniqueness + report cells)
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]>
2026-07-15 10:11:12 +08:00
ssw 3372bc0ef7 TC-B 浏览器验证加 workflow module (v0.21+ 扩展, 2026-07-14)
* browser.ts 重构: runBrowserTest 派发 form/workflow 2 module
  - 新增 fetchWorkflowSchema (镜像 web workFlow/template.ts getInfo)
  - 新增 runWorkflowBrowserChecks (workflow 专属 7 检查, 镜像 Form.vue schemas)
  - 7 检查: 页面加载 / 9列表列 / 新增+5类型dropdown / AI建流程 / form模态框 ≥6字段 / 必填 fullName+category+icon / formItem label 完整性
* 路由策略: workflow 走静态路径 onlineDev/flowEngine (vs form 走 menuList 解析)
  - 静态路径无 menu 后缀 hash 漂移风险
* 向后兼容: --formId alias, --id 通用, --module form|workflow
* 修 '新增' vs '新建' locale 漂移 (中英/zh-TW 都覆盖)
* 帮助文本加 Prerequisites 段 (testspace 需先建 type=2 menu 'tcbflowdesign')

实测:
  testspace: 7/7 PASS, 8.4s (9/9 列 + 7/7 form label)
  workSystem form 回归: 7/7 PASS, 8.8s
  错误处理: 错误 module 拒绝 / form 缺 formId 拒绝 / workflow 缺 id 允许 (跑 UI 检查)

架构:
- 镜像 web 端 flowEngine/{index,Form}.vue 渲染契约, 0 自创逻辑
- webapi 镜像 (loadWorkflow.getInfo) 拿 schema, 跟 form module 走同一 webapi-loader 模式
- storage snapshot 复用 (~/.dacli-snapshots/<appCode>.json), 一次性 login 跨 module 共享
2026-07-14 15:16:44 +08:00
ssw ecd0e934e9 Round 10: 修 dict 3 类 + di 3 类漂移 (BS-drift-D-1/2/3 + DI-1/2/3 RESOLVED)
dacli 改动 (12 行):
- dacli di create 加 --fieldJson/--parameterJson/--dataConfigJson 3 选项
- 透传 baseline schema, 替代默认 '[]' / 空模板

测试闭环 (46 tests, 全部 PASS):
- dict-drift.spec.ts: 25 tests (5 dict 重建, items + parentId + category 100% 跟 baseline 一致)
- di-drift.spec.ts: 21 tests (5 di 重建, fieldJson + parameterJson + dataConfigJson 100% 跟 baseline 一致)

漂移数据 (5+5 重建, 21 items + 10 fields + 1 param + 5 configs):
- dict: PositionType(3) RoleType(3) EnterpriseNature(5) Education(8) OrganizeType(2)
- di: 3323/0001(zhenfenye/al)/bingtu - 3 种 type (SQL/API/static) 都验证

总测试: 250 → 263 PASS
2026-07-14 12:09:53 +08:00
ssw cd513d051a Round 9: dict + di drift 漂移测试 43 份 + 6 类新漂移
- BS-drift-D-1: dict items 全部丢失 (5/5 baseline 3-56 items, rebuilt 0)
- BS-drift-D-2: dict parentId 全部丢失 (5/5 sub-classification 退化顶级)
- BS-drift-D-3: dict type/category 错误 (5/5 系统字典变业务字典)
- BS-drift-DI-1: di fieldJson 丢失 (3/5 baseline 2-4 fields, rebuilt [])
- BS-drift-DI-2: di parameterJson 丢失 (1/5 baseline 1 param, rebuilt [])
- BS-drift-DI-3: di dataConfigJson 配置丢失 (5/5 真实 SQL/API config 变空模板)

测试: dict-drift.spec.ts (18 tests) + di-drift.spec.ts (25 tests)
      10 fail (drift detected) + 33 pass (regression baseline)
总测试: 250 vitest (含 Round 1-8 已固化 217)
2026-07-14 11:47:10 +08:00
ssw adf35f81ec Round 7b+: 修复 BPMNEdge waypoint 不跟节点位置 (浏览器箭头画在节点上)
问题: Round 7b B方案 autoLayout 只重排 BPMNShape (节点位置), 没动 BPMNEdge (边 waypoint).
      AI 默认 waypoint=(400,300), 跟新节点位置不一致,
      浏览器箭头全画在节点上 (BPMNEdge 还在原始 (400,300) 位置).

修复: applyLayout 同时更新 BPMNEdge.di:waypoint.
      算法 (镜像 web handleAutoLayoutByHorizontal 简化):
        直线 waypoint = source 右边缘中点 → target 左边缘中点 (2 个 waypoint).
      注意: bpmn-moddle 用 moddle.create('dc:Point', {x, y}) 创建 waypoint.

端到端实测 (vehicleRefuelApprovalDemoV6):
  节点:
    Activity_nTVZAED  (400, 300) 90x32  ←start
    Activity_yuseGvQ  (750, 272) 200x88
    Activity_VXbHuZK  (1100, 272) 200x88
    Activity_lGQLuO2  (1450, 272) 200x88
    Activity_NQOU0EM  (1800, 272) 200x88
    Activity_YtTP6dH  (2040, 300) 90x32  ←end
  边 waypoint:
    Flow_3jWzClO: (490, 316) → (750, 316)
    Flow_fiXItfh: (950, 316) → (1100, 316)
    Flow_Nnk1Pve: (1300, 316) → (1450, 316)
    Flow_O4jZTZM: (1650, 316) → (1800, 316)
    Flow_lNzWLZt: (2000, 316) → (2040, 316)
    → 全部对齐节点边缘 ✓

vitest: 71/71 PASS (4 文件, +1 新增 edge waypoint 测试)
2026-07-14 10:58:20 +08:00
ssw 22dfeaae64 Round 7b: B方案 真镜像 web constructTreeUtil.ts (替换自写算法)
问题: Round 7 我用 C方案 自写了简化版 BFS 水平布局算法, 违反镜像架构原则.
      用户质疑 '你是自己写的布局, 还是用平台的源码', 要求真复用 web 源码.

B方案: 用 webapi loader 模式镜像 web 端 constructTreeUtil.ts (763 行):
  1. 读 web/.../jnpf-bpmn/lib/utils/constructTreeUtil.ts 源
  2. shim 处理 bpmn-js 依赖:
     - NodeUtils → 本地 stub (BPMNTreeBuilder 自身只用了 getNextElementList, 已剔除)
     - '../config' → hasGatewayType 等常量
     - '../config/constants' → DEFAULT_CONNECT, DEFAULT_DISTANCE
     - '../config/variableName' → bpmnStart, bpmnTask, typeConfluence 等
  3. 剔除 bpmn-js runtime-only methods (Node 跑不了 modeling API):
     - formatCanvas / formatCanvasHorizontal (要 modeling.moveElements)
     - getElementsByGateway (要 NodeUtils.getNextElementList)
     - getGroupElementById (要 bpmn.get('elementRegistry'))
  4. 写 tmp 文件, dynamic import, 单进程缓存

保留的 web 纯方法 (BPMNTreeBuilder):
  - constructTree() — 构建 BPMN 树
  - bpmnTraverseTreeBFS() — BFS 水平布局核心算法
  - calculateVirtualHeight() — 同层 y 错开 (按 parentData.height 计算)
  - handleCollisionsByLevel() — 横向碰撞检测
  - findStartElement/findNodeById/getOutgoingConnections

端到端对比 (vehicleRefuelApprovalDemoV3):
  C方案 (Round 7 自写): y 全部 200 (统一对齐), x 350px 等距
  B方案 (Round 7b 真镜像): y 按 web 算法智能对齐 (4 approver 在 272, start/end 在 300)
                           start 不变 (root), 子节点 x = parentX + 150 + childWidth

镜像架构审计:
  ✅ 复用 web 算法 (BPMNTreeBuilder) - 不自创
  ✅ 复用 web 算法 (BFS 水平布局 + 虚拟高度 + 碰撞检测)
  ✅ 复用 web XML 解析 (bpmn-moddle)
  ✅ 镜像源引用 web 行号

vitest: 70/70 PASS (4 文件, 包括 8 个 autoLayout 单元测试), 575ms

改动:
- webapi/bpmnTreeBuilder.ts (NEW, 145 行): webapi loader, shim + dynamic import
- workflow/_autoLayout.ts (REWRITE): 用镜像 BPMNTreeBuilder 替换自写 BFS
- workflow-autolayout.spec.ts: 3 节点测试改成 web 算法预期值
- docs/drift/2026-07-14-round7b-autolayout-mirror-summary.md (NEW)
2026-07-14 10:04:32 +08:00
ssw ffcc3e07a2 Round 7: C方案 autoLayout 解决 AI 节点全挤 (bpmn-moddle + BFS)
问题: dacli workflow --ai 走 web 端 /api/workflow/ai 拿 BPMN XML,
      AI 返回的 XML 所有节点 bounds=(400,300) 完全重叠 (6 节点挤一起),
      浏览器打开流程设计器时由 bpmn-js 客户端 handleAutoLayoutByHorizontal()
      重新布局, 但 dacli Node CLI 没有 bpmn-js runtime (DOM canvas).

C方案 (webapi 替代): 不跑 bpmn-js (Node ESM 跑不了, CJS/ESM 兼容失败),
  改用 bpmn-moddle (bpmn-js 的核心依赖, 纯 XML 解析, 无 DOM) +
  镜像 BPMNTreeBuilder BFS 算法:
  1. moddle.fromXML 解析流程节点 + 边
  2. BFS 找 start → 分配 level (0, 1, 2, ...)
  3. 按 level 分组, x 按 level 递增, y 同层错开
  4. moddle.toXML 序列化回 BPMNShape.bounds

镜像源:
- web/.../FlowProcess/.../FlowButton.vue:354 (handleAutoLayoutByHorizontal)
- web/.../jnpf-bpmn/lib/utils/constructTreeUtil.ts (BPMNTreeBuilder class)
- web/.../jnpf-bpmn/lib/utils/nodeUtil.ts (getExternalLabelMid 等)

端到端实测 (vehicleRefuelApprovalDemoV2):
  Before: 6 节点全 (400, 300) 90x32/200x88
  After:  6 节点水平分布 200/550/900/1250/1600/1950 (350px 间距), y=200 对齐
  → 后端保存后 workflow.info 验证坐标正确

vitest: 70/70 PASS (4 文件, 包括 8 个新 autoLayout 单元测试), 813ms

改动:
- _autoLayout.ts (NEW, 285 行): autoLayoutFlowXml + isLayoutNeeded
- workflow/create.ts: step 1/6 AI 后触发 isLayoutNeeded → autoLayoutFlowXml
- workflow-autolayout.spec.ts (NEW): 8 单元测试
- package.json: + bpmn-moddle + @types/bpmn-moddle (24 packages)

简化 trade-off: 不实现 gateway 冲突避免 / 横向碰撞检测 (复杂流程需浏览器手动调)
覆盖 95% 场景: AI 生成的直线流程自动布局完美
2026-07-14 09:45:16 +08:00
ssw 23c606e73d Round 6: BS-drift-W-3 镜像 web bpmnLintUtil.ts 校验 (不自创)
镜像架构原则实践: BS-drift-W-3 (AI 节点数自由生成) 不可强约束,
硬编码角色/节点数会引入维护负担 + 漏业务专属角色 + 跨语言失败.

采用 '复用规则文字 + 引用 web 源码行号' 的务实镜像策略:

镜像源: web/packages/jnpf/plugins/jnpf-bpmn/lib/utils/bpmnLintUtil.ts
镜像 4 规则:
- 规则 1 (line 73): 必须有 start + end + approver
- 规则 2 (line 84): 只能有 1 个 start
- 规则 3 (line 106): 只能有 1 个 end
- 规则 5 (line 130+): parallel/inclusive 网关必须成对 (偶数个)

规则 4 (edges 进出线) 跳过: dacli parseFlowXml 不解析 sequenceFlow 边
(web _webapi_helpers.ts:215 注释).

未来 v0.22+ 用 webapi loader 整个 import bpmnLintUtil.ts (含边校验),
需先用 shim 把 flowNodes 转 ElementRegistry-like 结构.

5 类漂移全部 RESOLVED:
- BS-drift-M-1/2, BS-drift-W-1/2/4 (Round 5)
- BS-drift-W-3 (Round 6 镜像修复) ✓ NEW

vitest: 62/62 PASS (22 menu + 31 workflow drift + 9 validator 单元测试), 419ms

改动:
- workflow/_webapi_helpers.ts: 加 validateFlowNodeStructure (镜像 4 规则)
- workflow/create.ts: step 4/6 调用 mirror validator
- tests/integration/drift/workflow-validator.spec.ts (NEW): 9 单元测试
- tests/integration/drift/workflow-drift.spec.ts: BS-W-3 切到 RESOLVED via mirror
- docs/drift/2026-07-14-round6-w3-mirror-summary.md (NEW): 完整总结
2026-07-14 08:52:16 +08:00
ssw 1833714328 auto(bfc0cfa2c3a4): session end @ 2026-07-14T08:28:35 (+2f) 2026-07-14 08:28:35 +08:00
ssw 44ff342d02 auto(bfc0cfa2c3a4): session end @ 2026-07-14T08:00:46 (+1f) 2026-07-14 08:00:46 +08:00