bpmax-cli 0.1.44-beta.3 → 0.1.44-beta.4
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/package.json +1 -1
- package/skills/bpmax-e2e-flow-test-operator/SKILL.md +1 -0
- package/skills/bpmax-form-template-editor/SKILL.md +2 -0
- package/skills/bpmax-form-template-editor/scripts/export_form_template.py +2 -0
- package/skills/bpmax-form-template-editor/scripts/form_template_editor_common.py +17 -0
- package/skills/bpmax-form-template-editor/tests/test_form_template_editor.py +6 -17
package/package.json
CHANGED
|
@@ -22,6 +22,7 @@ description: "用于在 BPMAX 中做全链路流程测试、场景回归、前
|
|
|
22
22
|
- 开始前先查 [$bpmax-memory-protocol](../bpmax-memory-protocol/SKILL.md),不要直接重复试错。
|
|
23
23
|
- 浏览器实时页面、实时接口返回、最新 live/draft 配置优先于本地镜像。
|
|
24
24
|
- 若用户要求“线上跑完整链路”“真实验证用户路径”或等价目标,必须在真实运行页面完成发起、填单、选择、提交、审批、驳回、回退等关键动作;不得用脚本、控制台、手改 request body 或接口直调绕过界面。
|
|
25
|
+
- 浏览器 E2E 中如果发起页、审批页或详情页的表单打不开、白屏、字段不渲染、按钮不可用,第一步必须检查浏览器 Console 和 Network 里的真实报错;优先解决 `form_template` 加载、表单控件渲染、`lambda`、`customeValidate`、`sub_form` 绑定等表单模板相关错误,再排查流程、权限、数据或缓存问题。
|
|
25
26
|
- 只有在用户明确确认接受“非页面路径”后,才可以用脚本代替真实页面操作;确认前,脚本最多只用于摸底、状态记录、接口回读、证据补充和首次抓请求骨架,不得直接当成线上链路测试结论。
|
|
26
27
|
- 浏览器 E2E 涉及多角色时,使用 [$bpmax-user-mock-operator](../bpmax-user-mock-operator/SKILL.md) 切换当前浏览器身份;该能力只用于浏览器页面测试,不用于 API Key 冒充或 CLI 业务命令身份切换。
|
|
27
28
|
- 测试 H5 界面时,必须打开 `/m/#/...` H5 路由,并把页面可视区域(viewport)设置为 `412x844`;只允许调整页面 viewport,不要修改 Chrome/浏览器整个窗口的外层尺寸。
|
|
@@ -8,6 +8,7 @@ description: "用于在 BPMAX 的表单模板页面中创建或编辑表单。
|
|
|
8
8
|
## 写入路径硬约束
|
|
9
9
|
- 执行前必须先运行 `bpmax-cli config adapters --format json` 核对 `form-template`;只有 `build_status` 和 `submit_status` 都是 `supported` 时才允许进入 build/submit。当前若显示 `blocked`,只能导出、编辑 work、lint 和形成变更建议,不得提交。
|
|
10
10
|
- 在 bpmax-cli npm 分发包中,真实远端写操作只能走 `bpmax-cli config form-template submit`。
|
|
11
|
+
- `bpmax-cli config form-template export/submit/verify` 和 `export_form_template.py --template-id` 必须硬阻断发布态模板 ID;若 `origin_template_id != 0`,只能改用该草稿 ID 后重试。
|
|
11
12
|
- 旧来源脚本 `scripts/submit*.py` 只保留为结构参考,默认会硬失败;不得用它们直调 BPMAX API。
|
|
12
13
|
- 不得用 `bpmax-cli api POST/PUT/DELETE /form_template*` 或其它 raw API 绕过 typed config submit。
|
|
13
14
|
|
|
@@ -862,6 +863,7 @@ bpmax-cli config form-template submit \
|
|
|
862
863
|
- 这类场景里 `actualRuntimeFormTemplateId = <publishedId>` 就是主证据
|
|
863
864
|
- 不要求再额外补一个 `flow_live_form_template_id` 才算通过
|
|
864
865
|
- 典型场景:纯文案、小字段显示、提示语、非流程绑定结构的小改动
|
|
866
|
+
- 如果运行态发起页、审批页或详情页表单打不开、白屏、字段不渲染或提交控件不可用,不得先跳到接口结论;必须先检查浏览器 Console 和 Network 报错,并优先处理 `form_template` 加载、控件渲染、`lambda`、`customeValidate`、`sub_form` 绑定等表单模板相关错误。
|
|
865
867
|
- 推荐命令:
|
|
866
868
|
|
|
867
869
|
```bash
|
|
@@ -7,6 +7,7 @@ from form_template_editor_common import (
|
|
|
7
7
|
build_client,
|
|
8
8
|
build_create_raw_payload,
|
|
9
9
|
create_stem,
|
|
10
|
+
assert_form_template_draft_id,
|
|
10
11
|
detail_to_work_payload,
|
|
11
12
|
dump_json,
|
|
12
13
|
paths_for,
|
|
@@ -36,6 +37,7 @@ def main() -> int:
|
|
|
36
37
|
if args.template_id:
|
|
37
38
|
response = client.get_form_template(args.template_id)
|
|
38
39
|
detail = response.get("data") or {}
|
|
40
|
+
assert_form_template_draft_id(args.template_id, detail, "export")
|
|
39
41
|
stem = str(args.template_id)
|
|
40
42
|
mode = "edit"
|
|
41
43
|
raw = detail
|
|
@@ -133,6 +133,23 @@ def extract_api_data(payload: Dict[str, Any]) -> Any:
|
|
|
133
133
|
return payload
|
|
134
134
|
|
|
135
135
|
|
|
136
|
+
def normalize_numeric_id(value: Any) -> int | None:
|
|
137
|
+
if isinstance(value, int):
|
|
138
|
+
return value
|
|
139
|
+
if isinstance(value, str) and value.isdigit():
|
|
140
|
+
return int(value)
|
|
141
|
+
return None
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def assert_form_template_draft_id(template_id: Any, detail: Dict[str, Any], action: str) -> None:
|
|
145
|
+
origin_template_id = normalize_numeric_id(detail.get("origin_template_id"))
|
|
146
|
+
if origin_template_id and origin_template_id > 0:
|
|
147
|
+
raise SystemExit(
|
|
148
|
+
f"refusing to {action} published form-template id {template_id}; "
|
|
149
|
+
f"use draft id {origin_template_id}. Published ids are readback-only."
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
|
|
136
153
|
def _extract_field_pairs(rule_rows: Any, value_items: Any) -> tuple[Dict[str, Dict[str, Any]], list[str]]:
|
|
137
154
|
value_by_field: Dict[str, Dict[str, Any]] = {}
|
|
138
155
|
if isinstance(value_items, list):
|
|
@@ -12,8 +12,8 @@ if str(SCRIPT_DIR) not in sys.path:
|
|
|
12
12
|
sys.path.insert(0, str(SCRIPT_DIR))
|
|
13
13
|
|
|
14
14
|
import form_template_editor_common as common
|
|
15
|
-
import submit_form_template as submit_script
|
|
16
15
|
from form_template_editor_common import (
|
|
16
|
+
assert_form_template_draft_id,
|
|
17
17
|
build_drift_report,
|
|
18
18
|
build_publish_safety_report,
|
|
19
19
|
build_runtime_acceptance_payload,
|
|
@@ -1223,23 +1223,12 @@ class FormTemplateEditorCommonTests(unittest.TestCase):
|
|
|
1223
1223
|
self.assertEqual(payload["flowDraftFormTemplateId"], 990702161)
|
|
1224
1224
|
self.assertEqual(payload["runtimeReferenceSource"], "flow_live_api")
|
|
1225
1225
|
|
|
1226
|
-
def
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
return {"data": {"id": template_id, "origin_template_id": 990702142}}
|
|
1226
|
+
def test_form_template_draft_id_gate_blocks_published_template_id(self) -> None:
|
|
1227
|
+
with self.assertRaisesRegex(SystemExit, "published form-template id 990702161.*draft id 990702142"):
|
|
1228
|
+
assert_form_template_draft_id(990702161, {"id": 990702161, "origin_template_id": 990702142}, "export")
|
|
1230
1229
|
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
self.assertEqual(detail["id"], 990702161)
|
|
1234
|
-
|
|
1235
|
-
def test_submit_script_uses_requested_id_as_edit_target_when_origin_missing(self) -> None:
|
|
1236
|
-
class FakeClient:
|
|
1237
|
-
def get_form_template(self, template_id):
|
|
1238
|
-
return {"data": {"id": template_id, "origin_template_id": 0}}
|
|
1239
|
-
|
|
1240
|
-
draft_id, detail = submit_script.resolve_edit_target_ids(FakeClient(), 990702161)
|
|
1241
|
-
self.assertEqual(draft_id, 990702161)
|
|
1242
|
-
self.assertEqual(detail["id"], 990702161)
|
|
1230
|
+
def test_form_template_draft_id_gate_allows_draft_template_id(self) -> None:
|
|
1231
|
+
assert_form_template_draft_id(990702142, {"id": 990702142, "origin_template_id": 0}, "export")
|
|
1243
1232
|
|
|
1244
1233
|
def test_runtime_acceptance_payload_accepts_browser_runtime_without_flow_live_reference(self) -> None:
|
|
1245
1234
|
payload = build_runtime_acceptance_payload(
|