bpmax-cli 0.2.1-beta.52 → 0.2.1-beta.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +13319 -4654
- package/dist/bin.js.map +1 -1
- package/package.json +1 -1
- package/scripts/install-skills.mjs +25 -59
- package/skills/bpmax-ai-taskbook/SKILL.md +10 -0
- package/skills/bpmax-ai-taskbook/references/blueprint-taskbook-gates.md +120 -0
- package/skills/bpmax-ai-taskbook/references/taskbook-template.md +41 -1
- package/skills/bpmax-blueprint-doc-workflow/SKILL.md +15 -2
- package/skills/bpmax-blueprint-doc-workflow/references/blueprint-structure.md +8 -0
- package/skills/bpmax-blueprint-doc-workflow/references/per-flow-required-structure.md +13 -0
- package/skills/bpmax-blueprint-doc-workflow/references/sample-missing-modeling-review.xml +23 -0
- package/skills/bpmax-blueprint-doc-workflow/references/sample-paragraph-flow-details.xml +27 -0
- package/skills/bpmax-blueprint-doc-workflow/references/sample-pass.xml +45 -28
- package/skills/bpmax-blueprint-doc-workflow/references/source-traceability-and-flow-modeling.md +115 -0
- package/skills/bpmax-blueprint-doc-workflow/scripts/lint_blueprint_doc.py +386 -5
- package/skills/bpmax-e2e-flow-test-operator/SKILL.md +48 -27
- package/skills/bpmax-e2e-flow-test-operator/references/ai-test-suite.md +41 -17
- package/skills/bpmax-e2e-flow-test-operator/references/browser-action-dsl.md +71 -9
- package/skills/bpmax-e2e-flow-test-operator/references/browser-only-checkpoints.md +2 -1
- package/skills/bpmax-e2e-flow-test-operator/references/full-detail-guide.md +25 -12
- package/skills/bpmax-e2e-flow-test-operator/references/minimal-test-loop.md +11 -9
- package/skills/bpmax-e2e-flow-test-operator-v2/SKILL.md +56 -0
- package/skills/bpmax-e2e-flow-test-operator-v2/agents/openai.yaml +7 -0
- package/skills/bpmax-e2e-flow-test-operator-v2/references/automation-generation-pipeline.md +33 -0
- package/skills/bpmax-e2e-flow-test-operator-v2/references/batch-generation-and-execution.md +17 -0
- package/skills/bpmax-e2e-flow-test-operator-v2/references/browser-action-runner.md +15 -0
- package/skills/bpmax-e2e-flow-test-operator-v2/references/browser-recording-and-replay.md +69 -0
- package/skills/bpmax-e2e-flow-test-operator-v2/references/form-script-generation.md +41 -0
- package/skills/bpmax-e2e-flow-test-operator-v2/references/identity-and-failure-routing.md +74 -0
- package/skills/bpmax-e2e-flow-test-operator-v2/references/multi-request-mutation.md +9 -0
- package/skills/bpmax-e2e-flow-test-operator-v2/references/scenario-coverage-generation.md +17 -0
- package/skills/bpmax-e2e-flow-test-operator-v2/references/scoped-execution.md +13 -0
- package/skills/bpmax-e2e-flow-test-operator-v2/references/step-restartability-and-state.md +17 -0
- package/skills/bpmax-e2e-flow-test-operator-v2/references/test-assets-and-evidence.md +9 -0
- package/skills/bpmax-e2e-flow-test-operator-v2/references/test-data-and-selector-contract.md +28 -0
- package/skills/bpmax-e2e-flow-test-operator-v2/references/test-preflight-and-confirmation.md +32 -0
- package/skills/bpmax-user-mock-operator/scripts/chrome_identity_bridge.mjs +79 -12
|
@@ -52,6 +52,67 @@ AI_FORBIDDEN_PATTERNS = [
|
|
|
52
52
|
r"AI[^。;\n]{0,30}自动认证",
|
|
53
53
|
r"AI[^。;\n]{0,30}自动对账",
|
|
54
54
|
]
|
|
55
|
+
DOCUMENT_MODELING_TABLES = {
|
|
56
|
+
"源流程逻辑映射与完整性核对": ["源流程逻辑映射与完整性核对"],
|
|
57
|
+
"人工调整记录": ["人工调整记录"],
|
|
58
|
+
"主流程阶段划分": ["主流程阶段划分"],
|
|
59
|
+
"并行场景建模决策": ["并行场景建模决策"],
|
|
60
|
+
"审批/决策矩阵评估": ["审批/决策矩阵评估", "审批与决策矩阵评估"],
|
|
61
|
+
}
|
|
62
|
+
FLOW_DETAIL_TABLES = {
|
|
63
|
+
"开始节点与创建表单": ["开始节点与创建表单", "开始节点", "创建表单"],
|
|
64
|
+
"环节配置": ["环节配置", "节点配置"],
|
|
65
|
+
"表单模板": ["表单模板"],
|
|
66
|
+
"流程数据集": ["流程数据集", "数据集"],
|
|
67
|
+
"列表/筛选/详情/看板入口": ["列表/筛选/详情/看板入口", "列表", "视图入口"],
|
|
68
|
+
"自动化与 AI/agent": ["自动化与 AI/agent", "自动化与 AI", "自动化"],
|
|
69
|
+
"办结口径与下游联动": ["办结口径与下游联动", "办结口径", "下游联动"],
|
|
70
|
+
"BPMAX 实现边界": ["BPMAX 实现边界", "实现边界"],
|
|
71
|
+
}
|
|
72
|
+
MATRIX_ASSESSMENT_TERMS = ["蓝图规则矩阵", "正式 BPMAX 矩阵"]
|
|
73
|
+
MATRIX_HEADER_RULES = {
|
|
74
|
+
"决策范围": ["决策范围", "决策"],
|
|
75
|
+
"条件": ["条件", "判断条件"],
|
|
76
|
+
"处理人/审批人来源": ["处理人/审批人来源", "处理人来源", "审批人来源", "人员来源"],
|
|
77
|
+
"结果/下一步": ["结果/下一步", "结果", "下一步"],
|
|
78
|
+
"维护责任人": ["维护责任人", "维护角色", "维护人"],
|
|
79
|
+
"蓝图规则矩阵": ["蓝图规则矩阵"],
|
|
80
|
+
"正式 BPMAX 矩阵": ["正式 BPMAX 矩阵"],
|
|
81
|
+
"运行态验收": ["运行态验收", "验收"],
|
|
82
|
+
}
|
|
83
|
+
FORMAL_MATRIX_RUNTIME_TERMS = {
|
|
84
|
+
"矩阵应用": ["矩阵应用"],
|
|
85
|
+
"规则记录": ["规则记录", "矩阵规则"],
|
|
86
|
+
"真实用户": ["真实用户", "BPMAX 用户"],
|
|
87
|
+
"消费节点": ["消费节点", "使用节点", "引用节点"],
|
|
88
|
+
"缺失规则": ["缺失", "未命中"],
|
|
89
|
+
"重复规则": ["重复", "多条命中"],
|
|
90
|
+
"readback": ["readback", "回读"],
|
|
91
|
+
"owner resolve": ["owner resolve", "owner-resolve", "处理人解析", "owner 解析"],
|
|
92
|
+
}
|
|
93
|
+
NAVIGATION_SECTION_TITLES = ["PC/H5 导航设计", "多端导航设计", "导航设计"]
|
|
94
|
+
NAVIGATION_HEADER_RULES = {
|
|
95
|
+
"流程": ["流程"],
|
|
96
|
+
"终端": ["终端", "端"],
|
|
97
|
+
"目标用户": ["目标用户", "用户", "角色"],
|
|
98
|
+
"入口/菜单": ["入口/菜单", "入口", "菜单"],
|
|
99
|
+
"路由/页面": ["路由/页面", "路由", "页面"],
|
|
100
|
+
"可见权限": ["可见权限", "显示权限", "权限"],
|
|
101
|
+
"验收": ["验收", "验收方式"],
|
|
102
|
+
}
|
|
103
|
+
PERMISSION_SECTION_TITLES = ["权限设计", "权限模型", "权限与可见性设计"]
|
|
104
|
+
PERMISSION_HEADER_RULES = {
|
|
105
|
+
"流程": ["流程"],
|
|
106
|
+
"对象/字段": ["对象/字段", "对象", "字段"],
|
|
107
|
+
"环节": ["环节", "节点", "阶段"],
|
|
108
|
+
"用户/角色": ["用户/角色", "用户", "角色", "主体"],
|
|
109
|
+
"可见": ["可见", "可见性"],
|
|
110
|
+
"可编辑": ["可编辑", "编辑性"],
|
|
111
|
+
"操作权限": ["操作权限", "动作权限", "权限动作"],
|
|
112
|
+
"验收": ["验收", "验收方式"],
|
|
113
|
+
}
|
|
114
|
+
PERMISSION_ACTION_TERMS = ["创建", "查看", "编辑", "删除", "提交", "审批", "导航"]
|
|
115
|
+
PERMISSION_DENY_TERMS = ["禁止", "不可", "无权限", "隐藏", "只读", "不适用"]
|
|
55
116
|
|
|
56
117
|
|
|
57
118
|
@dataclass
|
|
@@ -71,6 +132,12 @@ class FlowSection:
|
|
|
71
132
|
missing: list[str] = field(default_factory=list)
|
|
72
133
|
|
|
73
134
|
|
|
135
|
+
@dataclass
|
|
136
|
+
class TableData:
|
|
137
|
+
headers: list[str]
|
|
138
|
+
rows: list[dict[str, str]]
|
|
139
|
+
|
|
140
|
+
|
|
74
141
|
def read_content(path: Path) -> str:
|
|
75
142
|
raw = path.read_text(encoding="utf-8")
|
|
76
143
|
stripped = raw.lstrip()
|
|
@@ -113,19 +180,122 @@ def extract_title(xml: str) -> str:
|
|
|
113
180
|
return plain_text(match.group(1)).strip() if match else ""
|
|
114
181
|
|
|
115
182
|
|
|
183
|
+
def extract_heading_sections(xml: str) -> list[tuple[int, str, str]]:
|
|
184
|
+
heading_re = re.compile(r"<h([1-3])[^>]*>(.*?)</h\1>", re.S)
|
|
185
|
+
matches = list(heading_re.finditer(xml))
|
|
186
|
+
sections: list[tuple[int, str, str]] = []
|
|
187
|
+
for index, match in enumerate(matches):
|
|
188
|
+
level = int(match.group(1))
|
|
189
|
+
title = plain_text(match.group(2)).strip()
|
|
190
|
+
end = len(xml)
|
|
191
|
+
for next_match in matches[index + 1 :]:
|
|
192
|
+
if int(next_match.group(1)) <= level:
|
|
193
|
+
end = next_match.start()
|
|
194
|
+
break
|
|
195
|
+
sections.append((level, title, xml[match.start() : end]))
|
|
196
|
+
return sections
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
def matching_sections(xml: str, title_terms: Iterable[str]) -> list[str]:
|
|
200
|
+
return [
|
|
201
|
+
content
|
|
202
|
+
for _, title, content in extract_heading_sections(xml)
|
|
203
|
+
if any(term in title for term in title_terms)
|
|
204
|
+
]
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
def extract_tables(xml: str) -> list[TableData]:
|
|
208
|
+
tables: list[TableData] = []
|
|
209
|
+
for table_match in re.finditer(r"<table\b[^>]*>(.*?)</table>", xml, re.I | re.S):
|
|
210
|
+
parsed_rows: list[list[str]] = []
|
|
211
|
+
row_cell_tags: list[list[str]] = []
|
|
212
|
+
for row_match in re.finditer(r"<tr\b[^>]*>(.*?)</tr>", table_match.group(1), re.I | re.S):
|
|
213
|
+
cells: list[str] = []
|
|
214
|
+
tags: list[str] = []
|
|
215
|
+
for cell_match in re.finditer(r"<(th|td)\b[^>]*>(.*?)</\1>", row_match.group(1), re.I | re.S):
|
|
216
|
+
tags.append(cell_match.group(1).lower())
|
|
217
|
+
cells.append(plain_text(cell_match.group(2)).strip())
|
|
218
|
+
if cells:
|
|
219
|
+
parsed_rows.append(cells)
|
|
220
|
+
row_cell_tags.append(tags)
|
|
221
|
+
if not parsed_rows:
|
|
222
|
+
continue
|
|
223
|
+
header_index = 0
|
|
224
|
+
for index, tags in enumerate(row_cell_tags):
|
|
225
|
+
if tags and all(tag == "th" for tag in tags):
|
|
226
|
+
header_index = index
|
|
227
|
+
break
|
|
228
|
+
headers = parsed_rows[header_index]
|
|
229
|
+
rows: list[dict[str, str]] = []
|
|
230
|
+
for cells in parsed_rows[header_index + 1 :]:
|
|
231
|
+
rows.append({header: cells[index] if index < len(cells) else "" for index, header in enumerate(headers)})
|
|
232
|
+
tables.append(TableData(headers=headers, rows=rows))
|
|
233
|
+
return tables
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
def header_name(table: TableData, aliases: Iterable[str]) -> str | None:
|
|
237
|
+
for header in table.headers:
|
|
238
|
+
normalized = re.sub(r"\s+", "", header).lower()
|
|
239
|
+
for alias in aliases:
|
|
240
|
+
expected = re.sub(r"\s+", "", alias).lower()
|
|
241
|
+
if normalized == expected or expected in normalized:
|
|
242
|
+
return header
|
|
243
|
+
return None
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
def row_value(row: dict[str, str], table: TableData, aliases: Iterable[str]) -> str:
|
|
247
|
+
header = header_name(table, aliases)
|
|
248
|
+
return row.get(header, "").strip() if header else ""
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
def is_placeholder(value: str) -> bool:
|
|
252
|
+
normalized = value.strip().strip("<>")
|
|
253
|
+
return normalized in {"", "-", "待填写", "待确认", "待补充", "未知"}
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
def flow_business_name(title: str) -> str:
|
|
257
|
+
parts = re.split(r"[::]", title, maxsplit=1)
|
|
258
|
+
return parts[1].strip() if len(parts) > 1 else title.strip()
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
def row_mentions_flow(row: dict[str, str], table: TableData, flow: FlowSection) -> bool:
|
|
262
|
+
flow_value = row_value(row, table, ["流程"])
|
|
263
|
+
return flow.title in flow_value or flow_business_name(flow.title) in flow_value
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
def require_table_headers(
|
|
267
|
+
findings: list[Finding],
|
|
268
|
+
table: TableData,
|
|
269
|
+
rules: dict[str, list[str]],
|
|
270
|
+
code: str,
|
|
271
|
+
label: str,
|
|
272
|
+
) -> bool:
|
|
273
|
+
ok = True
|
|
274
|
+
for required, aliases in rules.items():
|
|
275
|
+
if header_name(table, aliases) is None:
|
|
276
|
+
add_error(findings, code, f"{label} table is missing required header: {required}")
|
|
277
|
+
ok = False
|
|
278
|
+
return ok
|
|
279
|
+
|
|
280
|
+
|
|
116
281
|
def extract_flows(xml: str) -> list[FlowSection]:
|
|
117
282
|
heading_re = re.compile(r"<h([1-3])[^>]*>(.*?)</h\1>", re.S)
|
|
118
283
|
matches = list(heading_re.finditer(xml))
|
|
119
|
-
flow_matches = []
|
|
120
|
-
for match in matches:
|
|
284
|
+
flow_matches: list[tuple[int, re.Match[str], str]] = []
|
|
285
|
+
for match_index, match in enumerate(matches):
|
|
121
286
|
title = plain_text(match.group(2)).strip()
|
|
122
287
|
if re.search(r"流程[一二三四五六七八九十\d]+[::]", title):
|
|
123
|
-
flow_matches.append((match, title))
|
|
288
|
+
flow_matches.append((match_index, match, title))
|
|
124
289
|
|
|
125
290
|
flows = []
|
|
126
|
-
for
|
|
291
|
+
for match_index, match, title in flow_matches:
|
|
127
292
|
start = match.start()
|
|
128
|
-
|
|
293
|
+
level = int(match.group(1))
|
|
294
|
+
end = len(xml)
|
|
295
|
+
for next_match in matches[match_index + 1 :]:
|
|
296
|
+
if int(next_match.group(1)) <= level:
|
|
297
|
+
end = next_match.start()
|
|
298
|
+
break
|
|
129
299
|
content = xml[start:end]
|
|
130
300
|
flows.append(
|
|
131
301
|
FlowSection(
|
|
@@ -142,6 +312,161 @@ def add_error(findings: list[Finding], code: str, message: str, flow: str | None
|
|
|
142
312
|
findings.append(Finding("error", code, message, flow))
|
|
143
313
|
|
|
144
314
|
|
|
315
|
+
def validate_matrix_design(findings: list[Finding], sections: list[str]) -> None:
|
|
316
|
+
if not sections:
|
|
317
|
+
return
|
|
318
|
+
tables = extract_tables(" ".join(sections))
|
|
319
|
+
if not tables:
|
|
320
|
+
return
|
|
321
|
+
table = tables[0]
|
|
322
|
+
if not require_table_headers(
|
|
323
|
+
findings,
|
|
324
|
+
table,
|
|
325
|
+
MATRIX_HEADER_RULES,
|
|
326
|
+
"DOC_MATRIX_HEADER_MISSING",
|
|
327
|
+
"Approval/decision matrix assessment",
|
|
328
|
+
):
|
|
329
|
+
return
|
|
330
|
+
if not table.rows:
|
|
331
|
+
add_error(findings, "DOC_MATRIX_ROW_MISSING", "Approval/decision matrix assessment requires at least one rule row.")
|
|
332
|
+
return
|
|
333
|
+
section_text = plain_text(" ".join(sections))
|
|
334
|
+
for row_index, row in enumerate(table.rows, start=1):
|
|
335
|
+
for required, aliases in MATRIX_HEADER_RULES.items():
|
|
336
|
+
if is_placeholder(row_value(row, table, aliases)):
|
|
337
|
+
add_error(
|
|
338
|
+
findings,
|
|
339
|
+
"DOC_MATRIX_VALUE_MISSING",
|
|
340
|
+
f"Approval/decision matrix row {row_index} has no concrete value for: {required}",
|
|
341
|
+
)
|
|
342
|
+
formal_value = row_value(row, table, MATRIX_HEADER_RULES["正式 BPMAX 矩阵"])
|
|
343
|
+
formal_selected = bool(formal_value) and not re.search(r"不采用|不使用|不需要|否|无|不适用", formal_value)
|
|
344
|
+
if formal_selected:
|
|
345
|
+
for label, terms in FORMAL_MATRIX_RUNTIME_TERMS.items():
|
|
346
|
+
if not has_any(section_text, terms):
|
|
347
|
+
add_error(
|
|
348
|
+
findings,
|
|
349
|
+
"DOC_FORMAL_MATRIX_LIFECYCLE_MISSING",
|
|
350
|
+
f"Formal BPMAX matrix design is missing runtime lifecycle detail: {label}",
|
|
351
|
+
)
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
def validate_navigation_design(findings: list[Finding], xml: str, flows: list[FlowSection]) -> None:
|
|
355
|
+
sections = matching_sections(xml, NAVIGATION_SECTION_TITLES)
|
|
356
|
+
if not sections:
|
|
357
|
+
add_error(findings, "DOC_NAVIGATION_DESIGN_MISSING", "Missing required PC/H5 navigation design section.")
|
|
358
|
+
return
|
|
359
|
+
tables = extract_tables(" ".join(sections))
|
|
360
|
+
if not tables:
|
|
361
|
+
add_error(findings, "DOC_NAVIGATION_TABLE_MISSING", "PC/H5 navigation design must be presented as a table.")
|
|
362
|
+
return
|
|
363
|
+
table = tables[0]
|
|
364
|
+
if not require_table_headers(
|
|
365
|
+
findings,
|
|
366
|
+
table,
|
|
367
|
+
NAVIGATION_HEADER_RULES,
|
|
368
|
+
"DOC_NAVIGATION_HEADER_MISSING",
|
|
369
|
+
"PC/H5 navigation design",
|
|
370
|
+
):
|
|
371
|
+
return
|
|
372
|
+
if not table.rows:
|
|
373
|
+
add_error(findings, "DOC_NAVIGATION_ROW_MISSING", "PC/H5 navigation design requires at least one row.")
|
|
374
|
+
return
|
|
375
|
+
for row_index, row in enumerate(table.rows, start=1):
|
|
376
|
+
terminal = row_value(row, table, NAVIGATION_HEADER_RULES["终端"])
|
|
377
|
+
if "PC" in terminal.upper() and "H5" in terminal.upper():
|
|
378
|
+
add_error(
|
|
379
|
+
findings,
|
|
380
|
+
"DOC_NAVIGATION_TERMINAL_COMBINED",
|
|
381
|
+
f"Navigation row {row_index} combines PC and H5; design them as separate rows.",
|
|
382
|
+
)
|
|
383
|
+
for required, aliases in NAVIGATION_HEADER_RULES.items():
|
|
384
|
+
if is_placeholder(row_value(row, table, aliases)):
|
|
385
|
+
add_error(
|
|
386
|
+
findings,
|
|
387
|
+
"DOC_NAVIGATION_VALUE_MISSING",
|
|
388
|
+
f"Navigation row {row_index} has no concrete value for: {required}",
|
|
389
|
+
)
|
|
390
|
+
for flow in flows:
|
|
391
|
+
rows = [row for row in table.rows if row_mentions_flow(row, table, flow)]
|
|
392
|
+
if not rows:
|
|
393
|
+
add_error(
|
|
394
|
+
findings,
|
|
395
|
+
"FLOW_NAVIGATION_COVERAGE_MISSING",
|
|
396
|
+
"Navigation design has no row for this flow.",
|
|
397
|
+
flow.title,
|
|
398
|
+
)
|
|
399
|
+
continue
|
|
400
|
+
terminals = [row_value(row, table, NAVIGATION_HEADER_RULES["终端"]).upper() for row in rows]
|
|
401
|
+
if not any("PC" in terminal and "H5" not in terminal for terminal in terminals):
|
|
402
|
+
add_error(findings, "FLOW_PC_NAVIGATION_MISSING", "Flow has no independent PC navigation design.", flow.title)
|
|
403
|
+
if not any("H5" in terminal and "PC" not in terminal for terminal in terminals):
|
|
404
|
+
add_error(findings, "FLOW_H5_NAVIGATION_MISSING", "Flow has no independent H5 navigation design or explicit H5 non-applicability row.", flow.title)
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
def validate_permission_design(findings: list[Finding], xml: str, flows: list[FlowSection]) -> None:
|
|
408
|
+
sections = matching_sections(xml, PERMISSION_SECTION_TITLES)
|
|
409
|
+
if not sections:
|
|
410
|
+
add_error(findings, "DOC_PERMISSION_DESIGN_MISSING", "Missing required permission design section.")
|
|
411
|
+
return
|
|
412
|
+
tables = extract_tables(" ".join(sections))
|
|
413
|
+
if not tables:
|
|
414
|
+
add_error(findings, "DOC_PERMISSION_TABLE_MISSING", "Permission design must be presented as a table.")
|
|
415
|
+
return
|
|
416
|
+
table = tables[0]
|
|
417
|
+
if not require_table_headers(
|
|
418
|
+
findings,
|
|
419
|
+
table,
|
|
420
|
+
PERMISSION_HEADER_RULES,
|
|
421
|
+
"DOC_PERMISSION_HEADER_MISSING",
|
|
422
|
+
"Permission design",
|
|
423
|
+
):
|
|
424
|
+
return
|
|
425
|
+
if not table.rows:
|
|
426
|
+
add_error(findings, "DOC_PERMISSION_ROW_MISSING", "Permission design requires at least one row.")
|
|
427
|
+
return
|
|
428
|
+
for row_index, row in enumerate(table.rows, start=1):
|
|
429
|
+
for required, aliases in PERMISSION_HEADER_RULES.items():
|
|
430
|
+
if is_placeholder(row_value(row, table, aliases)):
|
|
431
|
+
add_error(
|
|
432
|
+
findings,
|
|
433
|
+
"DOC_PERMISSION_VALUE_MISSING",
|
|
434
|
+
f"Permission row {row_index} has no concrete value for: {required}",
|
|
435
|
+
)
|
|
436
|
+
for flow in flows:
|
|
437
|
+
rows = [row for row in table.rows if row_mentions_flow(row, table, flow)]
|
|
438
|
+
if not rows:
|
|
439
|
+
add_error(findings, "FLOW_PERMISSION_COVERAGE_MISSING", "Permission design has no row for this flow.", flow.title)
|
|
440
|
+
continue
|
|
441
|
+
row_text = plain_text(" ".join(" ".join(row.values()) for row in rows))
|
|
442
|
+
action_text = " ".join(
|
|
443
|
+
row_value(row, table, PERMISSION_HEADER_RULES["操作权限"])
|
|
444
|
+
for row in rows
|
|
445
|
+
)
|
|
446
|
+
for action in PERMISSION_ACTION_TERMS:
|
|
447
|
+
if action not in action_text:
|
|
448
|
+
add_error(
|
|
449
|
+
findings,
|
|
450
|
+
"FLOW_PERMISSION_ACTION_MISSING",
|
|
451
|
+
f"Permission design does not explicitly cover action: {action}",
|
|
452
|
+
flow.title,
|
|
453
|
+
)
|
|
454
|
+
if "字段" not in row_text:
|
|
455
|
+
add_error(
|
|
456
|
+
findings,
|
|
457
|
+
"FLOW_FIELD_PERMISSION_MISSING",
|
|
458
|
+
"Permission design does not include field visibility/editability for this flow.",
|
|
459
|
+
flow.title,
|
|
460
|
+
)
|
|
461
|
+
if not has_any(row_text, PERMISSION_DENY_TERMS):
|
|
462
|
+
add_error(
|
|
463
|
+
findings,
|
|
464
|
+
"FLOW_PERMISSION_DENY_BOUNDARY_MISSING",
|
|
465
|
+
"Permission design does not state the denied or read-only behavior for unauthorized users.",
|
|
466
|
+
flow.title,
|
|
467
|
+
)
|
|
468
|
+
|
|
469
|
+
|
|
145
470
|
def lint(xml: str, require_terms: list[str], forbid_terms: list[str]) -> tuple[list[Finding], list[FlowSection]]:
|
|
146
471
|
findings: list[Finding] = []
|
|
147
472
|
text = plain_text(xml)
|
|
@@ -170,9 +495,45 @@ def lint(xml: str, require_terms: list[str], forbid_terms: list[str]) -> tuple[l
|
|
|
170
495
|
if re.search(r"<pre[^>]*lang=[\"']mermaid[\"']", xml, re.I):
|
|
171
496
|
add_error(findings, "MERMAID_CODE_BLOCK", "Final blueprint must use whiteboard blocks, not Mermaid code blocks.")
|
|
172
497
|
|
|
498
|
+
first_flow_start: int | None = None
|
|
499
|
+
for _, title, section in extract_heading_sections(xml):
|
|
500
|
+
if re.search(r"流程[一二三四五六七八九十\d]+[::]", title):
|
|
501
|
+
first_flow_start = xml.find(section)
|
|
502
|
+
break
|
|
503
|
+
document_design = xml[:first_flow_start] if first_flow_start is not None else xml
|
|
504
|
+
|
|
505
|
+
for label, title_terms in DOCUMENT_MODELING_TABLES.items():
|
|
506
|
+
sections = matching_sections(document_design, title_terms)
|
|
507
|
+
if not sections:
|
|
508
|
+
add_error(
|
|
509
|
+
findings,
|
|
510
|
+
"DOC_MODELING_REVIEW_MISSING",
|
|
511
|
+
f"Missing required blueprint modeling review section: {label}",
|
|
512
|
+
)
|
|
513
|
+
continue
|
|
514
|
+
if not any(re.search(r"<table\b", section, re.I) for section in sections):
|
|
515
|
+
add_error(
|
|
516
|
+
findings,
|
|
517
|
+
"DOC_MODELING_TABLE_MISSING",
|
|
518
|
+
f"Blueprint modeling review must be presented as a table: {label}",
|
|
519
|
+
)
|
|
520
|
+
|
|
521
|
+
matrix_sections = matching_sections(document_design, DOCUMENT_MODELING_TABLES["审批/决策矩阵评估"])
|
|
522
|
+
matrix_text = plain_text(" ".join(matrix_sections))
|
|
523
|
+
for term in MATRIX_ASSESSMENT_TERMS:
|
|
524
|
+
if matrix_sections and term not in matrix_text:
|
|
525
|
+
add_error(
|
|
526
|
+
findings,
|
|
527
|
+
"DOC_MATRIX_BOUNDARY_MISSING",
|
|
528
|
+
f"Approval/decision matrix assessment must distinguish: {term}",
|
|
529
|
+
)
|
|
530
|
+
validate_matrix_design(findings, matrix_sections)
|
|
531
|
+
|
|
173
532
|
flows = extract_flows(xml)
|
|
174
533
|
if not flows:
|
|
175
534
|
add_error(findings, "FLOW_SECTION_MISSING", "No flow sections matching 流程X: were found.")
|
|
535
|
+
validate_navigation_design(findings, xml, flows)
|
|
536
|
+
validate_permission_design(findings, xml, flows)
|
|
176
537
|
|
|
177
538
|
for flow in flows:
|
|
178
539
|
flow_text = plain_text(flow.content)
|
|
@@ -188,6 +549,26 @@ def lint(xml: str, require_terms: list[str], forbid_terms: list[str]) -> tuple[l
|
|
|
188
549
|
add_error(findings, "FLOW_REQUIRED_CONTENT_MISSING", f"Missing per-flow content: {label}", flow.title)
|
|
189
550
|
flow.missing.append(label)
|
|
190
551
|
|
|
552
|
+
for label, title_terms in FLOW_DETAIL_TABLES.items():
|
|
553
|
+
sections = matching_sections(flow.content, title_terms)
|
|
554
|
+
if not sections:
|
|
555
|
+
add_error(
|
|
556
|
+
findings,
|
|
557
|
+
"FLOW_DETAIL_SECTION_MISSING",
|
|
558
|
+
f"Missing per-flow detail section required for tabular implementation: {label}",
|
|
559
|
+
flow.title,
|
|
560
|
+
)
|
|
561
|
+
flow.missing.append(f"{label} section")
|
|
562
|
+
continue
|
|
563
|
+
if not any(re.search(r"<table\b", section, re.I) for section in sections):
|
|
564
|
+
add_error(
|
|
565
|
+
findings,
|
|
566
|
+
"FLOW_DETAIL_TABLE_MISSING",
|
|
567
|
+
f"Per-flow implementation detail must be presented as a table: {label}",
|
|
568
|
+
flow.title,
|
|
569
|
+
)
|
|
570
|
+
flow.missing.append(f"{label} table")
|
|
571
|
+
|
|
191
572
|
if "AI" in flow_text or "agent" in flow_text or "Agent" in flow_text:
|
|
192
573
|
for term in AI_REQUIRED_TERMS:
|
|
193
574
|
if term not in flow_text:
|
|
@@ -22,38 +22,49 @@ description: "用于在 BPMAX 中做全链路流程测试、场景回归、前
|
|
|
22
22
|
- 所有确认的体验问题都属于 `BUG`,不得改写成建议、观察或美化项规避门禁。未解决 P0/P1 UX BUG 要求总结果 `fail`;只有未解决 P2/P3 时使用 `pass-with-warnings`;无未解决 UX BUG 且其他门禁通过才允许 `pass`。`verified` 必须有晚于原始证据的本轮复测证据。
|
|
23
23
|
- 每轮必须在报告目录写 `ux-findings.json`,并在场景报告写双 skill 元数据、UX 审计状态和 P0-P3 数量。
|
|
24
24
|
- 任何完整结论前必须运行 `bpmax-cli test-suite lint-report --root .ai_test/report/<run> --format json`,保留返回的功能设计、UX 审计和 BUG 数量汇总。
|
|
25
|
+
- `e2e scenario execute` 返回 `status=functional_complete` 只表示用例步骤和运行证据已完成,不表示正式 E2E 已通过;UX 审计和 `lint-report` 尚未通过时,必须保持 `formal_result=partial`、`formal_conclusion_ready=false`。
|
|
25
26
|
|
|
26
27
|
## 真实页面原则
|
|
27
|
-
-
|
|
28
|
+
- 线上完整链路必须在真实运行页完成发起、填单、选择、提交、审批、驳回、回退等关键用户动作;稳定步骤应由确定性浏览器脚本驱动真实页面,禁止控制台改状态、手改 request body 或接口直调绕过界面。
|
|
28
29
|
- 脚本和接口可用于摸底、状态记录、接口回读、证据补充、首次抓请求骨架;即使用户明确接受“非页面路径”,也只能输出降级/诊断结论,不得写完整 E2E 通过。
|
|
29
30
|
- 页面报错、白屏、字段不渲染或按钮不可用时,第一步检查浏览器 Console 和 Network;优先定位 `form_template`、控件渲染、`lambda`、`customeValidate`、`sub_form`,再查流程、权限、数据或缓存。
|
|
30
|
-
-
|
|
31
|
+
- 首次脚本编译前的只读探索、`cache_stale`、未支持控件或执行异常时,必须优先读取并使用 `chrome:control-chrome`,复用用户当前 Chrome 的标签页、登录态和扩展能力完成页面结构探索与诊断;正式 run 创建前不得提交、审批、驳回或执行其他业务 mutation,不得默认先切到 Chrome DevTools、独立 Playwright 或接口脚本。
|
|
31
32
|
- `chrome:control-chrome` 不可用,或按其浏览器连接/Chrome 扩展排障流程处理后仍失败时,才允许降级到 Chrome DevTools;Chrome DevTools 再出现 `Network.enable timed out`、快照不可用或页面通道挂住时,才允许切换到 AppleScript。AppleScript 只能做 DOM 读取、按钮点击、输入、截图和页面提交,不得改用接口直调替代页面动作。
|
|
32
33
|
- H5 测试必须打开 `/m/#/...`,页面 viewport 设为 `412x844`;只调 viewport,不调浏览器外层窗口尺寸。
|
|
33
34
|
- 多角色页面测试使用 [$bpmax-user-mock-operator](../bpmax-user-mock-operator/SKILL.md),通过 Chrome Control 身份桥复用当前浏览器登录态,只用于浏览器页面测试,不用于 API Key impersonation 或 CLI 业务命令身份切换;结束前必须 unmock、验证恢复并关闭 identity lease。
|
|
34
|
-
- 多角色用例的身份步骤必须声明 `runner=identity`,使用 `bpmax-cli e2e identity browser status|mock|unmock|complete` 并与当前 execution manifest/case step 绑定;mock 前必须有本轮 status,每个 mock 必须有后续 unmock
|
|
35
|
+
- 多角色用例的身份步骤必须声明 `runner=identity`,使用 `bpmax-cli e2e identity browser status|mock|unmock|complete` 并与当前 execution manifest/case step 绑定;mock 步骤必须在 `input_data` 写明 `user_id=<精确 BPMAX 用户 ID>`,mock 前必须有本轮 status,每个 mock 必须有后续 unmock。不得猜测用户,不得写成 `e2e_step_run`,不得把 Cookie transport 或旧 Python Cookie 脚本作为正式主路。
|
|
35
36
|
|
|
36
37
|
## 重复操作加速模式
|
|
37
38
|
- E2E 加速分两层:`bpmax-cli e2e` 提供稳定、可复用、可审计的执行能力;本 skill 负责把这些能力编排成标准打法。
|
|
38
|
-
- 稳定页面步骤统一使用确定性 Browser Action Runner V2:`case_steps.csv` 声明 `runner=browser_action`,同场景 `automation.json` 保存语义定位、原子动作、页面指纹和执行后断言。正常路径由 CLI
|
|
39
|
+
- 稳定页面步骤统一使用确定性 Browser Action Runner V2:`case_steps.csv` 声明 `runner=browser_action`,同场景 `automation.json` 保存语义定位、原子动作、页面指纹和执行后断言。正常路径由 CLI 一次执行;首次脚本准备、`cache_stale`、未支持控件和异常诊断优先由 `chrome:control-chrome` 完成。
|
|
40
|
+
- 正式执行前必须先完成并 lint 整个场景的 `automation.json`。脚本必须声明 `operation_flow`:确定性执行、可修复失败暂停等待脚本修复、从当前步骤起点续跑、写入状态不确定必须回读解决。
|
|
41
|
+
- 正常路径只运行一次 `bpmax-cli e2e scenario execute`,由 CLI 连续执行全部已覆盖的 `browser_action` 并自动记录步骤证据;Agent 不得把 `test-suite run next` 当成逐点击指令循环,也不得在每个字段或按钮之间重新推理。
|
|
42
|
+
- `test-suite run start` 会把已 promote 的 `automation.json` 复制到本轮报告目录,并在 manifest 中绑定该 run-scoped 副本。正式 `scenario execute` 必须使用 start 返回的本轮 automation 路径;不得继续引用 `.ai_test/suite`、`.ai_test/suite_draft` 或外部脚本文件。
|
|
43
|
+
- `test-suite run start` 还会生成本轮 `precondition-<run_id>.json` pending 记录。准备真实样本并核对身份、入口、主数据和依赖状态后,必须用 `test-suite run precondition --manifest ... --evidence ...` 登记本轮结构化 passed checks;未登记、旧时间戳、目录外文件、失败检查或哈希漂移都会在任何正式页面/mutation 前硬阻断。
|
|
39
44
|
- 只能缓存动作代码、语义选择器、页面指纹和稳定断言。严禁缓存或复用 `project_id`、`step_id`、flow id、流水号、trace id、本轮截图、Network 结果或旧 pass 结论。
|
|
40
|
-
-
|
|
41
|
-
- `button.click` 必须明确是否为远端 mutation;提交/确认动作必须声明 `mutation=true,retry=never
|
|
42
|
-
-
|
|
43
|
-
- `bpmax-cli
|
|
44
|
-
-
|
|
45
|
+
- 场景 orchestrator 调用的底层 browser runner 会在任何提交动作前检查页面指纹;页面、必填字段、按钮或环节发生漂移时必须返回 `cache_stale`、`remote_submitted=false` 并停止,禁止自动刷新后立即提交。
|
|
46
|
+
- `button.click` 必须明确是否为远端 mutation;提交/确认动作必须声明 `mutation=true,retry=never,url_pattern=<本次写请求>`。每个 case step 最多只能有一个远端 mutation,多个写操作必须拆成多个逐行步骤,避免崩溃恢复时重放已提交写入。runner 只接受匹配该模式的 POST/PUT/PATCH/DELETE 响应,mutation 后至少包含 `wait.route`、`page.assert_step` 或 `list.assert_record` 之一,并拒绝任何匹配写请求的 HTTP 4xx/5xx;仅凭“提交成功”文字或 `wait.visible` 不能确认写入。每个 mutation 还必须同时声明非空 `resolution_checks.committed` 和 `resolution_checks.not_committed`,两边都至少有一个 `wait.route`、`page.assert_step` 或 `list.assert_record` 强检查,确保中断后可以确定性判断写入结果。
|
|
47
|
+
- `form.upload_file` 只能上传场景目录 `fixtures/` 下已审核的普通文件,action 必须绑定 path、SHA-256、MIME、size、`collateral_mutation=file.upload` 和附件接口 `url_pattern`。runner 必须分别记录 `local_selection_confirmed` 与 `remote_upload_confirmed`;附件上传成功仍必须写 `business_submission_confirmed=false`,不能冒充表单或审批已提交。目录外文件、符号链接、哈希/MIME/大小不符或未观察到附件接口成功响应都必须阻断。
|
|
48
|
+
- 所有正式 `browser_action` 都只能从 `bpmax-cli e2e scenario execute` 进入,不论该步骤是否包含 mutation。execute、resolve 和 automation repair 对同一个 execution manifest 共用 manifest 级 operation lock;即使调用方指定不同 checkpoint,也只能有一个进程进入执行、mutation 或恢复链路。公开 `bpmax-cli e2e browser-run` 直接调用必须非零失败,不能被 Agent 编排成逐步骤正式执行旁路。
|
|
49
|
+
- 页面漂移、选择器失效、控件不支持或断言失败发生在 mutation 之前时,CLI 必须写 `operation-flow-state.json` 和 `repair-request.json`,保持当前 manifest 步骤为 `planned`。页面、选择器或脚本漂移必须在 reviewed draft 中修改当前/未来自动化步骤,重新 init/compile、更新 review asset snapshot,再用 `test-suite automation repair --checkpoint <checkpoint> --automation <draft automation.json>` 更新本轮副本;不得直接编辑 run-scoped automation 或共享 suite。repair 必须先把 checkpoint、review、source automation、旧/新 automation hash 和不可变 receipt hash 写入 execution manifest 的 `automation_repair_guard`,再替换本轮脚本和落盘 receipt;进程中断后只能按同一 guard 恢复。`scenario execute --resume` 必须校验并消费该 manifest 锚定 receipt,更新 manifest automation hash 后才可续跑。已通过步骤的哈希变化、伪造 receipt、源 review 变化或未锚定的脚本替换都必须 hard fail。
|
|
50
|
+
- 续跑以“当前步骤起点”为安全断点。每个 `browser_action` 必须能在新的浏览器进程中重建自己的起点:要么首个动作是 `navigation.open`,要么 `page_fingerprint.route` 提供可由本轮 `data` 解析的恢复路由;不得依赖上一进程的 `{{context.*}}`。当前步骤还必须包含恢复本步所需的幂等前置填值/选择动作。CLI 可以重放当前步骤中 mutation 之前的幂等页面动作,但不得重放已通过步骤,也不得从一次未确认的提交之后继续。
|
|
51
|
+
- mutation 已尝试但结果未确认时,状态必须是 `paused_write_state_unknown`、`resume_allowed=false`。CLI 先用 Playwright trial action 确认提交控件当前可操作,再在点击前把同一尝试和目标 checkpoint 写入 execution manifest 的 `mutation_attempt_guard`,保存 operation-flow checkpoint,最后才允许浏览器 dispatch;这样即使进程在 guard 后、checkpoint 前中断,也能从 manifest 重建断点。`mutation_attempted=true` 只表示已进入受保护的提交边界;只有浏览器实际观察到匹配 `url_pattern` 的 POST/PUT/PATCH/DELETE 请求时,`mutation_request_observed` 和 `remote_submitted` 才能为 true。runner evidence 同时登记同一 mutation attempt ID 的 `mutation-state.json=attempted_unconfirmed`。即使 `operation-flow-state.json` 或 evidence 被删除,只要 manifest guard 仍在就必须阻断重放;同一 scenario/case/profile 即使换另一个 report root 也不得创建新 run 绕过未决 guard。`e2e scenario resolve` 必须在两个独立页面分别运行 `resolution_checks.committed` 和 `resolution_checks.not_committed`,且只能有一边通过;零命中或双命中都保持未决。若本轮证据证明 mutation intent 已记录但目标写请求未出现,`not_committed` 分支可以使用 `mutation.assert_no_request` 绑定同一 run/nonce/case/step/automation hash 和 `url_pattern`,并配合实时强检查;对于已经发生的未决 attempt,CLI 也可用“未观察到目标写请求 + 当前页面匹配已审核的起点 route 与提交按钮 fingerprint”形成受控未提交证据。不能只凭网络缺失解锁重试。调用方不得选择结论,`--outcome` 只可作为可选预期值。CLI 生成 `resolution-receipt.json`、页面 evidence 和 `evidence-files.json`,并把三者的不可变 SHA-256 锚定到 manifest guard;手写或仅文件内自洽的 resolution bundle 不能独立形成结论。resolution evidence 必须同时绑定当前 `run_id`、`evidence_nonce`、checkpoint revision、mutation attempt ID、case/step 和本次尝试的 `automation_step_sha256`。只有完全匹配的写后确认或受控 resolution 才能清除 guard;确认已提交则验收并推进,确认未提交后才允许从步骤起点重试。
|
|
52
|
+
- 首次运行一条流程或一个复杂 step 前,就必须先生成、审查并编译覆盖完整场景的 `automation.json`;`scenario plan`、`data profile` 和 reusable step template 可作为补充资产,但不能替代正式脚本。
|
|
53
|
+
- `bpmax-cli test-suite lint` 会检查非 deprecated E2E 用例是否已经具备正式运行所需的确定性脚本覆盖。仍存在 `browser` 或缺少 automation 映射时,不要直接判业务失败,读取 `e2e_acceleration.bootstrap_required=true` 和 `missing_cases`;`e2e_create_page`、`e2e_step_run` 已退出正式 schema,必须先迁入 draft 并编译,lint 不再允许其进入 review/promote。
|
|
54
|
+
- 发现 `bootstrap_required=true` 时,先在 `.ai_test/suite_draft` 运行 `bpmax-cli test-suite automation init`,依据平台源码和 `chrome:control-chrome` 只读探索补齐脚本定义,再运行 `bpmax-cli test-suite automation compile`。init/compile 禁止直接写 `.ai_test/suite`;`bootstrap_required` 不授权先手工跑一遍正式用例。
|
|
55
|
+
- `record-from-evidence --automation-out` 只能在 `.codex/tmp` 生成 `review_required` 候选,不能直接生成或覆盖任何场景的 `automation.json`。候选必须合并回 compile input,重新 review/compile/promote 后才可执行。
|
|
56
|
+
- 编译输入的 `source_basis` 必须使用可审计前缀:`platform_source:`、`chrome_control_read_only:`、`reviewed_pattern:` 或 `business_requirement:`,并写清具体文件、页面或规则。仅写“看过页面”“按经验配置”等自声明不能通过 compile lint。
|
|
45
57
|
- 缓存执行不是无条件信任旧模板。每个 reusable step template 必须包含 `expected_checks`;复用时先验证处理人、step 状态、必填字段集合、缺失字段范围、动作是否仍符合预期。
|
|
46
58
|
- 如果 `expected_checks` 缺失、失败,或没有拿到预期范围内结果,判为 `cache_stale`,停止后续提交;优先用 `--auto-refresh-cache` 重建当前步骤缓存,但刷新后的模板不等于通过结论。
|
|
47
59
|
- 如果新模板显示新增必填字段、处理人不可处理、动作消失或 step 已结束,先补数据、换样本或修配置,再复跑;不得把刷新后的缓存当作通过结论。
|
|
48
60
|
- 页面提交类操作必须走真实浏览器:`bpmax-cli e2e create-page-submit` / `e2e browser-template create-form` 不是 raw API 创建,必须保留截图、URL、DOM 摘要、console/network 错误和 `project_id`;不得把接口提交伪装成页面回归。
|
|
49
|
-
- 批量真实执行使用 `bpmax-cli e2e scenario execute --automation ... --execution-manifest
|
|
61
|
+
- 批量真实执行使用 `bpmax-cli e2e scenario execute --plan ... --automation ... --execution-manifest ...`;命令默认运行到完成或受控暂停,不需要 `--until-blocked`。旧 `scenario run` 仅生成 dry-run 状态矩阵,禁止再用 `--resume` 冒充真实续跑。
|
|
50
62
|
- `--resume` 只能继续同一个尚未完成的 execution manifest。用户要求重新运行或 manifest 已完成时,必须重新执行 `test-suite run start` 创建新 run;已跑过的 case 也必须产生新的业务 ID、截图、DOM/Console/Network 和逐步证据,绝不能因为历史 pass 而跳过。
|
|
51
63
|
- 常用命令详见 `references/full-detail-guide.md`:
|
|
52
64
|
- `bpmax-cli e2e step-run`
|
|
53
65
|
- `bpmax-cli e2e create-page-submit`
|
|
54
66
|
- `bpmax-cli e2e record-from-evidence`
|
|
55
67
|
- `bpmax-cli e2e scenario run`
|
|
56
|
-
- `bpmax-cli e2e browser-run`
|
|
57
68
|
- `bpmax-cli e2e scenario execute`
|
|
58
69
|
- `bpmax-cli e2e cache inspect`
|
|
59
70
|
- `bpmax-cli e2e cache refresh`
|
|
@@ -61,9 +72,14 @@ description: "用于在 BPMAX 中做全链路流程测试、场景回归、前
|
|
|
61
72
|
## `.ai_test` 资产门禁
|
|
62
73
|
- 可复用测试用例统一放在 `.ai_test/`;运行状态放在 `.codex/tmp/e2e_states/`;不要混用。
|
|
63
74
|
- 每个场景必须同时有 `cases.csv` 和 `case_steps.csv`:前者只保存用例级元数据,后者必须让每个测试步骤独占一行。禁止继续把打开、填写、提交、审批和验证聚合到一个 `steps` 单元格。
|
|
64
|
-
- 使用 `runner=browser_action` 的场景必须提供 `automation.json`,且每个步骤都有同名 `<case_id>/<step_id>` 动作映射、`page_fingerprint`、非空 `actions` 和 `expected_checks
|
|
65
|
-
-
|
|
75
|
+
- 使用 `runner=browser_action` 的场景必须提供 `automation.json`,且每个步骤都有同名 `<case_id>/<step_id>` 动作映射、`page_fingerprint`、非空 `actions` 和 `expected_checks`;包含 mutation 时还必须有双结果 `resolution_checks`。每一步还必须有可重建的步骤起点路由;坐标、绝对 XPath、硬编码运行态 ID、跨进程 `{{context.*}}` 路由和可盲重试提交均为 hard error。
|
|
76
|
+
- `test-suite run start` 会检查场景内所有 active case,而不只检查当前选择的 case;任一 active case 仍有 `runner=browser` 或缺少编译证明时,整个场景不得开始正式执行。
|
|
77
|
+
- `test-suite run start` 会按 `真实场景目录 + case_id + profile` 创建跨 report root 的 active-run lease;同一用例仍在运行时,不能通过更换报告目录并发启动。终态记录后由 CLI 按 owner token 释放 lease,调用方不得手工删除。
|
|
78
|
+
- 正式场景必须来自 scoped lint/review/promote,并保留 CLI 生成且与当前资产哈希一致的 promotion receipt;直接从 `suite_draft`、手写/篡改后的场景或缺少 receipt 的目录启动必须阻断。
|
|
79
|
+
- `automation.json.operation_flow` 必须固定声明:`mode=deterministic`、`on_repairable_failure=pause_for_script_repair`、`resume_from=step_start`、`on_write_state_unknown=require_readback_resolution`。缺少任一项时 lint/build execution 都必须阻断。
|
|
80
|
+
- 首次尚未自动化的页面步骤可暂时使用 `runner=browser` 作为“待编译”标记,但 `test-suite run start` 必须硬阻断它。只能先通过平台源码和 `chrome:control-chrome` 只读探索生成并 review 脚本,再编译为 `browser_action`;若控件暂不支持确定性执行,本轮只能标记 `blocked` 或 `diagnostic`,不能回退到 AI 逐点击形成正式 pass。
|
|
66
81
|
- `case_steps.csv` 每行只能有一个用户动作,并写清 actor、runner、action、target、input_data、即时 expected_result 和 evidence_required;不能用“然后/接着/再”把多步塞进一行。上传附件属于合法单一步骤,应单独写成“上传 <具体附件>”并记录页面证据。
|
|
82
|
+
- `runner=observe` 只能对已经由同一 run 更早通过步骤登记的 evidence 做只读核对,`input_data` 必须明确写 `source_case_step_id=<case_id>/<step_id>`,运行 evidence 也必须携带相同绑定;不得打开页面、点击、填写、搜索、确认、切换身份或触发任何业务写入,也不得引用任意未登记文件自证通过。
|
|
67
83
|
- 生成、检查、更新用例资产前,必须先 latest sync,并把证明写入 `.codex/tmp/ai_test_suite/latest-<env>-proof.json`。缺少 `--latest-proof` 时,CLI 必须拒绝 lint/index/draft-update/promote。
|
|
68
84
|
- `.ai_test` suite 的 lint、review init/repair/explain、draft-update、promote 都使用 `bpmax-cli test-suite` 的 TypeScript 实现;不要新增或调用旧 Python suite 脚本作为主路径。
|
|
69
85
|
- 共享 suite 不等于共享失败域。处理单个流程时,必须维护该流程明确的 `scenario_ids`,并对 draft 使用可重复的 `test-suite lint --scenario <id>`;不得先全量 lint 再过滤,也不得让 CG01 的资产更新被 SC02 等其他流程的历史 case 阻断。
|
|
@@ -82,20 +98,23 @@ description: "用于在 BPMAX 中做全链路流程测试、场景回归、前
|
|
|
82
98
|
- 单次执行报告必须在 `.ai_test/report/<YYYYMMDD-NNN>/`,截图必须在同一 run 的 `screenshots/` 下;`.codex/docs/` 只放复盘、长周期总结或交付版文档。
|
|
83
99
|
- 报告必须写 `planned_cases:`、`executed_cases:`、`planned_steps:`、`executed_steps:`、`execution_manifest:`、`precondition_check:`、`state_file:`、`report_run:`、`browser_tool:`、`rerun_policy:`,并逐条对账 planned 与 executed。
|
|
84
100
|
- `result:` 只能使用明确状态:完整通过用 `pass` / `pass-with-warnings`,未完整执行用 `partial` / `stage` / `blocked` / `diagnostic`,失败用 `fail`;不得自造 `all_green` 等同义词绕过门禁。
|
|
85
|
-
- `browser_tool:` 只能写本轮实际可用且执行过的 `Chrome Control`、`chrome:control-chrome`、`Chrome DevTools`、`DevTools`、`Playwright` 或 `AppleScript
|
|
101
|
+
- `browser_tool:` 只能写本轮实际可用且执行过的 `Chrome Control`、`chrome:control-chrome`、`Chrome DevTools`、`DevTools`、`Playwright` 或 `AppleScript`。首次只读探索和异常诊断默认记录 `Chrome Control`,确定性正式执行记录 `Playwright`;不能写“浏览器工具”、`unavailable`、`not Playwright` 等模糊或否定文本。
|
|
86
102
|
- 完整页面结论的 `runtime_url:` 必须是本轮真实 BPMAX 页面路由,不能是 `/api`、`/bpmax` 或示例域名;URL 中存在 project/step id 时必须与 `project_id:` / `step_id:` 一致。动作与可见断言不得写 TODO、API readback 或 JSON response 占位文本。
|
|
87
103
|
- 报告出现 `not run`、`未执行`、`跳过` 时,`result:` 必须降级为 `partial`、`stage`、`blocked` 或明确“阶段/局部/不完整”。
|
|
88
104
|
- 没有合规浏览器工具或页面证据时,写 `browser_status: blocked` 和“页面结论停止”;不得用 API/readback 证据冒充页面验证。
|
|
89
105
|
- 用户明确要求“重新运行测试用例”“全量重跑”“重新回归”时,报告必须写 `rerun_policy: full_rerun` 并逐 case 重新执行。禁止直接查找旧结果、旧报告、旧状态文件或旧截图来填充本轮 `executed_cases`、pass 结论或页面证据。
|
|
90
106
|
- `full_rerun` 报告的 `run_id:` 必须等于当前报告目录名;`state_file:`、`precondition_check:`、`report_run:` 必须指向本轮 run 或本轮日期;截图文件必须位于本轮 `screenshots/` 且修改时间落在 `started_at` / `finished_at` 时间窗内。
|
|
91
|
-
-
|
|
107
|
+
- `precondition_check:` 不是文件名占位符,必须引用 execution manifest 锚定的本轮结构化记录;该记录必须是 `passed`,并锁定同一 run/scenario/case/profile 的 evidence、checks 和 SHA-256。历史前置检查或手工改名文件不能形成正式执行资格。
|
|
108
|
+
- 本轮截图必须是可解析且尺寸至少 100x80 的真实 PNG,或同等尺寸的真实 JPEG,并且内容 MIME 与扩展名一致;改后缀的文本文件、空白占位图或损坏图片不能作为 pass evidence。Chrome identity bridge 生成的规范 JPEG 可直接进入同一步的 formal record,不得为了兼容记录器而改名或转换。
|
|
92
109
|
- `e2e step-run` 在任何远端提交前必须完成 evidence 目录范围和可写性预检;结果必须分别检查 `remote_submitted`、`evidence_failed`、`readback_confirmed`。只要证据失败或回读未确认,就停止后续步骤,不得重复提交,也不得形成 pass evidence。
|
|
110
|
+
- 确定性浏览器步骤已经写入 manifest 为 `pass`、但场景报告同步失败时,只允许执行 `report-sync` 恢复。checkpoint 必须指向下一待执行步骤;已通过步骤继续受 SHA-256 锁保护,禁止把报告同步失败误判为脚本失败并重放页面 mutation。
|
|
93
111
|
- `e2e step-run` 的 actor 门禁以当前有效 owner/assignee 集合为准;`step.user_id` 只作辅助诊断。两者冲突或只有 `user_id` 而无 owner 证明时必须 fail closed,并先用 `identity status` 和真实页面按钮复核。
|
|
94
|
-
- 标准 evidence manifest
|
|
95
|
-
- 正式 browser 步骤的 evidence JSON 必须写当前 `case_id`、`case_step_id`、`browser_verified: true`、`runtime_scope: page|project|step`、真实 `runtime_url`、本轮 PNG 的 `screenshot` 路径和非空 `assertions`,且所有 assertion 都是 `passed: true`;要求 DOM 时还必须写可定位的 `dom_snapshot`。仅自声明 `browser_verified: true` 不算证据。
|
|
112
|
+
- 标准 evidence manifest 必须记录运行状态、`mutation_attempted`、`mutation_request_observed`、`remote_submitted`、目标写请求摘要、远端响应摘要、写后回读,以及每个证据文件的 SHA-256、实际 MIME 和扩展名一致性;发生 mutation 时还必须登记 `mutation-state.json`,确认后重算文件哈希。JPEG 内容伪装成 `.png` 不得通过。
|
|
113
|
+
- 正式 browser 步骤的 evidence JSON 必须写当前 `case_id`、`case_step_id`、`browser_verified: true`、`runtime_scope: page|project|step`、真实 `runtime_url`、本轮 PNG/JPEG 的 `screenshot` 路径和非空 `assertions`,且所有 assertion 都是 `passed: true`;要求 DOM 时还必须写可定位的 `dom_snapshot`。仅自声明 `browser_verified: true` 不算证据。
|
|
96
114
|
- `runtime_scope=page` 用于首页、列表、搜索等非项目页面,不要求业务 ID;`project` 必须有数字 `project_id`;`step` 必须同时有数字 `project_id` 和业务 `step_id`。测试用例的 `step_no` 绝不能冒充业务 step ID。
|
|
97
115
|
- evidence 必须声明 `runtime_environment: profile|local-browser`。`profile` 模式下 `runtime_url` origin 必须等于 manifest 的 `profile_origin`;源码本地联调必须显式使用 `local-browser`,且 URL 只能是 localhost/127.0.0.1/::1,不能把远端 profile 名伪装成本地页面身份。
|
|
98
|
-
- execution manifest 由 CLI 单写者管理,禁止 agent 手工覆盖、恢复或编辑 JSON
|
|
116
|
+
- execution manifest 由 CLI 单写者管理,禁止 agent 手工覆盖、恢复或编辑 JSON,也禁止删除或重建相邻的 `.state.json`、`.journal.jsonl`、`.transaction.json` 及 report root 下 `.bpmax-run-integrity/` 高水位文件。journal 必须从 revision 0 连续保留;只留下最新 revision或把 manifest/state/journal 一起恢复到旧前缀都属于回滚。record/read/事务恢复共用 manifest writer lock;execute/resolve/repair 额外共用 `<execution-manifest>.operation.lock`,锁身份不依赖 checkpoint 路径。并发写会触发 `test_suite.run.concurrent_write`,并发流程操作会触发 `e2e.scenario.concurrent_execution`,缺失历史、截断 journal 或回滚旧 manifest 会触发 `test_suite.run.manifest_rollback`。正式 run 还会固定当前 E2E Skill 完整 bundle 的内容哈希,包括 `SKILL.md`、references、scripts、profiles 和其他分发文件;bundle 内禁止符号链接。运行中任何 bundle 内容变化都必须新建 run,部分 Skill 安装失败不得更新 `skills.stamp`。
|
|
117
|
+
- execution manifest 生成本轮 `evidence_nonce`。正式证据必须由 CLI/runner 在生成时写入匹配的 `run_id`、`evidence_nonce`、`case_id` 和 `case_step_id`;登记阶段不得给历史文件补写本轮标识。复制旧证据、只修改 mtime 或手工拼 nonce 均不能形成本轮通过证据。
|
|
99
118
|
- 每一步必须重新截图;同一 run 内不同 browser 步骤的截图内容完全相同会被视为截图复用并阻断。无视觉变化的检查应改成有明确 source evidence 的 `observe` 步骤。
|
|
100
119
|
- identity unmock 恢复原管理员后,画面可能与更早的 status 截图完全相同;此时允许像素一致,但仍必须是本轮新文件、新时间戳,并同时有 `readback_confirmed=true` 和 `identity-lease.json state=released`,不能复用旧文件。
|
|
101
120
|
- `checkpoint` / `evidence_only` 只能给局部或对照结论。每个 `executed_cases` 中的通过用例,都必须在结果表、截图 alt/path、项目 ID、step ID 或本轮证据路径中能定位到当前 case。
|
|
@@ -104,14 +123,16 @@ description: "用于在 BPMAX 中做全链路流程测试、场景回归、前
|
|
|
104
123
|
## 标准执行流
|
|
105
124
|
1. 查 memory:搜索业务名、`flow_type`、模板、数据集、上次状态和已知坑点;不要把完整 JSON 贴给用户。CLI 出现 skills out-of-sync notice 时,源码验证必须显式读取当前仓库 skill,正式分发前必须 update/install skills 消除版本差异。
|
|
106
125
|
2. 用 `bpmax-functional-test-design` 从需求、状态、规则、边界和角色旅程生成可追踪用例;设计完成不等于执行通过。
|
|
107
|
-
3.
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
126
|
+
3. 首次正式运行前先生成脚本:运行 `test-suite automation init`,读取平台源码;必要时用 `chrome:control-chrome` 做不触发业务 mutation 的只读页面探索,补齐并 review 全部页面步骤,再运行 `test-suite automation compile`。编译输入绑定当前 `README.md`、`cases.csv`、`case_steps.csv` 快照,过期输入不得复用。
|
|
127
|
+
4. 按当前流程的 `scenario_ids` 做隔离 lint/review/promote,确认 mutation 分类、页面指纹、稳定选择器、断言和 `operation_flow` 策略;其他流程失败不得污染当前流程。任何正式用例中仍有 `runner=browser` 都必须阻断。
|
|
128
|
+
5. 强制从用例启动:运行 `bpmax-cli test-suite run start --scenario <id> --case-id <id> ...` 生成本轮 execution manifest。不得先临场执行正式页面动作或直接运行 `bpmax-cli e2e`。源码联调必须额外传 `--source-skill <repo>/skills/bpmax-e2e-flow-test-operator/SKILL.md`;分发版默认硬检查安装 skill stamp 与 CLI 版本一致。`run start` 会同时生成 `<scenario_id>.md` 报告草稿。
|
|
129
|
+
6. 准备真实业务样本:确认业务对象、主数据关系、边界值、审批人、权限、页面入口和预期业务后果;把核对结果写成本轮报告目录内的结构化 precondition evidence,每条 check 必须明确命名并为 `passed=true`。
|
|
130
|
+
7. 登记前置检查:运行 `test-suite run precondition`,让 CLI 把 evidence 路径、哈希和 checks 锚定进 manifest;未返回 `state=passed` 不得继续。
|
|
131
|
+
8. 一次执行:运行 `e2e scenario execute`,让 CLI 自动推进和记录所有确定性页面步骤。当前步骤是 identity 时,CLI 只返回一个结构化 Chrome Control 身份桥动作;完成 helper 和 `identity browser complete` 后用同一 checkpoint 续跑,不得展开成人工点击清单,也不得导出 Cookie。返回 `functional_complete` 后继续完成 UX 和报告门禁,不得直接宣布通过。
|
|
132
|
+
9. 异常续跑:`paused_repairable` 时读取 repair request,用 `chrome:control-chrome` 定位页面变化;在 draft 中修改当前/未来脚本,重新 compile/review,然后执行 `test-suite automation repair` 将 reviewed automation 应用到本轮副本,确认生成 repair receipt 后再 `--resume`。`paused_write_state_unknown` 时必须先 resolve。不得手工修改 execution manifest、run automation 或回放 completed steps。
|
|
133
|
+
10. 用 `bpmax-ui-ux-audit` 审计本轮实际到达的全部界面,写 `ux-findings.json`;未到达界面不得编造结论。
|
|
134
|
+
11. 失败闭环:只有不可修复失败或明确 blocker 才记录 `fail` / `blocked`;先分清配置、环境、旧样本、权限、缓存或测试资产问题,修配置回到对应 skill。
|
|
135
|
+
12. 输出报告并运行 `lint-report`:报告引用本轮 manifest,逐条对账 case/step、前置检查、UX BUG 和证据;lint 未通过不得给完整结论。
|
|
115
136
|
|
|
116
137
|
排障只能显式使用 `--diagnostic`。该模式可以不带 manifest,但输出不能进入正式 pass evidence,也不能用来绕过用例链路。
|
|
117
138
|
|
|
@@ -126,7 +147,7 @@ description: "用于在 BPMAX 中做全链路流程测试、场景回归、前
|
|
|
126
147
|
- 要创建、修复或 promote `.ai_test` 用例:读 `references/ai-test-suite.md`。
|
|
127
148
|
- 要快速判断最小闭环与通过/失败/阻塞口径:读 `references/minimal-test-loop.md`。
|
|
128
149
|
- 要处理前置样本、旧项目、修复后新样本:读 `references/stale-runtime-and-clean-sample-rules.md`。
|
|
129
|
-
- 要用浏览器证明页面行为、使用 `chrome:control-chrome`
|
|
150
|
+
- 要用浏览器证明页面行为、使用 `chrome:control-chrome` 做首次只读探索或处理后备通道:读 `references/browser-only-checkpoints.md`。
|
|
130
151
|
- 要发现筛选字段、列表字段或字段映射依据:读 `references/filter-field-discovery.md`。
|
|
131
152
|
- 要跑负卖样板或接口诊断骨架:读 `references/profile-schema.md`、`references/negative-sale-api-matrix.md` 和对应 profile。
|
|
132
153
|
- 要录制、编写或排查确定性浏览器动作:读 `references/browser-action-dsl.md`。
|