F2-4b: rewrite 规则扩展 + item 改进 + 最终批量结果

- rewrite.py: 新增 _VAADIN_EXTRA_IMPORT_RE / _DSASP_CLIENT_IMPORT_RE /
  _ENVIROMENT_GET_IMPORT_RE 三条 import 剥离规则,统一在 5.9 清理节
  运行;补多余引号修复(源数据 bug "...SQL 100"";")
- run_batch_regression.py: connect_db 优先连本地 eip4dev:5433,
  回退远程 192.168.20.68:5435
- output/rewritten/*.groovy: 规则重跑后的 rewritten 产物更新
- output/manual_workpackage/*.md: 对应工包重生成
- output/batch_regression_20260612_053253.json: 最终批跑结果
  FULL_AUTO 94.1%(476/506);删除 3 个中间产物 JSON
- docs/P1/F2-4批量回归报告.md: 最终通过率写入报告

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-06-12 05:33:41 +08:00
parent 0e3f204ec8
commit aa576ea2c6
48 changed files with 17606 additions and 232 deletions

View File

@@ -1,14 +1,8 @@
# F2-4 批量回归报告
生成时间: 2026-06-12
生成时间: 20260612_053253
测试端点: `POST http://localhost:8093/api/script/execute-template`
并发: 6,范围: FULL_AUTO(507) + NO_S3(815) = 1,322 条
item 策略: 数据库 192.168.20.68:5435 不可达,item={};结果 JSON: `tools/s3_rewriter/output/batch_regression_20260612_024512.json`(0.46 MB,已入库)
本轮含以下修复:
- **磁盘产物 patch**:17 条 FULL_AUTO 脚本的 `import com.vaadin.ui.Notification` 行批量剥离
- **改写器修复(F2-4)**:`rewrite.py` 新增 `_NOTIF_IMPORT_RE`,在 `_apply_dynamic_button` 和 `rewrite_script` 末尾统一剥离 Notification import,下次重跑改写器自动覆盖磁盘产物
- **闭包动词断言修复**:运行时 `addFieldButton` 由 ScriptFacade 捕获为 `actionType=addButton`,已修正专项断言
并发: 6,范围: FULL_AUTO(507) + NO_S3(815) = 1322 条
---
@@ -16,84 +10,73 @@ item 策略: 数据库 192.168.20.68:5435 不可达,item={};结果 JSON: `to
| 范围 | 总数 | 已排除 | 已执行 | 通过 | 失败 | 通过率 |
|------|------|--------|--------|------|------|--------|
| FULL_AUTO | 507 | 1 | 506 | 459 | 47 | **90.7%** |
| NO_S3 | 815 | 2 | 813 | 480 | 333 | **59.0%** |
| **合计** | **1,322** | 3 | **1,319** | **939** | **380** | **71.2%** |
> NO_S3 通过率低(59%)的主因是 293 条 `no_s3_page_call`(原样脚本含 `page.` 调用,预期失败);
> 去除该预期失败后 NO_S3 实际缺口仅 40 条。
| FULL_AUTO | 507 | 1 | 506 | 476 | 30 | 94.1% |
| NO_S3 | 815 | 2 | 813 | 480 | 333 | 59.0% |
| **合计** | **1322** | — | **1319** | **956** | **363** | **72.5%** |
---
## 二、失败归因分桶
| bucket | 数量 | FULL_AUTO | NO_S3 | 性质 |
|--------|------|-----------|-------|------|
| `passed` | 939 | 459 | 480 | 通过 |
| `no_s3_page_call` | 293 | 0 | 293 | **预期**:NO_S3 原样脚本含 page. 调用 |
| `excluded_write_path` | 3 | 1 | 2 | **预期**:写路径安全排除 |
| `engine_exception` | 27 | 4 | 23 | 待定:DB 访问/权限错误(item={} 或基线数据缺失) |
| `compile_error_import` | 25 | 15 | 10 | **真缺口**:legacy/vaadin import 残留 |
| `missing_property` | 10 | 10 | 0 | **部分缺口**:item={} 导致字段为 null |
| `missing_method` | 9 | 5 | 4 | **真缺口**:ScriptFacade 动词表未覆盖 |
| `script_blank_or_missing` | 8 | 2 | 6 | **部分缺口**:全注释空正文(设计内)/ 真缺文件 |
| `http_500` | 8 | 7 | 1 | **真缺口**:脚本执行触发 Spring 未捕获异常 |
**总失败 380 条分解**:
- 预期/已排除: 296 条(`no_s3_page_call` 293 + `excluded_write_path` 3)
- 待确认: 27 条(`engine_exception`,主要是 NO_S3 DB 访问,item 数据后可消除)
- 真缺口: 57 条(`compile_error_import` 25 + `missing_method` 9 + `http_500` 8 + `missing_property` 10 中的非 item 部分 + `script_blank_or_missing` 2 真缺文件)
| bucket | 数量 | 性质 |
|--------|------|------|
| `passed` | 956 | 正常 |
| `no_s3_page_call` | 293 | 预期:原样脚本,非改写产物 |
| `engine_exception` | 27 | 需人工分析 |
| `missing_property` | 13 | 部分因 item={} 导致,部分为真缺口 |
| `compile_error_import` | 12 | 真缺口:vaadin import 未剥离,需重跑改写器 |
| `http_500` | 10 | 真缺口:脚本执行导致未捕获异常 |
| `script_blank_or_missing` | 8 | 文件全注释无正文,或目录缺失 |
| `excluded_write_path` | 3 | 预期跳过,保护 e2e 基线 |
---
## 三、FULL_AUTO top 失败模式样例
### `compile_error_import`(15 条 FULL_AUTO)
- 样例: `3cf83c9f` seq=1 — `unable to resolve class com.vaadin.ui.Notification`
- 样例: `e7670207` seq=7 — `unable to resolve class com.dsasp.server.common.util.HTTPClientUtils`
- 根因:改写器已修 Notification(磁盘 patch + rewrite.py),但 `HTTPClientUtils`/`ValidationException` 等 legacy dsasp 工具类 import 仍残留;需扩展 import 剥离规则白名单
### bucket: `missing_property` (13 条)
- 样例 tid: `2fb53bc0-ec8e-425d-a75e-7369f77200cc`,seq: 2
- 错误摘要: `rw:2fb53bc0-ec8e-425d-a75e-7369f77200cc:2 --- problem evaluating script: singPropertyException: No such property: event for class: Script328`
### `missing_property`(10 条 FULL_AUTO)
- 样例: `2fac21ea` seq=3 — `No such property: map for class: Script`
- 根因:脚本用 `item.map` / `item.xxx` 访问行字段,item={} 时为 null;真实行数据后可消除
### bucket: `http_500` (9 条)
- 样例 tid: `153857ac-5d70-4dc8-882d-1b2b8027be56`,seq: 1
- 错误摘要: `Internal Server Error`
### `missing_method`(5 条 FULL_AUTO)
- 样例: `208996a7` seq=2 — `No signature of method: ScriptFacade$FieldDataSourceHandle.firstItemId()`
- 根因:ScriptFacade FieldDataSourceHandle 未暴露 `firstItemId`/`lastItemId` 等 Vaadin Container 方法
### bucket: `engine_exception` (4 条)
- 样例 tid: `2c672ea6-ee5b-4273-804b-ac0962d1fac7`,seq: 1
- 错误摘要: `未查询到当前用户的个人档案!`
### `http_500`(7 条 FULL_AUTO)
- 样例: `153857ac` seq=1 — `Internal Server Error`(`CustomSearchConditional` 导致)
- 根因:`CustomSearchConditional` 在 ScriptFacade 里被 eval 但调用链触发 DB 查询,item={} 时 NPE/空结果抛出未捕获异常
### bucket: `script_blank_or_missing` (2 条)
- 样例 tid: `1ada38ff-9e1b-4008-925e-cd129a7ed505`,seq: 1
- 错误摘要: `改写后脚本未找到: templateId=1ada38ff-9e1b-4008-925e-cd129a7ed505 seq=1`
### `engine_exception`(4 条 FULL_AUTO)
- 样例: `2c672ea6` seq=1 — `未查询到当前用户的个人档案!`
- 根因:脚本从 DB 查当前用户个人档案,eip4dev 副本无对应数据;属数据环境问题
### bucket: `compile_error_import` (2 条)
- 样例 tid: `81f2610f-5c9b-4249-98de-b07815b0842c`,seq: 2
- 错误摘要: `rw:81f2610f-5c9b-4249-98de-b07815b0842c:2 --- problem evaluating script: oovy.control.MultipleCompilationErrorsException: startup failed:
Script848.groovy: 6: unable to resolve class TableImportExpo`
---
## 四、闭包动词专项(F2-3 dynamic_button / addFieldButton)
> 运行时 `addFieldButton(field, label, closure, index)` 由 ScriptFacade 捕获为
> `actionType="addButton"` + `args.onClick=[子指令数组]` 结构。
| 模板名 | tid | seq | API通过 | closureCmd | verdict |
|--------|-----|-----|---------|------------|---------|
| 培训签到 | `75fb9a46-b87...` | 1 | True | True | **PASS** |
| 进项税发票(批量调整抵扣日期)-五建定制 | `e5a03e54-37b...` | 6 | True | True | **PASS** |
| 付款确认(五建定制) | `e7670207-9cf...` | 7 | False | False | **FAIL** |
| 销项税发票(增加审批通过后)-五建定制 | `f01c2f57-189...` | 5 | True | True | **PASS** |
| 模板名 | tid | seq | API通过 | addButton+onClick | verdict | 备注 |
|--------|-----|-----|---------|-------------------|---------|------|
| 培训签到 | `75fb9a46` | 1 | ✓ | ✓ | **PASS** | 3 commands,含 2 个 addButton+onClick |
| 进项税发票(批量调整抵扣日期)-五建定制 | `e5a03e54` | 6 | ✓ | ✓ | **PASS** | 3 commands,查询按钮 onClick 含子指令 |
| 销项税发票(增加审批通过后)-五建定制 | `f01c2f57` | 5 | ✓ | ✓ | **PASS** | 3 commands,结构同上 |
| 付款确认(五建定制) | `e7670207` | 7 | ✗ | — | **FAIL** | 含 `HTTPClientUtils` import 编译失败,非闭包动词本身问题 |
闭包动词专项通过: 3/4
**闭包动词专项: 3/4 通过**
`e7670207 seq=7` 失败根因:脚本含 `import com.dsasp.server.common.util.HTTPClientUtils`(legacy 工具类,classpath 缺失),编译阶段失败;与 `addFieldButton` 动词本身运行时实装无关。去除该 import 后可通过,属 `compile_error_import` 桶。
### commands 结构样例(培训签到 seq=1)
**培训签到** commands 样例:
```json
[
{
"actionType": "addSubTableButton",
"componentId": "SIGNDETAILS",
"args": {"target": "SELECT", "index": 0}
"args": {
"target": "SELECT",
"index": 0
}
},
{
"actionType": "addButton",
@@ -116,7 +99,7 @@ item 策略: 数据库 192.168.20.68:5435 不可达,item={};结果 JSON: `to
]
```
### commands 结构样例(进项税发票 seq=6,含子指令)
**进项税发票(批量调整抵扣日期)-五建定制** commands 样例:
```json
[
{
@@ -126,71 +109,125 @@ item 策略: 数据库 192.168.20.68:5435 不可达,item={};结果 JSON: `to
"label": "查询",
"index": 0,
"onClick": [
{"actionType": "setValue", "componentId": "TASKS", "args": {"value": null, "bind": true}},
{"actionType": "setValue", "componentId": "TASKS", "args": {"value": [], "bind": true}}
{
"actionType": "setValue",
"componentId": "TASKS",
"args": {
"value": null,
"bind": true
}
},
{
"actionType": "setValue",
"componentId": "TASKS",
"args": {
"value": [],
"bind": true
}
}
]
}
},
{"actionType": "addButton", "componentId": "TASKS", "args": {"label": "全选", "index": 1, "onClick": []}},
{"actionType": "addButton", "componentId": "TASKS", "args": {"label": "取消全选", "index": 2, "onClick": []}}
{
"actionType": "addButton",
"componentId": "TASKS",
"args": {
"label": "全选",
"index": 1,
"onClick": []
}
},
{
"actionType": "addButton",
"componentId": "TASKS",
"args": {
"label": "取消全选",
"index": 2,
"onClick": []
}
}
]
```
**销项税发票(增加审批通过后)-五建定制** commands 样例:
```json
[
{
"actionType": "addButton",
"componentId": "TASKS",
"args": {
"label": "查询",
"index": 0,
"onClick": [
{
"actionType": "setValue",
"componentId": "TASKS",
"args": {
"value": null,
"bind": true
}
},
{
"actionType": "setValue",
"componentId": "TASKS",
"args": {
"value": [],
"bind": true
}
}
]
}
},
{
"actionType": "addButton",
"componentId": "TASKS",
"args": {
"label": "全选",
"index": 1,
"onClick": []
}
},
{
"actionType": "addButton",
"componentId": "TASKS",
"args": {
"label": "取消全选",
"index": 2,
"onClick": []
}
}
]
```
---
## 五、e2e 50 基线复跑
## 五、与「全量可用」差距清单
批量回归前后各跑 1 次基线;另做专项 50 条覆盖全规则族:
| 时间点 | 通过 | 总数 | 通过率 |
|--------|------|------|--------|
| 批量前(1条抽检) | 1 | 1 | 100% |
| 批量后(1条抽检) | 1 | 1 | 100% |
| e2e 专项 50 条 | 46 | 50 | **92%** |
**50 条基线专项结果**:46/50 通过,4 条失败均属已知桶:
- `328b3366 seq=2`:`MissingPropertyException`(item={} 导致,已知 missing_property 桶)
- `2d046844 seq=3`:`MissingMethodException`(ScriptFacade 缺 firstItemId,已知 missing_method 桶)
- `2fb53bc0 seq=2`:`MissingPropertyException`(item={} 导致)
- `153857ac seq=1`:`HTTP 500`(CustomSearchConditional,已知 http_500 桶)
**结论**:e2e 基线 4 条失败全在已知缺口桶内,无新增回归,基线未受批量回归影响。
| bucket | 是否真缺口 | 数量 | 影响 |
|--------|-----------|------|------|
| `no_s3_page_call` | 否 | 293 | NO_S3 原样脚本含 page. 调用,执行失败是预期行为 |
| `engine_exception` | 待定 | 27 | EmptyResultDataAccessException/权限校验等 DB 访问错误;item 为空或基线数据缺失 |
| `missing_property` | 部分 | 13 | item={} 时 getValue 返回 null;真实行数据可消除部分;剩余为真缺口 |
| `compile_error_import` | 是 | 12 | vaadin Notification import 残留(22 条 FULL_AUTO);改写器 import 剥离规则未覆盖 Notification 类;需重跑改写器 |
| `http_500` | 是 | 10 | 脚本执行引发 Spring 未捕获异常(CustomSearchConditional 等);需改写器或 Facade 修复 |
| `script_blank_or_missing` | 部分 | 8 | 全注释空正文(原脚本仅含注释行)属设计内;真文件缺失为真缺口 |
| `excluded_write_path` | 否 | 3 | 安全排除,预期跳过 |
---
## 六、与「全量可用」差距清单
## 六、结论
| bucket | 是否真缺口 | 数量 | 行动项 |
|--------|-----------|------|--------|
| `no_s3_page_call` | **否** | 293 | NO_S3 原样脚本预期失败,不计入缺口 |
| `excluded_write_path` | **否** | 3 | 安全排除预期跳过 |
| `engine_exception` | **待定** | 27 | 主要是 NO_S3 DB 访问/用户数据缺失;提供真实 item 后重测可定量 |
| `compile_error_import` | **是** | 25 | Notification(已 patch 磁盘) + HTTPClientUtils/ValidationException 等 legacy import;改写器需扩展 import 白名单 |
| `missing_property` | **部分** | 10 | item={} 导致;真实行数据后可消除大部分 |
| `missing_method` | **是** | 9 | ScriptFacade 缺 `firstItemId`/`lastItemId`/`getContainerProperty` 等;需扩展动词表 |
| `script_blank_or_missing` | **部分** | 8 | 6 条 NO_S3 全注释属设计内;2 条 FULL_AUTO 空正文为产物缺陷 |
| `http_500` | **是** | 8 | `CustomSearchConditional` 触发 DB 查询抛异常;需 ScriptFacade mock 或改写器替换 |
**真缺口合计(需工程修复)**:42 条(25 import + 9 method + 8 http500)
---
## 七、结论
| 指标 | 数值 |
|------|------|
| FULL_AUTO 执行通过率 | **90.7%**(459/506,排除 1 条写路径) |
| NO_S3 执行通过率 | **59.0%**(480/813,293 条为预期 page. 失败) |
| NO_S3 去预期后通过率 | **92.3%**(480/520) |
| 闭包动词专项 | **3/4 通过**(1 条因 legacy import 编译失败,非闭包动词本身) |
| e2e 50 基线 | **46/50 通过**(4 条均在已知缺口桶) |
| 真缺口条目数 | **42 条**(占已执行 1,319 条的 3.2%) |
- **FULL_AUTO 执行通过率**: 94.1%(476/506 已执行,排除 1 条写路径)
- **NO_S3 执行通过率**: 59.0%(480/813 已执行,大量为预期 page. 调用失败)
- **闭包动词专项**: 3/4 通过
- **结果 JSON**: `/Users/zhengwr/workspace/eip3/eip4-platform/tools/s3_rewriter/output/batch_regression_20260612_053253.json`(若 >1MB 不入库,报告里给统计)
### 真缺口优先级
1. `compile_error_import`(25 条):改写器扩展 import 剥离白名单(HTTPClientUtils/ValidationException 等 legacy dsasp 类),重跑 `run_rewrite.py` 覆盖磁盘产物
2. `http_500`(8 条):ScriptFacade 对 `CustomSearchConditional` 等 DB 调用做 mock 或改写器替换为 `setFieldFilter`
3. `missing_method`(9 条):ScriptFacade `FieldDataSourceHandle` 补充 `firstItemId`/`lastItemId`/`size` 等方法
4. `missing_property`(10 条):提供真实 item 行数据后重测,定量分离 item 因素 vs 真缺口
5. `e7670207 seq=7` 闭包专项 FAIL:移除 HTTPClientUtils import 后重测,届时 4/4 通过
1. `compile_error_import`(32条):改写器需补全 Notification import 剥离规则,重新生成磁盘产物
2. `http_500`(8条):脚本引发 Spring 未捕获异常(CustomSearchConditional 等),需改写器或 Facade 修复
3. `missing_method`(5条):ScriptFacade 函数库覆盖缺口,需扩展动词表
4. `missing_property`(10条):部分因 item={} 导致,真实行数据后重测可定量分离
5. `engine_exception`(27条):NO_S3 DB 访问/权限错误,需分析基线数据完整性
6. `page_binding_missing`:FULL_AUTO 脚本含 page. 调用,分类规则误判,需审查
*本报告由 run_batch_regression.py 自动生成后人工补充 e2e/闭包分析 (F2-4)*
*本报告由 run_batch_regression.py 自动生成 (F2-4)*