bpmax-cli 0.2.1-beta.34 → 0.2.1-beta.36
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/README.md +2 -0
- package/dist/bin.js +717 -51
- package/dist/bin.js.map +1 -1
- package/package.json +2 -2
- package/skills/bpmax-console-template-editor/scripts/console_template_editor_common.py +238 -4
- package/skills/bpmax-console-template-editor/tests/test_console_template_editor.py +258 -0
- package/skills/bpmax-flow-detail-template-editor/SKILL.md +43 -0
- package/skills/bpmax-flow-template-editor/references/requirement-to-node-mapping.md +5 -0
- package/skills/bpmax-flow-template-editor/references/runtime-verified-node-fields.md +6 -0
- package/skills/bpmax-functional-test-design/LICENSE.upstream +24 -0
- package/skills/bpmax-functional-test-design/SKILL.md +80 -0
- package/skills/bpmax-functional-test-design/agents/openai.yaml +4 -0
- package/skills/bpmax-functional-test-design/references/bpmax-test-suite-output.md +95 -0
- package/skills/bpmax-functional-test-design/references/decision-table-testing.md +50 -0
- package/skills/bpmax-functional-test-design/references/domain-testing.md +43 -0
- package/skills/bpmax-functional-test-design/references/state-transition-testing.md +47 -0
- package/skills/bpmax-functional-test-design/references/technique-selection.md +38 -0
- package/skills/bpmax-functional-test-design/references/use-case-testing.md +55 -0
- package/skills/bpmax-project/SKILL.md +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bpmax-cli",
|
|
3
|
-
"version": "0.2.1-beta.
|
|
3
|
+
"version": "0.2.1-beta.36",
|
|
4
4
|
"description": "CLI for BPMAX environments with multi-profile config and local login callback flow",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"build": "tsup",
|
|
21
21
|
"dev": "tsx src/bin.ts",
|
|
22
22
|
"install:skills": "node scripts/install-skills.mjs",
|
|
23
|
-
"test": "vitest run",
|
|
23
|
+
"test": "vitest run --exclude '.worktrees/**'",
|
|
24
24
|
"typecheck": "tsc --noEmit"
|
|
25
25
|
},
|
|
26
26
|
"engines": {
|
|
@@ -448,11 +448,245 @@ def _check_frontend_detail_counting(
|
|
|
448
448
|
) -> None:
|
|
449
449
|
if not isinstance(script, str):
|
|
450
450
|
return
|
|
451
|
-
has_row_loop = bool(re.search(r"\.(?:forEach|map|reduce|filter)\s*\(|for\s*\([^)]*\b(?:of|in)\b", script))
|
|
452
|
-
has_metric = bool(re.search(r"count|total|amount|qty|quantity|inventory|stock|sale|销量|库存|项目数|数量|金额|合计|总数", script, re.IGNORECASE))
|
|
453
451
|
source_text = data_source if isinstance(data_source, str) else json.dumps(data_source, ensure_ascii=False, sort_keys=True)
|
|
454
|
-
|
|
455
|
-
|
|
452
|
+
def strip_js_non_code(value: str) -> str:
|
|
453
|
+
output: list[str] = []
|
|
454
|
+
state = "code"
|
|
455
|
+
escaped = False
|
|
456
|
+
index = 0
|
|
457
|
+
while index < len(value):
|
|
458
|
+
char = value[index]
|
|
459
|
+
next_char = value[index + 1] if index + 1 < len(value) else ""
|
|
460
|
+
if state == "code" and char == "/" and next_char == "/":
|
|
461
|
+
state = "line"; output.extend((" ", " ")); index += 2; continue
|
|
462
|
+
if state == "code" and char == "/" and next_char == "*":
|
|
463
|
+
state = "block"; output.extend((" ", " ")); index += 2; continue
|
|
464
|
+
if state == "code" and char in ("'", '"'):
|
|
465
|
+
end = index + 1
|
|
466
|
+
quote_escaped = False
|
|
467
|
+
while end < len(value):
|
|
468
|
+
if quote_escaped: quote_escaped = False
|
|
469
|
+
elif value[end] == "\\": quote_escaped = True
|
|
470
|
+
elif value[end] == char: break
|
|
471
|
+
end += 1
|
|
472
|
+
literal = value[index + 1:end]
|
|
473
|
+
previous = next((item for item in reversed(output) if not item.isspace()), "")
|
|
474
|
+
if end < len(value) and re.fullmatch(r"[A-Za-z_$][\w$]*", literal) and previous in ("{", ",") and re.match(r"\s*:", value[end + 1:]):
|
|
475
|
+
output.extend(f" {literal} "); index = end + 1; continue
|
|
476
|
+
state = "single" if char == "'" else "double"; output.append(" "); index += 1; continue
|
|
477
|
+
if state == "code" and char == "`":
|
|
478
|
+
state = "template"; output.append(" "); index += 1; continue
|
|
479
|
+
if state == "line":
|
|
480
|
+
if char == "\n": state = "code"; output.append("\n")
|
|
481
|
+
else: output.append(" ")
|
|
482
|
+
index += 1; continue
|
|
483
|
+
if state == "block":
|
|
484
|
+
if char == "*" and next_char == "/": state = "code"; output.extend((" ", " ")); index += 2
|
|
485
|
+
else: output.append("\n" if char == "\n" else " "); index += 1
|
|
486
|
+
continue
|
|
487
|
+
if state != "code":
|
|
488
|
+
output.append("\n" if char == "\n" else " ")
|
|
489
|
+
if escaped: escaped = False
|
|
490
|
+
elif char == "\\": escaped = True
|
|
491
|
+
elif (state == "single" and char == "'") or (state == "double" and char == '"') or (state == "template" and char == "`"): state = "code"
|
|
492
|
+
index += 1; continue
|
|
493
|
+
output.append(char); index += 1
|
|
494
|
+
return "".join(output)
|
|
495
|
+
|
|
496
|
+
pagination_code = strip_js_non_code(source_text)
|
|
497
|
+
frontend_code = strip_js_non_code(script)
|
|
498
|
+
has_frontend_detail_access = bool(re.search(r"\brows\b|\bctx\s*\[|\bctx\.data\?*\.hits\?*\.hits\b|\.(?:forEach|map|reduce|filter)\s*\(|for\s*\([^)]*\b(?:of|in)\b", frontend_code, re.IGNORECASE))
|
|
499
|
+
has_metric = bool(re.search(r"count|total|amount|qty|quantity|inventory|stock|sale|销量|库存|项目数|数量|金额|合计|总数", frontend_code, re.IGNORECASE))
|
|
500
|
+
def top_level_returned_objects(code: str) -> list[str]:
|
|
501
|
+
objects: list[str] = []
|
|
502
|
+
scan_depth = 0
|
|
503
|
+
scan_index = 0
|
|
504
|
+
for match in re.finditer(r"\breturn\s*{", code):
|
|
505
|
+
while scan_index < match.start():
|
|
506
|
+
if code[scan_index] == "{": scan_depth += 1
|
|
507
|
+
elif code[scan_index] == "}": scan_depth -= 1
|
|
508
|
+
scan_index += 1
|
|
509
|
+
if scan_depth != 0:
|
|
510
|
+
continue
|
|
511
|
+
start = code.find("{", match.start())
|
|
512
|
+
depth = 0
|
|
513
|
+
for index in range(start, len(code)):
|
|
514
|
+
if code[index] == "{": depth += 1
|
|
515
|
+
elif code[index] == "}": depth -= 1
|
|
516
|
+
if depth == 0:
|
|
517
|
+
objects.append(code[start:index + 1])
|
|
518
|
+
break
|
|
519
|
+
return objects
|
|
520
|
+
|
|
521
|
+
returned_objects = top_level_returned_objects(pagination_code)
|
|
522
|
+
returned_query = returned_objects[0] if len(returned_objects) == 1 else ""
|
|
523
|
+
frontend_returned_objects = top_level_returned_objects(frontend_code)
|
|
524
|
+
frontend_returned_query = frontend_returned_objects[0] if len(frontend_returned_objects) == 1 else ""
|
|
525
|
+
def top_level_properties(object_text: str) -> dict[str, list[str]] | None:
|
|
526
|
+
if not object_text.startswith("{") or not object_text.endswith("}"):
|
|
527
|
+
return None
|
|
528
|
+
entries: list[str] = []
|
|
529
|
+
depth = 0
|
|
530
|
+
start = 1
|
|
531
|
+
for index in range(1, len(object_text) - 1):
|
|
532
|
+
char = object_text[index]
|
|
533
|
+
if char in "{[(": depth += 1
|
|
534
|
+
elif char in "}])": depth -= 1
|
|
535
|
+
elif char == "," and depth == 0:
|
|
536
|
+
entries.append(object_text[start:index]); start = index + 1
|
|
537
|
+
entries.append(object_text[start:-1])
|
|
538
|
+
fields: dict[str, list[str]] = {}
|
|
539
|
+
for entry in entries:
|
|
540
|
+
value = entry.strip()
|
|
541
|
+
if not value:
|
|
542
|
+
continue
|
|
543
|
+
if value.startswith("..."):
|
|
544
|
+
return None
|
|
545
|
+
match = re.fullmatch(r"([A-Za-z_$][\w$]*)\s*:\s*([\s\S]*)", value)
|
|
546
|
+
if not match:
|
|
547
|
+
return None
|
|
548
|
+
fields.setdefault(match.group(1), []).append(match.group(2).strip())
|
|
549
|
+
return fields
|
|
550
|
+
|
|
551
|
+
returned_fields = top_level_properties(returned_query)
|
|
552
|
+
frontend_returned_fields = top_level_properties(frontend_returned_query)
|
|
553
|
+
aggregation_value = (returned_fields.get("aggs") or returned_fields.get("aggregations") or []) if returned_fields else []
|
|
554
|
+
has_aggregation = (
|
|
555
|
+
bool(returned_fields and returned_fields.get("size") == ["0"] and len(aggregation_value) == 1 and aggregation_value[0].strip().startswith("{"))
|
|
556
|
+
if isinstance(data_source, str)
|
|
557
|
+
else isinstance(data_source, dict) and data_source.get("size") == 0
|
|
558
|
+
and (isinstance(data_source.get("aggs"), dict) or isinstance(data_source.get("aggregations"), dict))
|
|
559
|
+
)
|
|
560
|
+
map_receivers = [match.group(1).lower() for match in re.finditer(r"\b([A-Za-z_$][\w$]*)\s*\.\s*map\s*\(", frontend_code, re.IGNORECASE)]
|
|
561
|
+
def unique_frontend_field(name: str) -> str:
|
|
562
|
+
values = frontend_returned_fields.get(name, []) if frontend_returned_fields else []
|
|
563
|
+
return values[0] if len(values) == 1 else ""
|
|
564
|
+
data_expression = unique_frontend_field("data")
|
|
565
|
+
data_map_match = re.fullmatch(r"hits\s*\.\s*map\s*\(\s*\(?\s*([A-Za-z_$][\w$]*)\s*\)?\s*=>\s*\1\s*\.\s*_source\s*\)", data_expression, re.IGNORECASE)
|
|
566
|
+
page_info_fields = top_level_properties(unique_frontend_field("pageInfo"))
|
|
567
|
+
count_values = page_info_fields.get("count", []) if page_info_fields else []
|
|
568
|
+
count_expression = count_values[0] if len(count_values) == 1 else ""
|
|
569
|
+
has_only_trusted_result_map = len(map_receivers) == 1 and map_receivers[0] == "hits" and bool(data_map_match)
|
|
570
|
+
def top_level_prefix_before(code: str, object_text: str) -> str:
|
|
571
|
+
object_index = code.find(object_text) if object_text else -1
|
|
572
|
+
if object_index < 0:
|
|
573
|
+
return ""
|
|
574
|
+
output: list[str] = []
|
|
575
|
+
depth = 0
|
|
576
|
+
for char in code[:object_index]:
|
|
577
|
+
if char == "{": depth += 1; output.append(" "); continue
|
|
578
|
+
if char == "}": depth -= 1; output.append(" "); continue
|
|
579
|
+
output.append(char if depth == 0 else ("\n" if char == "\n" else " "))
|
|
580
|
+
return "".join(output)
|
|
581
|
+
frontend_top_level_prefix = top_level_prefix_before(frontend_code, frontend_returned_query)
|
|
582
|
+
hits_binding_match = re.search(r"\bconst\s+hits\s*=\s*([^;]+);?", frontend_top_level_prefix, re.IGNORECASE)
|
|
583
|
+
hits_binding = hits_binding_match.group(1) if hits_binding_match else ""
|
|
584
|
+
has_trusted_hits_binding = bool(re.fullmatch(r"\s*ctx\.data\?*\.hits\?*\.hits(?:\s*(?:\|\||\?\?)\s*\[\])?\s*", hits_binding, re.IGNORECASE))
|
|
585
|
+
total_binding_match = re.search(r"\bconst\s+total\s*=\s*([^;]+);?", frontend_top_level_prefix, re.IGNORECASE)
|
|
586
|
+
total_binding = total_binding_match.group(1) if total_binding_match else ""
|
|
587
|
+
has_trusted_total_binding = bool(re.fullmatch(r"\s*ctx\.data\?*\.hits\?*\.total\?*\.value(?:\s*(?:\|\||\?\?)\s*0)?\s*", total_binding, re.IGNORECASE)) and count_expression == "total"
|
|
588
|
+
residual_frontend_prefix = frontend_top_level_prefix
|
|
589
|
+
if hits_binding_match: residual_frontend_prefix = residual_frontend_prefix.replace(hits_binding_match.group(0), "", 1)
|
|
590
|
+
if total_binding_match: residual_frontend_prefix = residual_frontend_prefix.replace(total_binding_match.group(0), "", 1)
|
|
591
|
+
has_readonly_frontend_inputs = not re.search(r"\bhits\b|\brows\b|\bctx\s*\[", residual_frontend_prefix, re.IGNORECASE)
|
|
592
|
+
has_disallowed_frontend_loop = bool(
|
|
593
|
+
re.search(r"\.(?:forEach|reduce|filter)\s*\(|for\s*\([^)]*\b(?:of|in)\b", frontend_code)
|
|
594
|
+
) or any(receiver != "hits" for receiver in map_receivers) or bool(
|
|
595
|
+
re.search(r"\)\s*\.\s*map\s*\(", frontend_code, re.IGNORECASE)
|
|
596
|
+
) or bool(re.search(r"\[\s*\]\s*\(", frontend_code)) or (bool(map_receivers) and not has_only_trusted_result_map)
|
|
597
|
+
top_level_prefix = top_level_prefix_before(pagination_code, returned_query)
|
|
598
|
+
top_level_const_declarations = list(re.finditer(r"\bconst\s+([A-Za-z_$][\w$]*)\s*=\s*([^;]+);?", top_level_prefix))
|
|
599
|
+
residual_pagination_prefix = top_level_prefix
|
|
600
|
+
for declaration in top_level_const_declarations:
|
|
601
|
+
residual_pagination_prefix = residual_pagination_prefix.replace(declaration.group(0), "", 1)
|
|
602
|
+
residual_pagination_prefix = re.sub(r"\breturn\s*$", "", residual_pagination_prefix)
|
|
603
|
+
has_only_const_pagination_prefix = not residual_pagination_prefix.strip() and all(
|
|
604
|
+
declaration.group(1) not in ("ctx", "Number") for declaration in top_level_const_declarations
|
|
605
|
+
)
|
|
606
|
+
def assignment(name: str) -> str:
|
|
607
|
+
match = re.search(rf"\bconst\s+{re.escape(name)}\s*=\s*([^;]+)", top_level_prefix)
|
|
608
|
+
if not match:
|
|
609
|
+
return ""
|
|
610
|
+
remaining = top_level_prefix[match.end():]
|
|
611
|
+
if re.search(rf"(?:^|[;\n])\s*{re.escape(name)}\s*=", remaining):
|
|
612
|
+
return ""
|
|
613
|
+
return match.group(1)
|
|
614
|
+
|
|
615
|
+
def unwrap_number(expression: str) -> str:
|
|
616
|
+
value = expression.strip()
|
|
617
|
+
match = re.fullmatch(r"Number\s*\(([\s\S]*)\)", value)
|
|
618
|
+
return (match.group(1) if match else value).strip()
|
|
619
|
+
|
|
620
|
+
def safe_fallback(expression: str, source: re.Pattern[str]) -> bool:
|
|
621
|
+
terms = [term.strip() for term in re.split(r"\|\||\?\?", unwrap_number(expression))]
|
|
622
|
+
if not any(source.fullmatch(term) for term in terms):
|
|
623
|
+
return False
|
|
624
|
+
return all(
|
|
625
|
+
source.fullmatch(term) or (term.isdigit() and 0 < int(term) <= 1000)
|
|
626
|
+
for term in terms
|
|
627
|
+
)
|
|
628
|
+
|
|
629
|
+
def safe_const_expression(expression: str, source: re.Pattern[str], seen: set[str] | None = None) -> bool:
|
|
630
|
+
value = expression.strip()
|
|
631
|
+
if re.fullmatch(r"[A-Za-z_$][\w$]*", value):
|
|
632
|
+
visited = seen or set()
|
|
633
|
+
if value in visited:
|
|
634
|
+
return False
|
|
635
|
+
binding = assignment(value)
|
|
636
|
+
return bool(binding) and safe_const_expression(binding, source, visited | {value})
|
|
637
|
+
return safe_fallback(value, source)
|
|
638
|
+
|
|
639
|
+
def safe_from_expression(expression: str) -> bool:
|
|
640
|
+
value = expression.strip()
|
|
641
|
+
offset_source = re.compile(r"ctx\.pageInfo\?*\.offset")
|
|
642
|
+
if safe_const_expression(value, offset_source):
|
|
643
|
+
return True
|
|
644
|
+
formula = re.fullmatch(r"\(\s*([A-Za-z_$][\w$]*)\s*-\s*1\s*\)\s*\*\s*([A-Za-z_$][\w$]*)", value)
|
|
645
|
+
if not formula:
|
|
646
|
+
return False
|
|
647
|
+
page_source = re.compile(r"ctx\.pageInfo\?*\.(?:page|pageIndex|current)")
|
|
648
|
+
size_source = re.compile(r"(?:ctx\.pageInfo\?*\.pageSize|ctx\.config\?*\.page_size|cfg\.page_size)")
|
|
649
|
+
return safe_const_expression(formula.group(1), page_source) and safe_const_expression(formula.group(2), size_source)
|
|
650
|
+
|
|
651
|
+
def unique_field(name: str) -> str:
|
|
652
|
+
values = returned_fields.get(name, []) if returned_fields else []
|
|
653
|
+
return values[0] if len(values) == 1 else ""
|
|
654
|
+
size_source = re.compile(r"(?:ctx\.pageInfo\?*\.pageSize|ctx\.config\?*\.page_size|cfg\.page_size)")
|
|
655
|
+
page_source = re.compile(r"ctx\.pageInfo\?*\.(?:page|pageIndex|current)")
|
|
656
|
+
offset_source = re.compile(r"ctx\.pageInfo\?*\.offset")
|
|
657
|
+
has_controlled_from = safe_from_expression(unique_field("from"))
|
|
658
|
+
has_controlled_size = safe_const_expression(unique_field("size"), size_source)
|
|
659
|
+
cfg_binding = assignment("cfg")
|
|
660
|
+
has_trusted_cfg_binding = not re.search(r"\bcfg\.page_size\b", top_level_prefix) or bool(
|
|
661
|
+
re.fullmatch(r"ctx\.config(?:\s*\|\|\s*)?", cfg_binding.strip())
|
|
662
|
+
)
|
|
663
|
+
def canonical_pagination_declaration(declaration: re.Match[str]) -> bool:
|
|
664
|
+
name = declaration.group(1)
|
|
665
|
+
expression = declaration.group(2)
|
|
666
|
+
if name == "cfg":
|
|
667
|
+
return bool(re.fullmatch(r"ctx\.config(?:\s*\|\|\s*)?", expression.strip()))
|
|
668
|
+
if name == "pageSize":
|
|
669
|
+
return safe_const_expression(expression, size_source)
|
|
670
|
+
if name == "page":
|
|
671
|
+
return safe_const_expression(expression, page_source)
|
|
672
|
+
if name == "offset":
|
|
673
|
+
return safe_const_expression(expression, offset_source)
|
|
674
|
+
return False
|
|
675
|
+
has_canonical_pagination_declarations = all(canonical_pagination_declaration(item) for item in top_level_const_declarations)
|
|
676
|
+
has_server_pagination = (
|
|
677
|
+
has_controlled_from
|
|
678
|
+
and has_controlled_size
|
|
679
|
+
and has_only_const_pagination_prefix
|
|
680
|
+
and has_trusted_cfg_binding
|
|
681
|
+
and has_canonical_pagination_declarations
|
|
682
|
+
and unique_field("track_total_hits").lower() == "true"
|
|
683
|
+
and has_trusted_hits_binding
|
|
684
|
+
and has_trusted_total_binding
|
|
685
|
+
and has_readonly_frontend_inputs
|
|
686
|
+
and has_only_trusted_result_map
|
|
687
|
+
and not has_disallowed_frontend_loop
|
|
688
|
+
)
|
|
689
|
+
if has_frontend_detail_access and has_metric and not has_aggregation and not has_server_pagination:
|
|
456
690
|
errors.append(f"{module_name} must use ES size: 0 with aggs/aggregations instead of frontend row counting")
|
|
457
691
|
|
|
458
692
|
|
|
@@ -339,6 +339,264 @@ class ConsoleTemplateEditorTests(unittest.TestCase):
|
|
|
339
339
|
self.assertFalse(lint["ok"])
|
|
340
340
|
self.assertTrue(any("frontend row counting" in err for err in lint["errors"]))
|
|
341
341
|
|
|
342
|
+
def test_lint_allows_table_es_server_pagination_with_current_page_mapping(self) -> None:
|
|
343
|
+
work = detail_to_work_payload(make_detail(), workspace="store_mgr", mode="edit")
|
|
344
|
+
work["modules"][1]["config"]["dataSource"] = (
|
|
345
|
+
"const cfg = ctx.config || {}; "
|
|
346
|
+
"const pageSize = Number(ctx.pageInfo?.pageSize || cfg.page_size || 20); "
|
|
347
|
+
"const page = Number(ctx.pageInfo?.page || 1); "
|
|
348
|
+
"return { driver: 'es', data_set_key: 'demo_dataset', "
|
|
349
|
+
"from: (page - 1) * pageSize, size: pageSize, track_total_hits: true };"
|
|
350
|
+
)
|
|
351
|
+
work["modules"][1]["config"]["config"] = (
|
|
352
|
+
"const hits = ctx.data?.hits?.hits || []; "
|
|
353
|
+
"const total = ctx.data?.hits?.total?.value || 0; "
|
|
354
|
+
"return { data: hits.map(hit => hit._source), cols: [], pageInfo: { count: total } };"
|
|
355
|
+
)
|
|
356
|
+
|
|
357
|
+
lint = lint_template_semantics(work, raw_payload=make_detail(), submit_payload=build_submit_payload(work))
|
|
358
|
+
|
|
359
|
+
self.assertTrue(lint["ok"], lint["errors"])
|
|
360
|
+
|
|
361
|
+
def test_lint_rejects_frontend_aggregation_mixed_with_server_pagination(self) -> None:
|
|
362
|
+
work = detail_to_work_payload(make_detail(), workspace="store_mgr", mode="edit")
|
|
363
|
+
work["modules"][1]["config"]["dataSource"] = (
|
|
364
|
+
"return { driver: 'es', data_set_key: 'demo_dataset', "
|
|
365
|
+
"from: 0, size: pageSize, track_total_hits: true };"
|
|
366
|
+
)
|
|
367
|
+
work["modules"][1]["config"]["config"] = (
|
|
368
|
+
"const hits = ctx.data?.hits?.hits || []; "
|
|
369
|
+
"const total = ctx.data?.hits?.total?.value || 0; "
|
|
370
|
+
"const totalAmount = hits.reduce((sum, hit) => sum + Number(hit._source.amount || 0), 0); "
|
|
371
|
+
"return { data: hits.map(hit => hit._source), cols: [], totalAmount, pageInfo: { count: total } };"
|
|
372
|
+
)
|
|
373
|
+
|
|
374
|
+
lint = lint_template_semantics(work, raw_payload=make_detail(), submit_payload=build_submit_payload(work))
|
|
375
|
+
|
|
376
|
+
self.assertFalse(lint["ok"])
|
|
377
|
+
self.assertTrue(any("frontend row counting" in err for err in lint["errors"]))
|
|
378
|
+
|
|
379
|
+
def test_lint_rejects_unbounded_variable_size_as_server_pagination(self) -> None:
|
|
380
|
+
work = detail_to_work_payload(make_detail(), workspace="store_mgr", mode="edit")
|
|
381
|
+
work["modules"][1]["config"]["dataSource"] = (
|
|
382
|
+
"return { driver: 'es', data_set_key: 'demo_dataset', "
|
|
383
|
+
"from: 0, size: total, track_total_hits: true };"
|
|
384
|
+
)
|
|
385
|
+
work["modules"][1]["config"]["config"] = (
|
|
386
|
+
"const hits = ctx.data?.hits?.hits || []; "
|
|
387
|
+
"const total = ctx.data?.hits?.total?.value || 0; "
|
|
388
|
+
"return { data: hits.map(hit => hit._source), cols: [], pageInfo: { count: total } };"
|
|
389
|
+
)
|
|
390
|
+
|
|
391
|
+
lint = lint_template_semantics(work, raw_payload=make_detail(), submit_payload=build_submit_payload(work))
|
|
392
|
+
|
|
393
|
+
self.assertFalse(lint["ok"])
|
|
394
|
+
self.assertTrue(any("frontend row counting" in err for err in lint["errors"]))
|
|
395
|
+
|
|
396
|
+
def test_lint_rejects_pagination_named_variables_without_controlled_bindings(self) -> None:
|
|
397
|
+
work = detail_to_work_payload(make_detail(), workspace="store_mgr", mode="edit")
|
|
398
|
+
work["modules"][1]["config"]["dataSource"] = (
|
|
399
|
+
"const offset = 0; const pageSize = total; "
|
|
400
|
+
"return { driver: 'es', data_set_key: 'demo_dataset', "
|
|
401
|
+
"from: offset, size: pageSize, track_total_hits: true };"
|
|
402
|
+
)
|
|
403
|
+
work["modules"][1]["config"]["config"] = (
|
|
404
|
+
"const hits = ctx.data?.hits?.hits || []; "
|
|
405
|
+
"const total = ctx.data?.hits?.total?.value || 0; "
|
|
406
|
+
"return { data: hits.map(hit => hit._source), cols: [], pageInfo: { count: total } };"
|
|
407
|
+
)
|
|
408
|
+
|
|
409
|
+
lint = lint_template_semantics(work, raw_payload=make_detail(), submit_payload=build_submit_payload(work))
|
|
410
|
+
|
|
411
|
+
self.assertFalse(lint["ok"])
|
|
412
|
+
self.assertTrue(any("frontend row counting" in err for err in lint["errors"]))
|
|
413
|
+
|
|
414
|
+
def test_lint_rejects_reassigned_or_case_colliding_pagination_bindings(self) -> None:
|
|
415
|
+
unsafe_sources = (
|
|
416
|
+
"let pageSize = ctx.pageInfo?.pageSize; pageSize = total; const offset = ctx.pageInfo?.offset; return { driver: 'es', data_set_key: 'demo_dataset', from: offset, size: pageSize, track_total_hits: true };",
|
|
417
|
+
"const pagesize = ctx.pageInfo?.pageSize; const pageSize = total; const offset = ctx.pageInfo?.offset; return { driver: 'es', data_set_key: 'demo_dataset', from: offset, size: pageSize, track_total_hits: true };",
|
|
418
|
+
"const pageSize = ctx.pageInfo?.pageSize || total; const offset = ctx.pageInfo?.offset; return { driver: 'es', data_set_key: 'demo_dataset', from: offset, size: pageSize, track_total_hits: true };",
|
|
419
|
+
"const pageSize = ctx.pageInfo?.pageSize * 0 + 1000000; const offset = ctx.pageInfo?.offset; return { driver: 'es', data_set_key: 'demo_dataset', from: offset, size: pageSize, track_total_hits: true };",
|
|
420
|
+
)
|
|
421
|
+
for source in unsafe_sources:
|
|
422
|
+
with self.subTest(source=source):
|
|
423
|
+
work = detail_to_work_payload(make_detail(), workspace="store_mgr", mode="edit")
|
|
424
|
+
work["modules"][1]["config"]["dataSource"] = source
|
|
425
|
+
work["modules"][1]["config"]["config"] = (
|
|
426
|
+
"const hits = ctx.data?.hits?.hits || []; const total = ctx.data?.hits?.total?.value || 0; "
|
|
427
|
+
"return { data: hits.map(hit => hit._source), cols: [], pageInfo: { count: total } };"
|
|
428
|
+
)
|
|
429
|
+
lint = lint_template_semantics(work, raw_payload=make_detail(), submit_payload=build_submit_payload(work))
|
|
430
|
+
self.assertFalse(lint["ok"])
|
|
431
|
+
|
|
432
|
+
def test_lint_rejects_safe_looking_pagination_bindings_inside_comments_or_strings(self) -> None:
|
|
433
|
+
prefixes = (
|
|
434
|
+
"// const pageSize = ctx.pageInfo?.pageSize || 20;\n",
|
|
435
|
+
"/* const pageSize = ctx.pageInfo?.pageSize || 20; */ ",
|
|
436
|
+
'const decoy = "const pageSize = ctx.pageInfo?.pageSize || 20;"; ',
|
|
437
|
+
)
|
|
438
|
+
for prefix in prefixes:
|
|
439
|
+
with self.subTest(prefix=prefix):
|
|
440
|
+
work = detail_to_work_payload(make_detail(), workspace="store_mgr", mode="edit")
|
|
441
|
+
work["modules"][1]["config"]["dataSource"] = (
|
|
442
|
+
prefix + "const pageSize = 1000000; const offset = ctx.pageInfo?.offset; "
|
|
443
|
+
"return { driver: 'es', data_set_key: 'demo_dataset', from: offset, size: pageSize, track_total_hits: true };"
|
|
444
|
+
)
|
|
445
|
+
work["modules"][1]["config"]["config"] = (
|
|
446
|
+
"const hits = ctx.data?.hits?.hits || []; const total = ctx.data?.hits?.total?.value || 0; "
|
|
447
|
+
"return { data: hits.map(hit => hit._source), cols: [], pageInfo: { count: total } };"
|
|
448
|
+
)
|
|
449
|
+
lint = lint_template_semantics(work, raw_payload=make_detail(), submit_payload=build_submit_payload(work))
|
|
450
|
+
self.assertFalse(lint["ok"])
|
|
451
|
+
|
|
452
|
+
def test_lint_rejects_aggregation_comments_and_decoy_query_objects(self) -> None:
|
|
453
|
+
unsafe_sources = (
|
|
454
|
+
"// aggs: {}, size: 0\nreturn { driver: 'es', data_set_key: 'demo_dataset', from: 0, size: 1000000, track_total_hits: true };",
|
|
455
|
+
"const pageSize = Number(ctx.pageInfo?.pageSize || 20); const offset = ctx.pageInfo?.offset; "
|
|
456
|
+
"const decoy = { from: offset, size: pageSize, track_total_hits: true }; "
|
|
457
|
+
"return { driver: 'es', data_set_key: 'demo_dataset', from: 0, size: 1000000, track_total_hits: true };",
|
|
458
|
+
)
|
|
459
|
+
for source in unsafe_sources:
|
|
460
|
+
with self.subTest(source=source):
|
|
461
|
+
work = detail_to_work_payload(make_detail(), workspace="store_mgr", mode="edit")
|
|
462
|
+
work["modules"][1]["config"]["dataSource"] = source
|
|
463
|
+
work["modules"][1]["config"]["config"] = (
|
|
464
|
+
"const hits = ctx.data?.hits?.hits || []; const total = ctx.data?.hits?.total?.value || 0; "
|
|
465
|
+
"return { data: hits.map(hit => hit._source), cols: [], pageInfo: { count: total } };"
|
|
466
|
+
)
|
|
467
|
+
lint = lint_template_semantics(work, raw_payload=make_detail(), submit_payload=build_submit_payload(work))
|
|
468
|
+
self.assertFalse(lint["ok"])
|
|
469
|
+
|
|
470
|
+
def test_lint_rejects_ambiguous_query_structure_and_frontend_map_side_effects(self) -> None:
|
|
471
|
+
unsafe_sources = (
|
|
472
|
+
"const pageSize = Number(ctx.pageInfo?.pageSize || 20); const offset = ctx.pageInfo?.offset; return { from: offset, size: pageSize, track_total_hits: true, size: 1000000 };",
|
|
473
|
+
"const pageSize = Number(ctx.pageInfo?.pageSize || 20); const offset = ctx.pageInfo?.offset; return { from: offset, size: pageSize, track_total_hits: true, ...unsafe };",
|
|
474
|
+
"const pageSize = Number(ctx.pageInfo?.pageSize || 20); const offset = ctx.pageInfo?.offset; { const pageSize = 1000000; return { from: offset, size: pageSize, track_total_hits: true }; }",
|
|
475
|
+
"const pageSize = ctx.pageInfo?.pageSize; const offset = ctx.pageInfo?.offset; return { from: offset, size: pageSize, track_total_hits: true, 'size': 1000000 };",
|
|
476
|
+
"const pageSize = ctx.pageInfo?.pageSize; const offset = ctx.pageInfo?.offset; const size = 1000000; return { from: offset, size: pageSize, track_total_hits: true, size };",
|
|
477
|
+
)
|
|
478
|
+
for source in unsafe_sources:
|
|
479
|
+
with self.subTest(source=source):
|
|
480
|
+
work = detail_to_work_payload(make_detail(), workspace="store_mgr", mode="edit")
|
|
481
|
+
work["modules"][1]["config"]["dataSource"] = source
|
|
482
|
+
work["modules"][1]["config"]["config"] = (
|
|
483
|
+
"const hits = ctx.data?.hits?.hits || []; const total = ctx.data?.hits?.total?.value || 0; "
|
|
484
|
+
"return { data: hits.map(hit => hit._source), cols: [], pageInfo: { count: total } };"
|
|
485
|
+
)
|
|
486
|
+
lint = lint_template_semantics(work, raw_payload=make_detail(), submit_payload=build_submit_payload(work))
|
|
487
|
+
self.assertFalse(lint["ok"])
|
|
488
|
+
|
|
489
|
+
work = detail_to_work_payload(make_detail(), workspace="store_mgr", mode="edit")
|
|
490
|
+
work["modules"][1]["config"]["dataSource"] = (
|
|
491
|
+
"const pageSize = Number(ctx.pageInfo?.pageSize || 20); const offset = ctx.pageInfo?.offset; "
|
|
492
|
+
"return { from: offset, size: pageSize, track_total_hits: true };"
|
|
493
|
+
)
|
|
494
|
+
work["modules"][1]["config"]["config"] = (
|
|
495
|
+
"let total = 0; ctx.rows.map(row => { total += row.amount || 0; }); "
|
|
496
|
+
"// hits.map( pageInfo: { count:\nreturn { data: ctx.rows, total };"
|
|
497
|
+
)
|
|
498
|
+
lint = lint_template_semantics(work, raw_payload=make_detail(), submit_payload=build_submit_payload(work))
|
|
499
|
+
self.assertFalse(lint["ok"])
|
|
500
|
+
|
|
501
|
+
unsafe_frontend_scripts = (
|
|
502
|
+
"const hits = ctx.rows; let total = 0; const data = hits.map(row => { total += row.amount || 0; return row; }); return { data, pageInfo: { count: total } };",
|
|
503
|
+
"const hits = ctx.data?.hits?.hits || []; const total = ctx.data?.hits?.total?.value || 0; (ctx.rows).map(row => row.amount); return { data: hits.map(hit => hit._source), pageInfo: { count: total } };",
|
|
504
|
+
"const hits = ctx.data?.hits?.hits || []; let total = 0; const data = hits.map(row => { total = total + Number(row._source.amount || 0); return row._source; }); return { data, pageInfo: { count: total } };",
|
|
505
|
+
"const hits = ctx.data?.hits?.hits || []; let total = 0; { const hits = ctx.rows; const data = hits.map(row => { total = total + row.amount; return row; }); return { data, pageInfo: { count: total } }; }",
|
|
506
|
+
"let total = 0; ctx.rows['forEach'](row => { total += row.amount || 0; }); return { data: ctx.rows, total };",
|
|
507
|
+
"return [{ title: '项目数', amount: ctx.rows.length, icon: 'total' }];",
|
|
508
|
+
"let total = 0; const each = 'forEach'; ctx.rows[each](row => { total += row.amount || 0; }); return { data: ctx.rows, total };",
|
|
509
|
+
"let total = 0; ctx.rows['for' + 'Each'](row => { total += row.amount || 0; }); return { data: ctx.rows, total };",
|
|
510
|
+
"let total = 0; Array.prototype.forEach.call(ctx.rows, row => { total += row.amount || 0; }); return { data: ctx.rows, total };",
|
|
511
|
+
"const hits = ctx.data?.hits?.hits || []; return { decoy: hits.map(hit => hit._source), data: ctx.rows, pageInfo: { count: ctx.rows.length } };",
|
|
512
|
+
"return [{ title: '项目数', amount: ctx['rows'].length, icon: 'total' }];",
|
|
513
|
+
"const { rows } = ctx; return [{ title: '项目数', amount: rows.length, icon: 'total' }];",
|
|
514
|
+
"const hits = ctx.data?.hits?.hits || []; const total = ctx.data?.hits?.total?.value || 0; hits.push(...ctx.rows); return { data: hits.map(hit => hit._source), pageInfo: { count: total } };",
|
|
515
|
+
"const hits = ctx.data?.hits?.hits || []; const total = ctx.data?.hits?.total?.value || 0; hits.map = () => ctx.rows; return { data: hits.map(hit => hit._source), pageInfo: { count: total } };",
|
|
516
|
+
)
|
|
517
|
+
for script in unsafe_frontend_scripts:
|
|
518
|
+
with self.subTest(script=script):
|
|
519
|
+
work = detail_to_work_payload(make_detail(), workspace="store_mgr", mode="edit")
|
|
520
|
+
work["modules"][1]["config"]["dataSource"] = (
|
|
521
|
+
"const pageSize = ctx.pageInfo?.pageSize; const offset = ctx.pageInfo?.offset; "
|
|
522
|
+
"return { from: offset, size: pageSize, track_total_hits: true };"
|
|
523
|
+
)
|
|
524
|
+
work["modules"][1]["config"]["config"] = script
|
|
525
|
+
lint = lint_template_semantics(work, raw_payload=make_detail(), submit_payload=build_submit_payload(work))
|
|
526
|
+
self.assertFalse(lint["ok"])
|
|
527
|
+
|
|
528
|
+
work = detail_to_work_payload(make_detail(), workspace="store_mgr", mode="edit")
|
|
529
|
+
work["modules"][1]["config"]["dataSource"] = (
|
|
530
|
+
"const pageSize = ctx.pageInfo?.pageSize; const offset = ctx.pageInfo?.offset; "
|
|
531
|
+
"return { 'from': offset, 'size': pageSize, 'track_total_hits': true };"
|
|
532
|
+
)
|
|
533
|
+
work["modules"][1]["config"]["config"] = (
|
|
534
|
+
"const hits = ctx.data?.hits?.hits || []; const total = ctx.data?.hits?.total?.value || 0; "
|
|
535
|
+
"return { data: hits.map(hit => hit._source), pageInfo: { count: total } };"
|
|
536
|
+
)
|
|
537
|
+
lint = lint_template_semantics(work, raw_payload=make_detail(), submit_payload=build_submit_payload(work))
|
|
538
|
+
self.assertTrue(lint["ok"], lint["errors"])
|
|
539
|
+
|
|
540
|
+
for source in (
|
|
541
|
+
"const cfg = { page_size: 1000000 }; const pageSize = cfg.page_size; const offset = ctx.pageInfo?.offset; return { from: offset, size: pageSize, track_total_hits: true };",
|
|
542
|
+
"ctx.pageInfo.pageSize = 1000000; const pageSize = ctx.pageInfo.pageSize; const offset = ctx.pageInfo.offset; return { from: offset, size: pageSize, track_total_hits: true };",
|
|
543
|
+
"const evil = (ctx.pageInfo.pageSize = 1000000); const pageSize = ctx.pageInfo.pageSize; const offset = ctx.pageInfo.offset; return { from: offset, size: pageSize, track_total_hits: true };",
|
|
544
|
+
"const evil = ctx.rows.reduce((value, row) => value + row.amount, 0); const pageSize = ctx.pageInfo.pageSize; const offset = ctx.pageInfo.offset; return { from: offset, size: pageSize, track_total_hits: true };",
|
|
545
|
+
):
|
|
546
|
+
with self.subTest(source=source):
|
|
547
|
+
work = detail_to_work_payload(make_detail(), workspace="store_mgr", mode="edit")
|
|
548
|
+
work["modules"][1]["config"]["dataSource"] = source
|
|
549
|
+
work["modules"][1]["config"]["config"] = (
|
|
550
|
+
"const hits = ctx.data?.hits?.hits ?? []; const total = ctx.data?.hits?.total?.value ?? 0; "
|
|
551
|
+
"return { data: hits.map((hit) => hit._source), pageInfo: { count: total } };"
|
|
552
|
+
)
|
|
553
|
+
lint = lint_template_semantics(work, raw_payload=make_detail(), submit_payload=build_submit_payload(work))
|
|
554
|
+
self.assertFalse(lint["ok"])
|
|
555
|
+
|
|
556
|
+
work = detail_to_work_payload(make_detail(), workspace="store_mgr", mode="edit")
|
|
557
|
+
work["modules"][1]["config"]["dataSource"] = (
|
|
558
|
+
"const pageSize = ctx.pageInfo?.pageSize; const offset = ctx.pageInfo?.offset; "
|
|
559
|
+
"return { from: offset, size: pageSize, track_total_hits: true };"
|
|
560
|
+
)
|
|
561
|
+
work["modules"][1]["config"]["config"] = (
|
|
562
|
+
"const hits = ctx.data?.hits?.hits ?? []; const total = ctx.data?.hits?.total?.value ?? 0; "
|
|
563
|
+
"return { data: hits.map((hit) => hit._source), pageInfo: { count: total } };"
|
|
564
|
+
)
|
|
565
|
+
lint = lint_template_semantics(work, raw_payload=make_detail(), submit_payload=build_submit_payload(work))
|
|
566
|
+
self.assertTrue(lint["ok"], lint["errors"])
|
|
567
|
+
|
|
568
|
+
def test_lint_does_not_accept_nested_object_size_zero_as_aggregation(self) -> None:
|
|
569
|
+
work = detail_to_work_payload(make_detail(), workspace="store_mgr", mode="edit")
|
|
570
|
+
work["modules"][1]["config"]["dataSource"] = {"driver": "es", "size": 1000000, "note": {"size": 0}}
|
|
571
|
+
work["modules"][1]["config"]["config"] = (
|
|
572
|
+
"const rows = ctx.data?.hits?.hits || []; return rows.map(row => ({ title: row._source.name, amount: row._source.total }));"
|
|
573
|
+
)
|
|
574
|
+
lint = lint_template_semantics(work, raw_payload=make_detail(), submit_payload=build_submit_payload(work))
|
|
575
|
+
self.assertFalse(lint["ok"])
|
|
576
|
+
|
|
577
|
+
for source in (
|
|
578
|
+
"return { driver: 'es', size: 1000000, aggs: null };",
|
|
579
|
+
"return { driver: 'es', size: 0, aggs: {}, size: 1000000 };",
|
|
580
|
+
):
|
|
581
|
+
with self.subTest(source=source):
|
|
582
|
+
work = detail_to_work_payload(make_detail(), workspace="store_mgr", mode="edit")
|
|
583
|
+
work["modules"][1]["config"]["dataSource"] = source
|
|
584
|
+
work["modules"][1]["config"]["config"] = (
|
|
585
|
+
"const rows = ctx.data?.hits?.hits || []; return rows.map(row => ({ title: row._source.name, amount: row._source.total }));"
|
|
586
|
+
)
|
|
587
|
+
lint = lint_template_semantics(work, raw_payload=make_detail(), submit_payload=build_submit_payload(work))
|
|
588
|
+
self.assertFalse(lint["ok"])
|
|
589
|
+
|
|
590
|
+
work = detail_to_work_payload(make_detail(), workspace="store_mgr", mode="edit")
|
|
591
|
+
work["modules"][1]["config"]["dataSource"] = {
|
|
592
|
+
"driver": "es", "size": 0, "aggs": None, "aggregations": {}
|
|
593
|
+
}
|
|
594
|
+
work["modules"][1]["config"]["config"] = (
|
|
595
|
+
"const rows = ctx.data?.hits?.hits || []; return rows.map(row => ({ title: row._source.name, amount: row._source.total }));"
|
|
596
|
+
)
|
|
597
|
+
lint = lint_template_semantics(work, raw_payload=make_detail(), submit_payload=build_submit_payload(work))
|
|
598
|
+
self.assertTrue(lint["ok"], lint["errors"])
|
|
599
|
+
|
|
342
600
|
def test_lint_rejects_object_project_list_waiver_to_match_typed_cli(self) -> None:
|
|
343
601
|
work = detail_to_work_payload(make_detail(), workspace="store_mgr", mode="edit")
|
|
344
602
|
work["modules"][0]["config"]["dataSource"] = {
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: bpmax-flow-detail-template-editor
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
description: "Use the typed CLI when discovering, creating, editing, reading back, or verifying BPMAX flow_page_template type=5 flow report/document templates."
|
|
5
|
+
metadata:
|
|
6
|
+
requires:
|
|
7
|
+
bins: ["bpmax-cli"]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# BPMAX Flow Report Template Editor
|
|
11
|
+
|
|
12
|
+
该 Skill 管理 `report_template` 编辑器使用的 `flow_page_template type=5` 流程报告/文档模板。`flow-detail-template` 是为兼容既有 issue 和命令体系保留的 CLI 名称,不表示页面布局型“流程详情模板”。
|
|
13
|
+
|
|
14
|
+
## 边界
|
|
15
|
+
|
|
16
|
+
- type=5 流程报告/文档模板使用 `config flow-detail-template`。
|
|
17
|
+
- type=2 项目详情模板使用 `config project-detail-template`。
|
|
18
|
+
- type=6 环节详情模板使用 `config step-detail-template`,并由流程节点 `step_detail_id` 引用。
|
|
19
|
+
- 三种模板不得混用;不得用 type=5 ID 填充 `node.step_detail_id`。
|
|
20
|
+
- 配置写入只能通过 typed CLI 完成,不得直接修改 `think_flow_page_template` 文件,也不得用 raw API 绕过门禁。
|
|
21
|
+
- 不知道模板 ID 时,必须先按 `flow_type/flow_key` 使用 typed list 发现,不能猜测 ID。
|
|
22
|
+
|
|
23
|
+
## 标准流程
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
bpmax-cli config flow-detail-template list --flow-type <flow_type> --flow-key <flow_key> --profile <profile> --format json
|
|
27
|
+
bpmax-cli config flow-detail-template export --id <id> --profile <profile> --out <dir> --format json
|
|
28
|
+
bpmax-cli config flow-detail-template lint --work <work.json> --format json
|
|
29
|
+
bpmax-cli config flow-detail-template build --work <work.json> --meta <meta.json> --out <submit.json> --format json
|
|
30
|
+
bpmax-cli config flow-detail-template submit --id <id> --payload <submit.json> --profile <profile> --format json
|
|
31
|
+
bpmax-cli config flow-detail-template verify --id <id> --profile <profile> --format json
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
新建时使用 `config flow-detail-template create` 生成 work/meta,再执行 lint、build 和带精确确认文本的 submit。删除同样必须先 dry-run,再复制 CLI 返回的确认文本。
|
|
35
|
+
|
|
36
|
+
## 门禁
|
|
37
|
+
|
|
38
|
+
- work 和 readback 的 `type` 必须为 `5`。
|
|
39
|
+
- `content` 必须是 `{ fields, templateFile }`:`fields[]` 的 `field/desc/expression` 均为非空字符串且 field 不重复;`templateFile[]` 至少包含一个带 `name/url` 的文件。
|
|
40
|
+
- 平台生成报告时只读取 `templateFile[0]`;配置多个文件时必须确认第一个文件就是实际生效文件。
|
|
41
|
+
- 必须保留 `flow_type`、`flow_key`、`data_set_id` 和报告表达式的原有语义,不得套用 type=2/type=6 的 layout 模块规则。
|
|
42
|
+
- lint/build/submit/verify 任一步失败都不能宣称配置完成。
|
|
43
|
+
- 完成后必须保留 typed readback hash;涉及真实展示效果时,再补充运行态页面证据。
|
|
@@ -83,6 +83,11 @@
|
|
|
83
83
|
- `node.cc_user_by_script`
|
|
84
84
|
- “抄送消息自定义”
|
|
85
85
|
- `node.cc_message_template`
|
|
86
|
+
- “WEWF `signorder=4` / 确认型抄送 / acknowledged CC”
|
|
87
|
+
- 当前已验证的 BPMAX 节点字段没有“抄送人必须提交确认后才完成”的独立参与通道,必须标记 `cc_ack_not_supported` 并停止等价迁移。
|
|
88
|
+
- `need_confirm` 只控制环节负责人接收任务,不会把普通 CC 变成确认参与人。
|
|
89
|
+
- 不得降级成普通 CC,也不得提升成普通审批人;两者都会改变源流程的参与与完成语义。
|
|
90
|
+
- 只有平台 capability、typed export/readback 或插件契约明确出现对应参与通道后,才能补充映射并做运行态回测。
|
|
86
91
|
|
|
87
92
|
## 消息模板
|
|
88
93
|
- “节点完成后发通知”
|
|
@@ -107,6 +107,12 @@
|
|
|
107
107
|
### `step_detail_id`
|
|
108
108
|
- 节点详情模板不是 `detail_template`,当前页面已验证使用 `step_detail_id`。
|
|
109
109
|
|
|
110
|
+
### 确认型抄送边界
|
|
111
|
+
- WEWF `signorder=4` 表示的确认型抄送当前没有已验证的 BPMAX 对等字段,迁移结论必须是 `cc_ack_not_supported`。
|
|
112
|
+
- `need_confirm` 是环节负责人接收任务的开关,不是抄送确认开关。
|
|
113
|
+
- `cc_user`、`cc_user_role` 可能存在于历史 export 字段中,但当前服务端已验证的有效普通 CC 运行模式只有 `cc_type=fieldvalue` + `cc_user_by_script` 和 `cc_type=matrix` + `cc_matrix`;普通 CC 不贡献确认完成。
|
|
114
|
+
- 不得用普通审批人替代确认型抄送,因为这会引入审批阈值、通过和拒绝语义。
|
|
115
|
+
|
|
110
116
|
### `attachment_required`
|
|
111
117
|
- 对应“配置附件要求”。
|
|
112
118
|
- 当前页未配置时为 `[]`,不是 `null`。
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Adapted from https://github.com/phatnguyen975/functional-test-design
|
|
2
|
+
Upstream commit: 7837e80199847a8fb46f53fed5cc23826f7fa8da
|
|
3
|
+
|
|
4
|
+
MIT License
|
|
5
|
+
|
|
6
|
+
Copyright (c) 2026 Nguyễn Tấn Phát
|
|
7
|
+
|
|
8
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
10
|
+
in the Software without restriction, including without limitation the rights
|
|
11
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
furnished to do so, subject to the following conditions:
|
|
14
|
+
|
|
15
|
+
The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
copies or substantial portions of the Software.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
SOFTWARE.
|