ssw
0bb32d5ae2
auto(14b5ea1b9bd9): session end @ 2026-07-23T15:04:41 (+10f)
2026-07-23 15:04:41 +08:00
ssw and Claude
64fbb4ac0a
docs: archive cmd-review 25 + drift round 20 (2026-07-23)
...
清理 help 体系干扰/过期信息, 整体归档:
1. cmd-review/ 25 文件 → archive/cmd-review-2026-07/
- 22 个 2026-06-30 一波生成的命令审计
- 1 个 bigscreen-components (2026-07-01)
- 1 个 bigscreen (2026-07-01)
- 1 个 app (2026-07-01)
- 含 form/dm/menu M2 实战更新版 (建议已落地, 整体降级归档)
- cmd-review/ 留 README.md 指针
2. drift/ 20 个 round summary → archive/drift-rounds-2026-07/
- round 3-4/5/6/7/7b/8/9/10/11/12/13/14/15/16/17 + day summary
- drift/ 保留 README/USAGE/fetch-baseline.sh 基础设施
- drift/README.md 加 ⚠️ 头
3. 改引用:
- dacli/README.md §必读文档 改指 archive
- 7 个 ADR (0001-0004/0011/0013/0015) 顶部加 ⚠️ 头说明引用路径已迁
- archive/README.md 加 cmd-review-2026-07/ + drift-rounds-2026-07/ 段, 更新结构图, 更新 AI 误读防御清单
新权威源:
- 命令用法 → 'dacli <cmd> --help' (DacliHelp 注入 pitfalls/bestPractices/decisionTree)
- 决策理由 → docs/decisions/0001-0016 ADR (git-tracked, 权威)
- 反模式 → docs/anti-patterns.md (auto-gen, _anti_patterns.ts 为单一权威)
触发: 用户反馈 'dacli help 体系感觉很多干扰/过期信息, 看看怎么处理'
+ 'cmd-review 22 + drift 13 round 意义不大, 也可归档'
Co-Authored-By: Claude <[email protected] >
2026-07-23 15:04:18 +08:00
ssw
41cc72a309
auto(14b5ea1b9bd9): session end @ 2026-07-23T10:49:11 (+1f)
2026-07-23 10:49:11 +08:00
ssw
571737ccaa
auto(14b5ea1b9bd9): session end @ 2026-07-23T09:50:13 (+1f)
2026-07-23 09:50:15 +08:00
ssw
15d39451c3
auto(14b5ea1b9bd9): session end @ 2026-07-22T21:25:12 (+1f)
2026-07-22 21:25:12 +08:00
ssw and Claude
fa605579f3
test: cover eventhub blocker fixes
...
Co-Authored-By: Claude <[email protected] >
2026-07-22 16:51:06 +08:00
ssw
c584e9f4c1
auto(14b5ea1b9bd9): session end @ 2026-07-21T21:53:43 (+1f)
2026-07-21 21:53:43 +08:00
ssw
aa21fc57ef
docs(ADR 0015): P4 v3 全量收口固化 + §4.1 经验教训段
...
新增 §4.1 'P4 v3 全量收口 (2026-07-21)' 详细段:
- 范围修正: scan 估算 ~330 处, 实际 25 文件 33+ 处真表格. 其余分
(a) 树/key:value dump (dict/typelist + storage/info + user/auth-groups + user/info + menu/info)
(b) 调试日志 (form/_ai + kb/show + apis/info 等)
- 8 批 commit 表格 (15b3361 → 07463cb , 本 session 19 文件 + 前 session 6 = 25/25)
- 迁移模式固化 (代码模板)
- 6 条经验教训 (估算偏差 / Edit vs Write / UUID 截断 / --include-actions / 进度条保留 / 不需新 primitive)
§3 优先级表 P4 v3 行: '待' → '✅ DONE', 加 8 commit 引用 + ~310 散布分类
原 §4.1-4.4 顺延 → §4.2-4.5 (P0 ROI / P1 紧跟 / P3 不放 P1 前 / P5-P6 风险).
验证:
- TS compile baseline 57 不变
- 73/73 vitest PASS
- P4 v3 全量收口闭环: 25/25 REAL_TABLE 文件
2026-07-21 18:48:56 +08:00
ssw
1fb4f0d208
docs(ADR 0015): 同步本 session 累计 (P5 全量 + P6 sample 续 + P4 v2)
2026-07-21 18:06:54 +08:00
ssw
b39024a7ae
docs(ADR 0015): 同步表 done 行 (补 P4a/P5 sample/P6 sample)
...
7 commits 累计 done:
- c637a58 P0 wrapCommand helper
- 715fcb9 P3 18 _validate.ts 统一
- 5ead157 P1 dm/drop TTY + shim 清理
- 22593df P4a + P6 sample
- 45e9f10 P5 sample
剩:
- P2 (2-3h) form/create + workflow/create + form/codegen 高严重度批量
- P4 v2 (1h+) console.log → log.printRawTable 新 primitive
- P5 全量 (2h) ~15 命令路径 throw → DacliError
- P6 大坑 (8+h) 350+ 裸 process.exit 跨多 session 治理
2026-07-21 17:47:21 +08:00
ssw
654ce3d2e6
docs(ADR 0015): 同步本 session 累计 done (P4a/P5 sample/P6 sample)
...
7 commits 累计 .:
- c637a58 P0 wrapCommand helper
- 715fcb9 P3 18 _validate.ts 统一
- 5ead157 P1 dm/drop TTY + shim 清理
- 22593df P4a + P6 sample
- 45e9f10 P5 sample
剩:
- P2 (2-3h 高严重度批量)
- P4 v2 (console.log → log.printRawTable 新 primitive)
- P5 全量 (~15 throw → DacliError)
- P6 大坑 (350+ 裸 process.exit 跨多 session 治理)
2026-07-21 17:47:04 +08:00
ssw
5ead157903
feat(dacli): P1 dm/drop TTY 拦截 + workflow shim 清理 (11 文件)
...
P1 (0.5h):
- dm/drop.ts 加 TTY 拦截 — 镜像 form/delete.ts:25 + print/delete.ts:46 +
report/delete.ts:39 已稳定的 pattern: `if (!opts.yes && process.stdin.isTTY)` 时
warn + exit 1; 非 TTY 模式 (CI/脚本) 静默 --yes 走即可. 同步 DOC 注释 + 移除 TODO.
- storage/info.ts:38 DacliError 分叉 — 验证**实际不存在** (`class DacliError`
仅 src/core/types.ts:57 一处定义, 已被 storage/_helpers.ts:21 正确 import).
ADR 0015 §2.2 早期记述有误, 修订清空.
shim 清理 (0.5h):
- 11 个 workflow 子命令 (approve/create/decision/delete/info/launch/list/
selector/syncForm/tasks/update) 把 `import { ... } from './_output.ts'`
改成 `from '../_output_filter.ts'` (1 行 sed × 11 文件).
- 删除 src/commands/workflow/_output.ts shim 文件 (D 掉), 减少 1 个间接层.
- 不影响 L1 输出过滤 / L3 CommandLog 落盘, 因接口签名不变.
验证:
- TS compile: 56 errors baseline 不变, 0 新错误
- 68/68 单元测试 PASS (含 tests/unit/workflow/create_stale_retry)
- 端到端: dacli dm drop --help + dacli workflow info --help 完整
2026-07-21 17:35:09 +08:00
ssw
72766bc629
docs(ADR 0015): mark P3 done ( 715fcb9 18 _validate.ts 统一 import)
2026-07-21 17:21:39 +08:00
ssw
715fcb9a59
feat(dacli): P3 全量 18 _validate.ts → ValidationError 一源
...
每个 per-module _validate.ts 之前都自己 declare `export interface
ValidationError { field?, message, code? }` (跟 _error_codes.ts 完全一致),
导致跟 _error_codes.ts 定义漂移 (有的加 step/stepName, 有的加 docstring,
字段含义略不同但定义都一样).
这次统一 18 文件 import { ValidationError } from '../_error_codes.ts',
让所有 step machine 输出格式 + aggregate 跨模块一致.
机械改造:
- 18 文件: 删本地 export interface ValidationError block
- 加 `import { ValidationError } from '../_error_codes.ts'`
- 5 个文件 (dict/form/menu/role/workflow) import 因 docstring 在前, 落
在 interface 之后, 第二次 fix-up 移到 import 块首
- 总变更: 18 insertions, 131 deletions (净减 113 行, 重复 definition 没了)
验证:
- TS compile: 56 errors baseline 不变, 0 新错误
- 65/65 单元测试 (output_filter/auto_fix/report_wired 3 文件)
- blindspot_guards 12 个测试失败 (跑 `git stash` 验证: 是 pre-existing
baseline 问题, 不是本次引入)
- dacli datasource create 端到端 validation 错误格式不变
附带: docs/cmd-review/scan-2026-07-21.md 8 维度扫描报告 (含 ADR 0015
没列的 4 项新发现: workflow shim / console.log 范围扩大 / form/create 13
process.exit / DacliError 实际无重复).
2026-07-21 17:20:55 +08:00
ssw
a5c22b98d3
docs(0015): 源码 5 类遗留清单 (v2.2+ 实证 P0 已 done + P1-P6 待办)
...
基于 c637a58 wrapCommand 实证重建 (上次 86d9dac 因太早被 7cdc818 revert).
5 类遗留 (§2):
- §2.1 P0 printCommandEnd 5c 样板 ✅ DONE (c637a58 )
- §2.2 P1 2 个已知 baseline 坑 (dm/drop + storage/info)
- §2.3 P2 25+ 高严重度文件批量
- §2.4 P3 18 个 _validate.ts 错误码 import 不一致
- §2.5 P4 addOutputOptions 已加但 stdout 风格不统一
- §2.6 P5 console.log + throw 统一 (4+h 大改)
- §2.7 P6 350+ 裸 process.exit 跨 session 治理 (大坑)
决策依据 (§4):
- P0 为什么 ROI 极高: 一行 helper = 30+ 行样板 + 单测 17 条已稳
- P1 紧跟: 独立 1 文件修改, 风险极低
- P3 不放 P1 前: 批量一致性调整 < 已知坑修复
- P5/P6 大坑单独排期
README §引用: ADR 索引 0001-0015 系列, 版本加 v2.2+ wrapCommand.
2026-07-21 17:05:31 +08:00
ssw
7cdc8187cc
Revert "docs(0015-source-leftovers): 源码 5 类遗留清单 + P0-P6 优先级路线"
...
This reverts commit 86d9dac83d .
2026-07-21 16:38:00 +08:00
ssw
86d9dac83d
docs(0015-source-leftovers): 源码 5 类遗留清单 + P0-P6 优先级路线
...
扫描方法: Explore agent 全 codebase 扫描 dacli/src/commands/*.ts, 5 类规则 + 文件:行号.
5 大类遗留:
1. 裸 process.exit — 350+ 处 / 35+ 文件 (printCommandEnd L3 落盘被绕过)
2. console.log 残留 — 360 处 / 96 文件 (L1 stdout 三模式受影响)
3. throw new Error 未统一 DacliError — 37 处 (类型分叉风险)
4. TODO 注释 — 仅 3 处 (form/codegen --auto-menu + dm/drop TTY 拦截)
5. 重复 boilerplate:
5a addOutputOptions helper 覆盖不全 (38 文件手写 verbose/json)
5b per-module _validate.ts 18 处复制 ValidationError interface
5c printCommandEnd 失败收口样板 30+ 处重复, 无 helper 收口 (这是 P0 高 ROI)
5d history_bak backup name 字符串仅 app/clear.ts 单文件 6+ 处重复
优先级路线 (P0-P6, P0 最高价值 1 小时 + P1 0.5h 是 1 文件快修):
- P0 (1h, 极高): wrapCommand(handler) helper 收口 5c
- P1 (0.5h, 高): storage/info.ts:38 分叉修复 + dm/drop.ts TTY 拦截
- P2 (2-3h, 高): 大批量 printCommandEnd + try/catch 改造 (25+ 文件)
- P3 (1h, 中): 18 _validate.ts 改 import ValidationError
- P4 (1h, 中): addOutputOptions 38 文件迁移
- P5 (4+h, 中低): 360 console.log + 37 throw 统一
- P6 (大坑, 极高): 350+ process.exit 全量重构 (单 session 不可能, 留独立 ADR)
不做源码改造 (本 session 已收尾):
- 已完成 6 commits (本 session) + 全部关键闭环
- 源码层遗留是 massive 后续工程, 强行做会引入更多问题
- 留 ADR 让后续 session 拿优先级列表直接挑目标
下游 hook:
- 任一 P0-P4 完成时更新本 ADR 状态 (Superseded by 0016-...) 或新增 ADR
- P6 350+ process.exit 太大坑, 留跨 session 专项治理
2026-07-21 16:25:37 +08:00
ssw
f7bc8d55d0
docs(0014-app-clear-docs-coverage): app clear docs 残留缺口决策记录
...
事实: docs/jxcj 实测 14 项残留 (8 MD + 4 子目录 + 设计说明)
不被清理, 历史 DOC_HTML_FILES 只清 4 html
根因: docs/dacli/ssw-dacli/.../ClearAppCommand.java 用 DOC_HTML_FILES 白名单
Dacli 也复用了同样限制, 漏了所有非 html 文件
修复 (P1-2d commit 60adaab ): dacli 端加 --clean-docs flag (默认 false 保持向后兼容)
true: docs/{app}/ 整体打包成 FileTarget, 移到 history-bak/{ts}/files/docs/{app}/
false: 历史行为 + DRY-RUN 警告提示残留项数 + 提示 --clean-docs
决策依据:
- docs/{app}/ 是 ssw-loop 关卡 A/B/C 强依赖 (design/testcase/summary/learnings/plan/debug + _assets 6+ MD)
- 默认不改, 用户显式加 --clean-docs 才真清, history-bak 保留可还原
- 与 P0-3 (2026-07-15) DB fallback 同模式: --no-relation-form-auto / --autoRelease 等 flag
已知 ssw-common 端点 bug (留下游路线 §1):
- DbClearServiceImpl.listBizTables 走 openConn(appCode, null) 把 jxcj 当独立 db
- 但 jxcj 在 PG 共享库 j62 schema=jxcj, 不是独立 db
- 修复需要改 Java 5-10 处 + Maven 编译 + JNPF 重启 (Java 无 devtools auto-reload)
- 风险: testspace 当前活跃测试会中断
- 跨项目路线, 不在 dacli 端实现
下游路线 (ADR §Downstream):
1. ssw-common 端点改进 (跨项目, 高优)
2. dacli 端 fallback 查询 (P1, 中优)
3. ssw-loop 关卡 check_clear_coverage.sh (P2, 低优)
4. dacli app history 子命令 (P3, 远期)
E2E 验证 (testspace 默认应用):
- DRY-RUN --clean-docs 显示 [MOVE] docs/testspace/ 整体打包
- 业务库 preview 列出 72 张表 (testspace schema=public 正常工作)
- jxcj schema=public 不识别业务表 (符合 ADR §已知风险)
README 路径速查表加 "--clean-docs 行为" 行, 指向 0014-ADR
2026-07-21 15:47:19 +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
bbcdf9fab2
dacli: M2 实战固化 (jxcj 2026-07-20)
...
3 跨项目问题 + 修复 + 文档:
1. ADR 0011 — dm drop DB201 错误信息明确化
- 旧: 表有数据时报 DB201 "The table has already been used" 误导用户
- 新: catch DB201 输出修复指引 (TRUNCATE + ADR 0011 P1 待加 dm truncate 命令)
- 文件: src/commands/dm/drop.ts + docs/cmd-review/dm.md + docs/decisions/0011
2. ADR 0012 — form create --ai relationForm 软降级
- 旧: AI 生成 relationForm 缺三元组 (~40%) 触发 step machine 硬 FAIL
- 新: validateFormData 软降级 — 三元组不全时自动改 jnpfKey='input' + 警告 (而非硬错)
- 测试: 4/4 PASS (含缺 1/2/3 个三元组场景, 均软降级)
- 文件: src/commands/form/_validate.ts + docs/cmd-review/form.md + docs/decisions/0012
3. ADR 0013 — menu create CurrentUser 缓存阻塞
- 现象: menu create --formId 成功后 CurrentUser.menuList 不刷新, TC-B 阻塞
- 修复: P1 待加 menu cache clear + menu create 后自动 invalidate
- 兜底: test browser fallback 到 /jnpf_app_${appCode}/model/${formEnCode} 直接 URL
- 文件: docs/cmd-review/menu.md + docs/decisions/0013
jxcj M2 重启 (2026-07-20) 实战产出, 跨项目通用 (testspace/developSystem/workSystem/dos 等)
详见 docs/jxcj/summary.md + docs/jxcj/learnings.md 阶段 4 段
2026-07-20 18:02:38 +08:00
ssw and Claude
61405e128d
fix(dacli): resolve merge conflicts + add v2 architecture spec
...
- resolve 10 merge conflicts across 4 files (app/init, dict/typecreate, form/create, webapi/_defhttp)
- fix syntax errors in typecreate.ts (commented-out if block)
- add ADR-0010: dacli v2 self-correcting CLI architecture design
- add simulation test comparing v1 vs v2 behavior
Co-Authored-By: Claude <[email protected] >
2026-07-20 10:11:41 +08:00
ssw
ec10f7ddfc
auto(bfc0cfa2c3a4): session end @ 2026-07-20T08:58:21 (+1f)
2026-07-20 08:58:21 +08:00
ssw
5a8cbca732
chore(.claude): archive dacli-ts + jnpf-browser-automation skills, clean CLAUDE.md references
2026-07-17 13:26:49 +08:00
ssw and Claude
fc2282f259
chore: remove all dacli-ts references, rename to dacli
...
Co-Authored-By: Claude <[email protected] >
2026-07-17 12:20:48 +08:00
ssw
60432caef2
feat(dacli): add gen-anti-patterns-md.sh + first auto-generated anti-patterns markdown
...
- scripts/extract_anti_patterns.ts: extracts ANTI_PATTERNS from _anti_patterns.ts to stdout
- scripts/gen-anti-patterns-md.sh: bash wrapper with --check mode for CI
- docs/anti-patterns.md: auto-generated from 25 entries across 11 commands
2026-07-17 12:03:07 +08:00
ssw
79447386ad
docs(dacli): create decisions/ directory + 9 ADR documents (0001-0009)
2026-07-17 11:59:47 +08:00
ssw and Claude
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 and Claude
6d785ce9b0
fix(form): wire up autoDetectAndInjectRelationForm (BS-新117 R17 P0)
...
历史 (2026-07-15 jxcj M1 复盘):
- form/_relationForm_auto.ts:144 函数定义但 0 import/call
- form/create.ts:59 relationFormAuto 选项声明 + --no-relation-form-auto flag
- 文档声称"默认 ON 自动注入"实际未生效
- jxcj topicDirection.f_competition_id 应是 relationForm 但生成 input
修复:
- form/create.ts:295 在 --ai 路径 webBuildFormData 之前
- 真正调 autoDetectAndInjectRelationForm(aiModelListForBfd)
- 默认 ON (除非 --no-relation-form-auto)
- TS cast 解决 strict mode type 不匹配 (aiModelList 含 billRule/unique 等 extra fields)
验证:
- TS compile: 49 errors (baseline) == 49 errors after (0 新错)
- jxcj M1 实战对照: 之前 f_competition_id 是 input, R17+ 应是 relationForm
drift/docs/drift/2026-07-15-round17-plan.md:
- R17 P0 完成 (本 commit)
- R17 P1 待: vm-to-jnpfKey 启发式 + upload 控件不标 required
- R17 P2 待: NCPF backend LLM 修复 (跨团队)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <[email protected] >
2026-07-15 16:35:03 +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
ff594c6779
docs(dacli): R15 vs R14 summary + ssw FormRepair auth blocked finding
2026-07-15 13:42:57 +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
ssw and Claude
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
ssw and Claude
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
72c7a3e05c
auto(bfc0cfa2c3a4): session end @ 2026-07-15T07:27:50 (+1f)
2026-07-15 07:27:50 +08:00
ssw
04e85a5433
docs: round 11 盲点固化总结 (6 类固化, 1 P0+3 P1+1 P0 后端+2 已知)
...
本轮触发: testspace drift loop 跑 5 form + 5 workflow 时, 端到端发现 6 类盲点
- BS-newPWD-1: user resetPwd 漏传 account + validatePassword (P0, 已修)
- BS-newAI-1: --ai 失败信息误导, BS-56 包装成 AI 失败 (P1, 已修)
- BS-newAI-2: SSW fallback 异常截断 60 字符, NPE 看不见 (P1, 已修)
- BS-newNCPF-1: NCPF 静默空响应直接 fallback SSW 太激进 (P2, 已修)
- BS-LLMNPE-1: SswLLMClient LLM 响应解析链式 NPE (P0 后端, 已修)
- BS-snapshot-1 / BS-jnpfLaunch-1: 已知不可修, 写进 known limitations
整体盲点统计 (Round 1-11): 32 类已固化或标记
2026-07-14 22:13:32 +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
304ed3bace
Round 8: 盲点固化 9 个 (BS-E3/4/5/6/7/10/11/13/14)
...
Round 1-7+ 碰到但只在 case-by-case 修了, 没固化到 dacli 防御层.
本轮把 9 个盲点按 P0/P1/P2 全部固化 (5 个是新增防御, 4 个是增强现有):
P0 (必修):
- BS-E3: workflow 未传 --startFormId → 浏览器报 'workFlowForm/undefined.vue'
→ 加 step 0 WARN, 推荐传 --startFormId
- BS-E4: --ai 描述过短 (<10 字符) → AI 返回乱流程
→ 加长度校验 WARN
- BS-E5: workflow --category=<id> 不存在 → 后端 400 模糊
→ 加 getFlowSelector 查表预校验, 不存在 exit 2
P1 (应修):
- BS-E6: isLayoutNeeded 阈值 80% 只看 BPMNShape, 1 节点错位+5 正确时跳过 autoLayout
→ 加 BPMNEdge waypoint 重叠检测
- BS-E7: AI 返回 <userTask name="undefined"> 字符串
→ 加 sanitizeName, fallback 到 id 或 i18n label
- BS-E10: menu urlAddress 重复 → 400 'The address cannot be duplicated'
→ 加 menu list 查重 WARN, 列冲突 menu id
- BS-E9: workflow --enCode BS-56 校验 (已存在, 确认仍生效)
P2 (可选):
- BS-E11: workflow info JSON 暴露内部字段 (_enabledMarkFromList 等)
→ 加 --include-internals 显式开关, 默认隐藏
- BS-E13: workflow delete 失败 'The process has initiated data' 模糊
→ 失败时打印 4 个常见原因排查清单 (form/flowable/menu/role)
- BS-E14: isLayoutNeeded 阈值 80% 写死
→ 加 --layoutThreshold=N 参数 (默认 0.8)
镜像架构原则保持: 0 自创算法, 全部复用 web 现有逻辑 + 加 CLI 层防御
Smoke 测试:
- BS-E3: dacli workflow create --ai '测试' → 'workflow 未传 --startFormId, 浏览器...'
- BS-E4: --ai '短描述' → '描述过短 (3 字符), AI 可能返回不完整流程'
- BS-E5: --category='invalid_xyz' → 'BS-E5: 不存在, 跑 dacli workflow selector'
- BS-E11: workflow info --json 不暴露 _enabledMarkFromList (默认), --include-internals 暴露
vitest: 71/71 PASS (4 文件), 812ms
改动:
- workflow/create.ts: +50 行 (BS-E3/4/5/14)
- workflow/_autoLayout.ts: +35 行 (BS-E6 waypoint + BS-E7 sanitize)
- workflow/info.ts: +10 行 (BS-E11)
- workflow/delete.ts: +12 行 (BS-E13)
- menu/create.ts: +20 行 (BS-E10)
- docs/drift/2026-07-14-round8-blindspot-solidify.md (NEW): 完整总结
总计 +127 行, 0 自创算法
2026-07-14 11:26:38 +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
b0e03d12fb
auto(bfc0cfa2c3a4): session end @ 2026-07-14T07:38:49 (+3f)
2026-07-14 07:38:49 +08:00
ssw
8cd1a48a11
docs(drift): Round 3+4 完整总结 (2026-07-12)
...
新增 docs/drift/2026-07-12-round3-4-summary.md:
Round 3 完成:
- TC-C v0.21+ 加深 9 关卡 (新增 jnpfKey/dict/label/required-type/subtable 5 个)
- TC-B 融合 dacli (dacli/src/commands/test/browser.ts, 5 form × 7/7 PASS, 7.5s/form)
- 复用 chromium-1228 + ~/.dacli-snapshots/<app>.json storage snapshot
- 4 子命令全景: run / generate / render / browser
Round 4 完成:
- TC-C+TC-B 联动 (tc-c-then-b.spec.ts, 16/16 PASS, 65s 5 form)
- 修字典 bug (webapi 响应 r.list 解套), testcustomer 9/9
- 剩 2 个 baseline columnList 错配 (user formDesigner 重配, 不在 dacli 范围)
总进度:
- 16 关卡/检查 (9 + 7)
- 145 vitest PASS
- < 3 分钟跑完
指引 Round 5 (menu/workflow/di Phase B 复制 render.ts 模板):
- render.ts 1200 行模板
- webapi/menu.ts, workflow.ts, di.ts 镜像 (15/14/9 函数)
- 复制 renderForm/renderDict 写 renderMenu/renderWorkflow
2026-07-13 20:11:23 +08:00
ssw
a737ec60aa
Round 2 final: TC-B 加速路径 + 完整总结 (6.25s, 2.7x 加速)
...
TC-B v0.20+ 加速路径 (实测 6.25s):
1. dacli app context --json → token
2. 一次性 login + 存 storage snapshot (后续测试复用)
3. GET /api/oauth/CurrentUser?systemCode=... → menuList
4. menuList[].enCode 含 8a3aa suffix (e.g. hesuanjiancedengji8a3aa)
5. 注入 snapshot + 直接 goto model/{enCode-with-suffix} → ✓ 直接到 form
关键发现:
- dacli form info 返 enCode 不含 suffix (8a3aa 是 menu 层加的)
- 直接 URL 必须用 menuList[].urlAddress (含 suffix)
- JNPF 6.x 用 AES-ECB 加密 localStorage, key 跟 web crypto-js 一致
2026-07-12 16:12:58 +08:00
ssw
5db0f36bcd
Round 2 followup: TC-B 浏览器真实验证 (workSystem/hesuanjiancedengji)
...
TC-B = webapi 准备 + 浏览器 DOM 验证
跑 workSystem hesuanjiancedengji (auto convention, baseline 已有):
- 浏览器 login → 侧边栏 业务示例 → 功能示例 → 核酸检测
- 列表页 → 新增 → form 编辑页 (12 inputIds)
- 渲染字段: comInputField*, billRuleField*, dateField*, selectField*
- 跟 baseline auto convention 完全一致
三层一致性 (TC-A → TC-C → TC-B):
baseline (auto) → dacli 重建 (auto) → 浏览器渲染 (auto)
命名规范端到端保留, 9/9 form TC-C PASS + 1/1 form TC-B PASS
截图:
/tmp/dacli-loop/tc-b-hesuanjiancedengji-form.png
/tmp/dacli-loop/tc-b-hesuanjiancedengji-new.png
/tmp/dacli-loop/tc-b-worksystem.json
2026-07-12 14:50:18 +08:00
ssw
229addcdf5
Round 2 followup: TC-C 源码渲染层验证 9/9 PASS
...
TC-C = 源码渲染层验证 (dacli test render --module=form --formId=<id>)
验证 vue 字段 ⊆ API 字段 关系成立
跑了 9 form:
- 修复后 4 form (BS-drift-1 + BS-NCPF-400): F_prefix/snake/auto 都 4/4 PASS
- 存量 5 form (修复前 snake 默认): 都 4/4 PASS
关键发现:
- F_prefix 端到端保留 (formData + columnData + DB schema 一致)
- snake 默认干净 (f_<semantic> 对齐系统字段 f_flow_* / f_id)
- auto 混搭 (smartProps 加的字段保留 snake, 但渲染 ⊆ API 仍 PASS)
- LLM 自由命名 (inputfield2a1f33) 部分存量容忍
结论: BS-drift-1 + BS-NCPF-400 修复未引入回归, 源码渲染层 100% 兼容
2026-07-12 13:46:44 +08:00
ssw
739513e288
Round 2 followup: BS-NCPF-400 commit 标记 + gitignore 注意事项
...
- BS-NCPF-400 commit 状态从 '待 commit' 改为 'pushed (f66734d)'
- 加 ⚠️ application.yml 在 boot/.gitignore, 团队需手动应用白名单
2026-07-12 13:40:22 +08:00
ssw
86a269d239
Round 2 followup: 文档更新 - BS-NCPF-400 解决
...
新增:
- 关键技术发现 #6 : BS-NCPF-400 解决 (SSW OpenAI proxy)
- Loop commit 第 7 条: BS-NCPF-400 修复待 boot 推送
2026-07-12 13:40:00 +08:00
ssw
e0a130c69f
Round 2 rerun: form drift 测试更新到 20 份 (smartProps 修复后对比)
...
rerun 5 form (删除原 5 测试 form + 重建), smartProps 修复后:
漂移对比 (修复前 → 修复后):
testreceivable 4/0 → 1/1 (-3 missing)
testcustomer 3/3 → 1/1 (-2/-2)
baomingguanli 0/0 → 1/1 (+1/+1, balanced)
yaofangguanli 3/8 → 0/1 (-3/-7 大改善)
hesuanjiancedengji 2/4 → 3/6 (+1/+2, AI 拆得更细)
TOTAL 12/15 → 6/10 (-11, -41%)
字段数对齐: baseline 55 → 修复前 58 → 修复后 59 (更接近 baseline)
smartProps 应用实测: 5/5 form 触发, 13 项 AI 推理应用
(BS-新61 字典 / BS-新63 inputNumber min-max / BS-新64 input regList)
漂移类别形态变化:
BS-drift-2: AI 从 '拆分字段' → '保留合并 + 加语义字段'
BS-drift-3: AI 从 '简写→精确' → '拆出 select 字段 + dict 联动'
vitest 17 → 20 (+3 rerun improvement 测试)
新 form IDs:
testreceivable 845977113713443013
testcustomer 845977187294118085
baomingguanli 845977246400250053
yaofangguanli 845977309763600581
hesuanjiancedengji 845977384954888389
注: CI 关卡 G kb FAIL 是已知预存问题
2026-07-12 13:15:25 +08:00