chore(e2e,docs): 新脚本的清理只删自己建的模板行(不碰演示态)+ docs/09 §8 补接线检查

This commit is contained in:
2026-10-08 14:47:11 +08:00
parent 9e78e1d239
commit db8aecc30a
2 changed files with 17 additions and 3 deletions
+9 -1
View File
@@ -242,11 +242,19 @@ XT_TENANT_DOMAIN_ENABLED=true # 如果要按域名区分单位
| 阶段 | 本地怎么验 | 结果 | | 阶段 | 本地怎么验 | 结果 |
|---|---|---| |---|---|---|
| `check` | 直接跑那三个校验脚本 + 把 CI 里的 heredoc 片段原样执行 | ✅ | | `check` | 直接跑那**五个**校验脚本(契约 / 实体列 / 文档 / 手册 / **接线**)+ 把 CI 里的 heredoc 片段原样执行 | ✅ |
| `build` | `mvn package`、`pnpm typecheck`、`pnpm build` | ✅ | | `build` | `mvn package`、`pnpm typecheck`、`pnpm build` | ✅ |
| `e2e` | 起 `test` profile 确认能起来(`check-test-profile.py`);全套 E2E 在 `dev` 上跑 | ✅ | | `e2e` | 起 `test` profile 确认能起来(`check-test-profile.py`);全套 E2E 在 `dev` 上跑 | ✅ |
| `生产环境自检` | **真的起三次 jar**(三种误配形态) | ✅ 9/9 | | `生产环境自检` | **真的起三次 jar**(三种误配形态) | ✅ 9/9 |
> **接线检查(`scripts/check-wiring.py`)为什么值得单独放一个阶段**:它查的是
> "**声明了但没接上**"(权限码没人校验、错误码没人引用、通知模板没有发送点、
> 菜单键前端没有对应项)—— 这一族错**编译 / lint / review 全都不红**,
> 只有"从入口走一遍"才暴露(F-1/F-31/F-50/F-52/F-101/F-106 都是它)。
> 它自己的假阳性也要当心:本轮修了三次(只数注解漏掉服务层、按标识符数引用被同名常量骗过、
> **注释里的提及被当成接线**)—— 所以它现在**先去 Java 注释再数**,
> 并且有意不接线的逐条写在脚本上方的例外表里(带理由),**不静默跳过**。
**本地验不到的**(要在真实 runner 上跑): **本地验不到的**(要在真实 runner 上跑):
`services:` 的容器别名解析、`apt-get`/`pip3` 在 runner 镜像里可用性、 `services:` 的容器别名解析、`apt-get`/`pip3` 在 runner 镜像里可用性、
artifacts 路径、以及**所有 shell 片段的语法**(开发机是 Windows, artifacts 路径、以及**所有 shell 片段的语法**(开发机是 Windows,
+8 -2
View File
@@ -33,6 +33,7 @@ ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
PASSED: list[str] = [] PASSED: list[str] = []
FAILED: list[tuple[str, str]] = [] FAILED: list[tuple[str, str]] = []
CREATED_TASK_IDS: list[int] = [] CREATED_TASK_IDS: list[int] = []
CREATED_TPL_IDS: list[int] = [] # 本脚本自定义过的通知模板行(清理时**只删自己建的**)
TMP_ROSTER = os.path.join(ROOT, "scripts", "_e2e-wiring-roster.xlsx") TMP_ROSTER = os.path.join(ROOT, "scripts", "_e2e-wiring-roster.xlsx")
T1 = 993801 # 班主任(初审人) T1 = 993801 # 班主任(初审人)
@@ -255,6 +256,8 @@ def main() -> int:
check("「驳回通知」可以自定义(内置 → 库里一行)", check("「驳回通知」可以自定义(内置 → 库里一行)",
bool(tpl.get("id")) and tpl.get("customized") is True, bool(tpl.get("id")) and tpl.get("customized") is True,
json.dumps(tpl, ensure_ascii=False)[:200]) json.dumps(tpl, ensure_ascii=False)[:200])
if tpl.get("id"):
CREATED_TPL_IDS.append(tpl["id"])
new_title = f"【E2E改过】材料要重传 {suffix}" new_title = f"【E2E改过】材料要重传 {suffix}"
new_content = "【E2E改过】{姓名} 的《{任务名}》被退回:{驳回原因}。涉及:{材料名}" new_content = "【E2E改过】{姓名} 的《{任务名}》被退回:{驳回原因}。涉及:{材料名}"
body_of("PUT", f"/api/v1/notify/templates/{tpl.get('id')}", at, body_of("PUT", f"/api/v1/notify/templates/{tpl.get('id')}", at,
@@ -502,8 +505,11 @@ def cleanup() -> None:
R.sql(f"delete from collect_material_def where task_id={tid};") R.sql(f"delete from collect_material_def where task_id={tid};")
R.sql(f"delete from collect_form_schema where task_id={tid};") R.sql(f"delete from collect_form_schema where task_id={tid};")
R.sql(f"delete from collect_task where id={tid};") R.sql(f"delete from collect_task where id={tid};")
# 模板的覆盖行:删掉 = 恢复内置(**不能留**,否则后面的脚本会读到改过的文案) # 模板的覆盖行:**只删本脚本建的那几行**(删掉 = 恢复内置)。
R.sql("delete from collect_notify_template where tenant_id=1;") # ⚠️ 不能写成 `delete from collect_notify_template where tenant_id=1` ——
# 那会把演示态里别人改过的模板一起删掉(而"演示态不能被脚本弄坏"是这个仓库的硬约束)。
for tid in CREATED_TPL_IDS:
R.sql(f"delete from collect_notify_template where id={tid};")
# 本脚本造的学生/申请人/班主任 # 本脚本造的学生/申请人/班主任
R.sql(f"delete from collect_message where user_id in " R.sql(f"delete from collect_message where user_id in "
f"({S1}, {S2}, {S3}, {JOINER}, 993815, {T1});") f"({S1}, {S2}, {S3}, {JOINER}, 993815, {T1});")