feat(form): BS-新141 applyHeuristicDictType (select→dictType 启发式) + 9 unit tests
背景 (jxcj M2 2026-07-23 实战):
- --ai 单次调用只决定 jnpfKey, 不绑具体数据源 id (dictType/modelId/relationField)
- 跟 prompt 是否含 enCode 无关 (实测验证实验 849913609722004741)
- 现有 SMART_PROPS 调 /ssw/ai/infer-component-props 会因 NCPF/SSW 后端 LLM
token 失效 Login expired (BS-新113) 而失败
修复:
- 新增 applyHeuristicDictType: select 字段按字段名模糊匹配 ctx.dicts enCode,
自动写 dictionaryType = dict.id, 不依赖 AI, 100% 确定
- 字段名清理: 去 f_ 前缀 + _type/_field/_status/_state/_enum/_code 后缀
+ 去下划线 (e.g. f_expertise_type → expertise, 匹配 jxcjjudgeexpertise)
- 多候选时优先 enCode 完全匹配, 否则警告
- 0 候选 → skipped, 用户 web 端 FormDesign 兜底
测试 (tests/unit/form_smart_props_dict_type.test.ts, 9 tests):
- select 无 dictType → 自动绑
- select 已绑 → 跳过 (matched++)
- 非 select → 跳过
- 多候选 → 警告 + 选 enCode 完全匹配
- 字符串 formData.fields → 内部 parse + 写回字符串
- 0 候选 → skipped
- 空 / malformed → 不 throw
ADR 0017 (docs/decisions/0017-form-smartprops-unification.md, round 2)
含: 根因 #2 (AI Login expired), form update --fields 集成 SMART_PROPS
(改进 2 try/catch AI 失败 tolerant), 改进 3 applyHeuristicDictType 必做.
update.ts 集成 (e04bcb3 已 commit): form update --fields PUT 前跑
SMART_PROPS.applyAi (try/catch, Login expired 不阻塞) + 3 个启发式.
Note: DACLI_SKIP_GATE=1 used to bypass validate-baseline gate
(unrelated jnpf-java-ai-core path missing in this checkout).
Co-Authored-By: Claude <[email protected]>