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

@@ -447,6 +447,24 @@ _NOTIF_IMPORT_RE = re.compile(
re.MULTILINE,
)
# F2-4b 修复: 扩展 import 剥离规则
# 以下类在 EIP4 classpath 不存在,必须剥除否则 Groovy 编译失败
# 规则:Vaadin 客户端类 + com.dsasp.client.* 全剥
# com.dsasp.server.common.util.EnviromentGet 不在 platform-legacy-core,剥
# com.dsasp.server.common.dataDic.* 在 platform-legacy-core 存在,不剥
_VAADIN_EXTRA_IMPORT_RE = re.compile(
r'^[ \t]*import\s+com\.vaadin\.(?:server\.VaadinService|ui\.PopupDateField);\s*\n?',
re.MULTILINE,
)
_DSASP_CLIENT_IMPORT_RE = re.compile(
r'^[ \t]*import\s+com\.dsasp\.client\.[\w\.]+;\s*\n?',
re.MULTILINE,
)
_ENVIROMENT_GET_IMPORT_RE = re.compile(
r'^[ \t]*import\s+com\.dsasp\.server\.common\.util\.EnviromentGet;\s*\n?',
re.MULTILINE,
)
# 匹配: [final] Button VAR = new Button("文案") 或 [def/final] Button VAR = new Button("文案")
_BTN_DECL_RE = re.compile(
r'^[ \t]*(?:final\s+)?(?:def\s+)?Button\s+(\w+)\s*=\s*new\s+Button\((["\'][^"\']+["\'])\)\s*;?[ \t]*(?://[^\n]*)?\n?',
@@ -979,6 +997,13 @@ def rewrite_script(source: str) -> Tuple[str, List[RewriteDetail], str]:
"""
details: List[RewriteDetail] = []
# ── 4.9 原始脚本预处理:修复已知源数据 bug ────────────────────
# F2-4b: 原始脚本中字符串字面量末尾有多余双引号(如 "...SQL 100"";),
# 这是上游数据入库时的编码问题,会导致 Groovy 编译失败。
# 规则:只修复 非空字符串内容(不跨行)后面跟了多余 """ 的模式。
# 关键约束:[^"\n]+ 排除换行,防止跨行匹配到合法的 def sql = ""; 语句。
source = re.sub(r'("[^"\n]+)""(;)', r'\1"\2', source)
# ── 5.0 规则族2: 动态按钮家族(先于 HARD 检测运行)──────────
# new Button + addClickListener + fieldVar.addButton(btnVar, N)
# → addFieldButton("FIELD", "文案", {闭包体}, N)
@@ -1110,10 +1135,21 @@ def rewrite_script(source: str) -> Tuple[str, List[RewriteDetail], str]:
count=opt_count,
))
# ── 5.9 全局 Vaadin import 清理 ──────────────────────────
# ── 5.9 全局 Vaadin/Legacy import 清理 ──────────────────────────
# F2-4: Notification_show / dynamic_button 等规则改写后,vaadin Notification
# import 已无用;在分类前统一剥离,避免引擎编译失败。
working = _NOTIF_IMPORT_RE.sub('', working)
# F2-4b: Button/ClickEvent/ClickListener import 无条件剥除——
# dynamic_button 规则只在 new Button()+addClickListener 形态下改写并剥 import,
# 但 addButton(getField(...),N) 形态不触发改写器,其 Button import 仍残留。
# Button/ClickEvent/ClickListener 在 EIP4 classpath 不存在,统一剥除无副作用。
working = _BTN_IMPORT_RE.sub('', working)
working = _LISTENER_IMPORT_RE.sub('', working)
# F2-4b: 扩展剥离——VaadinService/PopupDateField/dsasp.client.*/EnviromentGet
# 均不在 EIP4 classpath,保留会导致 Groovy MultipleCompilationErrors
working = _VAADIN_EXTRA_IMPORT_RE.sub('', working)
working = _DSASP_CLIENT_IMPORT_RE.sub('', working)
working = _ENVIROMENT_GET_IMPORT_RE.sub('', working)
# ── 5.10 分类 ──────────────────────────────────────────────
if not _has_s3(working):