bpmax-cli 0.1.43 → 0.1.44-beta.1
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 +3 -3
- package/dist/bin.js +3397 -433
- package/dist/bin.js.map +1 -1
- package/package.json +1 -1
- package/skills/bpmax-api-platform-editor/SKILL.md +321 -0
- package/skills/bpmax-api-platform-editor/agents/openai.yaml +4 -0
- package/skills/bpmax-api-platform-editor/references/api-doc-debug-workflow.md +34 -0
- package/skills/bpmax-api-platform-editor/references/api-proxy-shape.md +41 -0
- package/skills/bpmax-api-platform-editor/references/instance-config-shape.md +41 -0
- package/skills/bpmax-api-platform-editor/references/platform-api-map.md +52 -0
- package/skills/bpmax-api-platform-editor/references/runtime-workflow.md +32 -0
- package/skills/bpmax-api-platform-editor/scripts/api_platform_editor_common.py +1276 -0
- package/skills/bpmax-api-platform-editor/scripts/build_submit_payload.py +64 -0
- package/skills/bpmax-api-platform-editor/scripts/capture_write_contract.py +40 -0
- package/skills/bpmax-api-platform-editor/scripts/export_layer_bundle.py +212 -0
- package/skills/bpmax-api-platform-editor/scripts/record_doc_debug_acceptance.py +62 -0
- package/skills/bpmax-api-platform-editor/scripts/submit_and_verify_layer.py +75 -0
- package/skills/bpmax-api-platform-editor/tests/test_api_platform_editor.py +287 -0
- package/skills/bpmax-auth/SKILL.md +6 -17
- package/skills/bpmax-builder-shared/SKILL.md +44 -0
- package/skills/bpmax-builder-shared/base_url.py +81 -0
- package/skills/bpmax-builder-shared/runtime-script-site-matrix.json +71 -0
- package/skills/bpmax-builder-shared/runtime-script-site-matrix.md +34 -0
- package/skills/bpmax-builder-shared/runtime-script-template-catalog.md +123 -0
- package/skills/bpmax-builder-shared/runtime_script_rules.py +272 -0
- package/skills/bpmax-builder-shared/skill_audit.py +374 -0
- package/skills/bpmax-builder-shared/template_script_hard_rules.py +280 -0
- package/skills/bpmax-builder-shared/tests/test_base_url.py +80 -0
- package/skills/bpmax-builder-shared/tests/test_runtime_script_rules.py +115 -0
- package/skills/bpmax-builder-shared/tests/test_skill_audit.py +231 -0
- package/skills/bpmax-builder-shared/tests/test_template_script_hard_rules.py +281 -0
- package/skills/bpmax-cli/SKILL.md +2 -0
- package/skills/bpmax-config-latest/SKILL.md +71 -0
- package/skills/bpmax-console-template-editor/SKILL.md +536 -0
- package/skills/bpmax-console-template-editor/agents/openai.yaml +4 -0
- package/skills/bpmax-console-template-editor/references/filter-integration.md +60 -0
- package/skills/bpmax-console-template-editor/references/lessons-from-resume-dashboard.md +114 -0
- package/skills/bpmax-console-template-editor/references/local-temp-workflow.md +69 -0
- package/skills/bpmax-console-template-editor/references/module-catalog.md +100 -0
- package/skills/bpmax-console-template-editor/references/runtime-page-shape.md +91 -0
- package/skills/bpmax-console-template-editor/references/template-shape.md +149 -0
- package/skills/bpmax-console-template-editor/scripts/build_submit_payload.py +38 -0
- package/skills/bpmax-console-template-editor/scripts/confirm_console_template.py +33 -0
- package/skills/bpmax-console-template-editor/scripts/console_template_editor_common.py +964 -0
- package/skills/bpmax-console-template-editor/scripts/export_console_template.py +99 -0
- package/skills/bpmax-console-template-editor/scripts/lint_console_template.py +46 -0
- package/skills/bpmax-console-template-editor/scripts/submit_console_template.py +99 -0
- package/skills/bpmax-console-template-editor/tests/test_console_template_editor.py +383 -0
- package/skills/bpmax-dataset-field-template-editor/SKILL.md +600 -0
- package/skills/bpmax-dataset-field-template-editor/references/create-request-gotchas.md +25 -0
- package/skills/bpmax-dataset-field-template-editor/references/field-classify-mapping.md +35 -0
- package/skills/bpmax-dataset-field-template-editor/references/nested-field-patterns.md +24 -0
- package/skills/bpmax-dataset-field-template-editor/references/runtime-verified-field-page-shape.md +61 -0
- package/skills/bpmax-dataset-field-template-editor/references/virtual-field-patterns.md +27 -0
- package/skills/bpmax-dataset-field-template-editor/references/work-file-to-submit-mapping.md +127 -0
- package/skills/bpmax-dataset-field-template-editor/scripts/build_submit_payload.py +67 -0
- package/skills/bpmax-dataset-field-template-editor/scripts/confirm_dataset_field.py +37 -0
- package/skills/bpmax-dataset-field-template-editor/scripts/dataset_field_editor_common.py +784 -0
- package/skills/bpmax-dataset-field-template-editor/scripts/export_dataset_field.py +62 -0
- package/skills/bpmax-dataset-field-template-editor/scripts/init_create_dataset_field.py +104 -0
- package/skills/bpmax-dataset-field-template-editor/scripts/inspect_dataset_field_runtime.py +83 -0
- package/skills/bpmax-dataset-field-template-editor/scripts/lint_dataset_field_semantics.py +35 -0
- package/skills/bpmax-dataset-field-template-editor/scripts/submit_dataset_field.py +95 -0
- package/skills/bpmax-dataset-field-template-editor/tests/test_dataset_field_editor.py +709 -0
- package/skills/bpmax-dataset-field-template-editor/tests/test_init_create_dataset_field.py +59 -0
- package/skills/bpmax-dataset-template-editor/SKILL.md +779 -0
- package/skills/bpmax-dataset-template-editor/references/custom-key-usage-patterns.md +18 -0
- package/skills/bpmax-dataset-template-editor/references/dataset-script-runtime-matrix.md +73 -0
- package/skills/bpmax-dataset-template-editor/references/pre-process-script-authoring-guide.md +186 -0
- package/skills/bpmax-dataset-template-editor/references/pre-process-script-example-catalog.md +106 -0
- package/skills/bpmax-dataset-template-editor/references/runtime-gotchas.md +28 -0
- package/skills/bpmax-dataset-template-editor/references/runtime-verified-dataset-page-shape.md +47 -0
- package/skills/bpmax-dataset-template-editor/references/ui-to-backend-field-map.md +23 -0
- package/skills/bpmax-dataset-template-editor/references/work-file-to-submit-mapping.md +97 -0
- package/skills/bpmax-dataset-template-editor/scripts/basic_table_audit.py +65 -0
- package/skills/bpmax-dataset-template-editor/scripts/build_submit_payload.py +38 -0
- package/skills/bpmax-dataset-template-editor/scripts/dataset_editor_common.py +650 -0
- package/skills/bpmax-dataset-template-editor/scripts/export_dataset.py +155 -0
- package/skills/bpmax-dataset-template-editor/scripts/lint_dataset_template.py +42 -0
- package/skills/bpmax-dataset-template-editor/scripts/resolve_dataset.py +43 -0
- package/skills/bpmax-dataset-template-editor/scripts/scan_custom_key_references.py +27 -0
- package/skills/bpmax-dataset-template-editor/scripts/submit_dataset.py +115 -0
- package/skills/bpmax-dataset-template-editor/scripts/verify_dataset_list.py +52 -0
- package/skills/bpmax-dataset-template-editor/scripts/verify_publish_health.py +39 -0
- package/skills/bpmax-dataset-template-editor/tests/test_dataset_editor.py +373 -0
- package/skills/bpmax-e2e-flow-config-orchestrator/SKILL.md +151 -0
- package/skills/bpmax-e2e-flow-config-orchestrator/agents/openai.yaml +4 -0
- package/skills/bpmax-e2e-flow-config-orchestrator/references/orchestration-matrix.md +60 -0
- package/skills/bpmax-e2e-flow-test-operator/SKILL.md +371 -0
- package/skills/bpmax-e2e-flow-test-operator/agents/openai.yaml +5 -0
- package/skills/bpmax-e2e-flow-test-operator/profiles/negative_sale.json +97 -0
- package/skills/bpmax-e2e-flow-test-operator/profiles/negative_sale_final_v2.json +105 -0
- package/skills/bpmax-e2e-flow-test-operator/profiles/negative_sale_main.json +36 -0
- package/skills/bpmax-e2e-flow-test-operator/profiles/negative_sale_region.json +40 -0
- package/skills/bpmax-e2e-flow-test-operator/references/browser-only-checkpoints.md +33 -0
- package/skills/bpmax-e2e-flow-test-operator/references/failure-update-loop.md +17 -0
- package/skills/bpmax-e2e-flow-test-operator/references/filter-field-discovery.md +40 -0
- package/skills/bpmax-e2e-flow-test-operator/references/minimal-test-loop.md +19 -0
- package/skills/bpmax-e2e-flow-test-operator/references/negative-sale-api-matrix.md +75 -0
- package/skills/bpmax-e2e-flow-test-operator/references/profile-schema.md +107 -0
- package/skills/bpmax-e2e-flow-test-operator/references/skill-experience-coverage-matrix.md +29 -0
- package/skills/bpmax-e2e-flow-test-operator/references/stale-runtime-and-clean-sample-rules.md +54 -0
- package/skills/bpmax-e2e-flow-test-operator/references/state-schema.md +58 -0
- package/skills/bpmax-e2e-flow-test-operator/scripts/bpmax_session.py +287 -0
- package/skills/bpmax-e2e-flow-test-operator/scripts/dealer_sample_on_shelf_plan.json +59 -0
- package/skills/bpmax-e2e-flow-test-operator/scripts/dealer_sample_on_shelf_runner.py +687 -0
- package/skills/bpmax-e2e-flow-test-operator/scripts/e2e_doc.py +95 -0
- package/skills/bpmax-e2e-flow-test-operator/scripts/e2e_state.py +288 -0
- package/skills/bpmax-e2e-flow-test-operator/scripts/flow_api_matrix.py +161 -0
- package/skills/bpmax-e2e-flow-test-operator/scripts/flow_filter_fields.py +138 -0
- package/skills/bpmax-e2e-flow-test-operator/scripts/flow_form_runtime.py +396 -0
- package/skills/bpmax-e2e-flow-test-operator/scripts/flow_runner.py +341 -0
- package/skills/bpmax-e2e-flow-test-operator/scripts/flow_test_profile.py +185 -0
- package/skills/bpmax-e2e-flow-test-operator/tests/test_negative_sale_api_tools.py +138 -0
- package/skills/bpmax-feishu-chat-flow-plugin-editor/SKILL.md +69 -0
- package/skills/bpmax-feishu-chat-flow-plugin-editor/agents/openai.yaml +4 -0
- package/skills/bpmax-feishu-chat-flow-plugin-editor/references/config-checklist.md +42 -0
- package/skills/bpmax-feishu-chat-flow-plugin-editor/references/config-recipes.md +38 -0
- package/skills/bpmax-feishu-chat-flow-plugin-editor/references/config-shape.md +86 -0
- package/skills/bpmax-feishu-chat-flow-plugin-editor/references/gate-lint.md +68 -0
- package/skills/bpmax-feishu-chat-flow-plugin-editor/references/hoocoo-patterns.md +39 -0
- package/skills/bpmax-feishu-chat-flow-plugin-editor/references/runtime-behavior.md +41 -0
- package/skills/bpmax-feishu-chat-flow-plugin-editor/references/script-authoring.md +110 -0
- package/skills/bpmax-feishu-chat-flow-plugin-editor/scripts/lint_feishu_chat_plugin.py +278 -0
- package/skills/bpmax-feishu-chat-flow-plugin-editor/tests/test_lint_feishu_chat_plugin.py +203 -0
- package/skills/bpmax-filter-template-editor/SKILL.md +564 -0
- package/skills/bpmax-filter-template-editor/references/experience-coverage-matrix.md +38 -0
- package/skills/bpmax-filter-template-editor/references/filter-and-flow-binding.md +57 -0
- package/skills/bpmax-filter-template-editor/references/filter-content-schema.md +141 -0
- package/skills/bpmax-filter-template-editor/references/filter-request-shape.md +287 -0
- package/skills/bpmax-filter-template-editor/references/filter-runtime-patterns.md +115 -0
- package/skills/bpmax-filter-template-editor/references/runtime-verified-filter-page-shape.md +94 -0
- package/skills/bpmax-filter-template-editor/scripts/build_submit_payload.py +25 -0
- package/skills/bpmax-filter-template-editor/scripts/confirm_filter_template.py +22 -0
- package/skills/bpmax-filter-template-editor/scripts/export_filter_template.py +57 -0
- package/skills/bpmax-filter-template-editor/scripts/filter_template_editor_common.py +348 -0
- package/skills/bpmax-filter-template-editor/scripts/init_create_filter_template.py +8 -0
- package/skills/bpmax-filter-template-editor/scripts/lint_filter_template_semantics.py +26 -0
- package/skills/bpmax-filter-template-editor/scripts/submit_filter_template.py +62 -0
- package/skills/bpmax-filter-template-editor/tests/test_filter_template_editor.py +231 -0
- package/skills/bpmax-flow-template-editor/SKILL.md +1043 -0
- package/skills/bpmax-flow-template-editor/agents/openai.yaml +4 -0
- package/skills/bpmax-flow-template-editor/references/before-next-step-script-runtime-gotchas.md +62 -0
- package/skills/bpmax-flow-template-editor/references/config-surfaces-and-placeholders.md +270 -0
- package/skills/bpmax-flow-template-editor/references/diff-strategy.md +67 -0
- package/skills/bpmax-flow-template-editor/references/editor-runtime-vs-draft.md +25 -0
- package/skills/bpmax-flow-template-editor/references/flow-template-api-workflow.md +159 -0
- package/skills/bpmax-flow-template-editor/references/intent-model.md +117 -0
- package/skills/bpmax-flow-template-editor/references/lessons-from-price-plan-flow.md +147 -0
- package/skills/bpmax-flow-template-editor/references/local-temp-workflow.md +97 -0
- package/skills/bpmax-flow-template-editor/references/matrix-flow-form-nav-collaboration.md +163 -0
- package/skills/bpmax-flow-template-editor/references/payload-checklist.md +133 -0
- package/skills/bpmax-flow-template-editor/references/project-create-runtime-gotchas.md +54 -0
- package/skills/bpmax-flow-template-editor/references/requirement-to-node-mapping.md +149 -0
- package/skills/bpmax-flow-template-editor/references/runtime-verified-flow-detail-shape.md +41 -0
- package/skills/bpmax-flow-template-editor/references/runtime-verified-meta-fields.md +155 -0
- package/skills/bpmax-flow-template-editor/references/runtime-verified-node-fields.md +179 -0
- package/skills/bpmax-flow-template-editor/references/save-draft-request-shape.md +91 -0
- package/skills/bpmax-flow-template-editor/references/script-review-hard-rules.md +93 -0
- package/skills/bpmax-flow-template-editor/references/work-file-to-submit-mapping.md +57 -0
- package/skills/bpmax-flow-template-editor/scripts/build_submit_payload.py +69 -0
- package/skills/bpmax-flow-template-editor/scripts/confirm_flow_template.py +52 -0
- package/skills/bpmax-flow-template-editor/scripts/export_flow_template.py +114 -0
- package/skills/bpmax-flow-template-editor/scripts/flow_template_editor_common.py +1084 -0
- package/skills/bpmax-flow-template-editor/scripts/submit_flow_template.py +159 -0
- package/skills/bpmax-flow-template-editor/tests/test_flow_template_editor.py +636 -0
- package/skills/bpmax-form-template-editor/SKILL.md +1074 -0
- package/skills/bpmax-form-template-editor/agents/openai.yaml +4 -0
- package/skills/bpmax-form-template-editor/references/form-template-api-workflow.md +193 -0
- package/skills/bpmax-form-template-editor/references/local-temp-workflow.md +125 -0
- package/skills/bpmax-form-template-editor/references/payload-checklist.md +77 -0
- package/skills/bpmax-form-template-editor/references/sub-form-patterns.md +49 -0
- package/skills/bpmax-form-template-editor/scripts/build_submit_payload.py +37 -0
- package/skills/bpmax-form-template-editor/scripts/check_form_template_consistency.py +145 -0
- package/skills/bpmax-form-template-editor/scripts/confirm_form_template.py +67 -0
- package/skills/bpmax-form-template-editor/scripts/export_form_template.py +89 -0
- package/skills/bpmax-form-template-editor/scripts/form_template_editor_common.py +1745 -0
- package/skills/bpmax-form-template-editor/scripts/lint_form_template_semantics.py +30 -0
- package/skills/bpmax-form-template-editor/scripts/record_runtime_acceptance.py +67 -0
- package/skills/bpmax-form-template-editor/scripts/submit_form_template.py +163 -0
- package/skills/bpmax-form-template-editor/tests/test_form_template_editor.py +1303 -0
- package/skills/bpmax-list-template-editor/SKILL.md +468 -0
- package/skills/bpmax-list-template-editor/agents/openai.yaml +4 -0
- package/skills/bpmax-list-template-editor/references/browser-page-contract.md +81 -0
- package/skills/bpmax-list-template-editor/references/content-config-shape.md +148 -0
- package/skills/bpmax-list-template-editor/references/dataset-field-mapping.md +60 -0
- package/skills/bpmax-list-template-editor/references/list-template-api-workflow.md +103 -0
- package/skills/bpmax-list-template-editor/references/local-temp-workflow.md +102 -0
- package/skills/bpmax-list-template-editor/references/payload-checklist.md +47 -0
- package/skills/bpmax-list-template-editor/references/runtime-verified-workflow.md +140 -0
- package/skills/bpmax-list-template-editor/references/special-formats.md +394 -0
- package/skills/bpmax-list-template-editor/scripts/build_submit_payload.py +37 -0
- package/skills/bpmax-list-template-editor/scripts/confirm_list_template.py +33 -0
- package/skills/bpmax-list-template-editor/scripts/export_list_template.py +89 -0
- package/skills/bpmax-list-template-editor/scripts/fetch_data_set.py +34 -0
- package/skills/bpmax-list-template-editor/scripts/lint_list_template_semantics.py +54 -0
- package/skills/bpmax-list-template-editor/scripts/list_template_editor_common.py +955 -0
- package/skills/bpmax-list-template-editor/scripts/record_acceptance.py +55 -0
- package/skills/bpmax-list-template-editor/scripts/submit_list_template.py +117 -0
- package/skills/bpmax-list-template-editor/tests/test_list_template_editor_common.py +441 -0
- package/skills/bpmax-nav-config-editor/SKILL.md +347 -0
- package/skills/bpmax-nav-config-editor/agents/openai.yaml +4 -0
- package/skills/bpmax-nav-config-editor/references/api-workflow.md +68 -0
- package/skills/bpmax-nav-config-editor/references/config-shape.md +78 -0
- package/skills/bpmax-nav-config-editor/references/icon-selection.md +83 -0
- package/skills/bpmax-nav-config-editor/references/path-mapping-rules.md +46 -0
- package/skills/bpmax-nav-config-editor/references/payload-checklist.md +41 -0
- package/skills/bpmax-nav-config-editor/references/runtime-probing.md +47 -0
- package/skills/bpmax-nav-config-editor/scripts/build_submit_payload.py +34 -0
- package/skills/bpmax-nav-config-editor/scripts/confirm_nav_config.py +32 -0
- package/skills/bpmax-nav-config-editor/scripts/export_nav_config.py +56 -0
- package/skills/bpmax-nav-config-editor/scripts/lint_nav_config_semantics.py +33 -0
- package/skills/bpmax-nav-config-editor/scripts/nav_config_editor_common.py +812 -0
- package/skills/bpmax-nav-config-editor/scripts/submit_nav_config.py +44 -0
- package/skills/bpmax-nav-config-editor/scripts/verify_nav_config.py +33 -0
- package/skills/bpmax-nav-config-editor/tests/test_nav_config_editor.py +358 -0
- package/skills/bpmax-nav-config-editor/tests/test_nav_config_editor_common.py +138 -0
- package/skills/bpmax-nav-config-editor/tests/test_nav_config_lint.py +58 -0
- package/skills/bpmax-nav-config-editor/tests/test_nav_config_submit_verify.py +51 -0
- package/skills/bpmax-project/SKILL.md +1 -1
- package/skills/bpmax-project-detail-template-editor/SKILL.md +329 -0
- package/skills/bpmax-project-detail-template-editor/agents/openai.yaml +4 -0
- package/skills/bpmax-project-detail-template-editor/references/local-temp-workflow.md +59 -0
- package/skills/bpmax-project-detail-template-editor/references/module-catalog-and-config-notes.md +47 -0
- package/skills/bpmax-project-detail-template-editor/references/payload-checklist.md +33 -0
- package/skills/bpmax-project-detail-template-editor/references/project-detail-template-api-workflow.md +44 -0
- package/skills/bpmax-project-detail-template-editor/scripts/build_submit_payload.py +30 -0
- package/skills/bpmax-project-detail-template-editor/scripts/confirm_project_detail_template.py +33 -0
- package/skills/bpmax-project-detail-template-editor/scripts/export_project_detail_template.py +87 -0
- package/skills/bpmax-project-detail-template-editor/scripts/lint_project_detail_template_semantics.py +37 -0
- package/skills/bpmax-project-detail-template-editor/scripts/project_detail_template_editor_common.py +507 -0
- package/skills/bpmax-project-detail-template-editor/scripts/submit_project_detail_template.py +120 -0
- package/skills/bpmax-project-detail-template-editor/tests/test_project_detail_template_editor.py +369 -0
- package/skills/bpmax-role-editor/SKILL.md +251 -0
- package/skills/bpmax-role-editor/references/api-workflow.md +30 -0
- package/skills/bpmax-role-editor/references/runtime-page-shape.md +18 -0
- package/skills/bpmax-role-editor/references/work-file-mapping.md +32 -0
- package/skills/bpmax-role-editor/scripts/build_submit_payload.py +38 -0
- package/skills/bpmax-role-editor/scripts/confirm_role.py +33 -0
- package/skills/bpmax-role-editor/scripts/export_role.py +163 -0
- package/skills/bpmax-role-editor/scripts/lint_role_semantics.py +38 -0
- package/skills/bpmax-role-editor/scripts/role_editor_common.py +1231 -0
- package/skills/bpmax-role-editor/scripts/submit_role.py +144 -0
- package/skills/bpmax-role-editor/tests/test_role_editor.py +343 -0
- package/skills/bpmax-shared/SKILL.md +1 -1
- package/skills/form-control-library/SKILL.md +82 -0
- package/skills/form-control-library/agents/openai.yaml +4 -0
- package/skills/form-control-library/references/form-controls.md +199 -0
- package/skills/form-control-library/references/form-template-submit-schema.md +180 -0
- package/skills/form-control-library/references/group-select-runtime.md +191 -0
- package/skills/form-control-library/scripts/rebuild_form_control_library.py +55 -0
|
@@ -0,0 +1,709 @@
|
|
|
1
|
+
import hashlib
|
|
2
|
+
import json
|
|
3
|
+
import sys
|
|
4
|
+
import tempfile
|
|
5
|
+
import unittest
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
SCRIPT_DIR = Path(__file__).resolve().parents[1] / "scripts"
|
|
10
|
+
if str(SCRIPT_DIR) not in sys.path:
|
|
11
|
+
sys.path.insert(0, str(SCRIPT_DIR))
|
|
12
|
+
|
|
13
|
+
from dataset_field_editor_common import (
|
|
14
|
+
build_submit_payload,
|
|
15
|
+
build_create_submit_payload,
|
|
16
|
+
build_create_seed_detail,
|
|
17
|
+
detail_to_work_payload,
|
|
18
|
+
ensure_submission_allowed,
|
|
19
|
+
lint_dataset_field_semantics,
|
|
20
|
+
make_create_artifact_id,
|
|
21
|
+
load_json,
|
|
22
|
+
dump_json,
|
|
23
|
+
validate_work_payload,
|
|
24
|
+
update_build_meta,
|
|
25
|
+
update_confirmation_state,
|
|
26
|
+
update_lint_meta,
|
|
27
|
+
summarize_verification,
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class DatasetFieldEditorCommonTests(unittest.TestCase):
|
|
32
|
+
def test_project_field_detail_maps_to_human_editable_work_payload(self) -> None:
|
|
33
|
+
detail = {
|
|
34
|
+
"id": 5328,
|
|
35
|
+
"key": "status",
|
|
36
|
+
"name": "状态",
|
|
37
|
+
"type": "keyword",
|
|
38
|
+
"classify": "project",
|
|
39
|
+
"source_table": "think_project",
|
|
40
|
+
"source_field": "status",
|
|
41
|
+
"source_fk": "project_id",
|
|
42
|
+
"source_filter": "{}",
|
|
43
|
+
"source_relation_table": "",
|
|
44
|
+
"source_relation_field": "",
|
|
45
|
+
"source_relation_fk": "",
|
|
46
|
+
"source_relation_filter": "{}",
|
|
47
|
+
"relation_flow": {},
|
|
48
|
+
"post_script": "",
|
|
49
|
+
"flow_type": "flow182032078",
|
|
50
|
+
"flow_key": "",
|
|
51
|
+
"source_computed": "",
|
|
52
|
+
"match_rule": "",
|
|
53
|
+
"match_logic": "",
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
work = detail_to_work_payload(detail)
|
|
57
|
+
|
|
58
|
+
self.assertEqual(work["id"], 5328)
|
|
59
|
+
self.assertEqual(work["name"], "状态")
|
|
60
|
+
self.assertEqual(work["flowType"], "flow182032078")
|
|
61
|
+
self.assertEqual(work["flowKey"], "")
|
|
62
|
+
self.assertEqual(work["source"]["table"], "think_project")
|
|
63
|
+
self.assertEqual(work["source"]["field"], "status")
|
|
64
|
+
self.assertEqual(work["source"]["fk"], "project_id")
|
|
65
|
+
self.assertEqual(work["postScript"], "")
|
|
66
|
+
|
|
67
|
+
def test_virtual_work_payload_builds_camel_case_submit_payload(self) -> None:
|
|
68
|
+
work = {
|
|
69
|
+
"id": 6001,
|
|
70
|
+
"name": "发起人",
|
|
71
|
+
"key": "project_owner",
|
|
72
|
+
"type": "keyword",
|
|
73
|
+
"classify": "virtual",
|
|
74
|
+
"flowType": "flow926597430",
|
|
75
|
+
"flowKey": "",
|
|
76
|
+
"source": {
|
|
77
|
+
"filter": "{}",
|
|
78
|
+
"relationTable": "",
|
|
79
|
+
"relationField": "",
|
|
80
|
+
"relationFk": "",
|
|
81
|
+
"relationFilter": "{}",
|
|
82
|
+
"relationFlow": {},
|
|
83
|
+
},
|
|
84
|
+
"virtual": {
|
|
85
|
+
"sql": "select * from dual where id in ($IDS)",
|
|
86
|
+
"outputField": "name",
|
|
87
|
+
"joinField": "project_id",
|
|
88
|
+
},
|
|
89
|
+
"postScript": "",
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
payload = build_submit_payload(work)
|
|
93
|
+
|
|
94
|
+
self.assertEqual(payload["classify"], "virtual")
|
|
95
|
+
self.assertEqual(payload["sourceTable"], "select * from dual where id in ($IDS)")
|
|
96
|
+
self.assertEqual(payload["sourceField"], "name")
|
|
97
|
+
self.assertEqual(payload["sourceFk"], "project_id")
|
|
98
|
+
self.assertEqual(payload["flowType"], "flow926597430")
|
|
99
|
+
self.assertNotIn("flowKey", payload)
|
|
100
|
+
|
|
101
|
+
def test_make_create_artifact_id_sanitizes_flow_and_key(self) -> None:
|
|
102
|
+
artifact_id = make_create_artifact_id("flow876464415", "product_series_code")
|
|
103
|
+
|
|
104
|
+
self.assertEqual(artifact_id, "create__flow876464415__product_series_code")
|
|
105
|
+
|
|
106
|
+
def test_build_create_seed_detail_uses_snake_case_and_omits_empty_flow_key(self) -> None:
|
|
107
|
+
seed = build_create_seed_detail(
|
|
108
|
+
name="产品系列编码",
|
|
109
|
+
key="product_series_code",
|
|
110
|
+
field_type="keyword",
|
|
111
|
+
classify="project",
|
|
112
|
+
flow_type="flow876464415",
|
|
113
|
+
flow_key="",
|
|
114
|
+
source_table="think_form_field",
|
|
115
|
+
source_field="search_value",
|
|
116
|
+
source_fk="project_id",
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
self.assertEqual(seed["flow_type"], "flow876464415")
|
|
120
|
+
self.assertNotIn("flow_key", seed)
|
|
121
|
+
self.assertEqual(seed["source_table"], "think_form_field")
|
|
122
|
+
self.assertEqual(seed["source_field"], "search_value")
|
|
123
|
+
|
|
124
|
+
def test_nested_work_payload_keeps_post_script_and_omits_empty_flow_key(self) -> None:
|
|
125
|
+
work = {
|
|
126
|
+
"id": 7001,
|
|
127
|
+
"name": "二级部门负责人",
|
|
128
|
+
"key": "secondaryDepartmentHead",
|
|
129
|
+
"type": "nested",
|
|
130
|
+
"classify": "project",
|
|
131
|
+
"flowType": "flow214439719",
|
|
132
|
+
"flowKey": "",
|
|
133
|
+
"source": {
|
|
134
|
+
"table": "think_form_field",
|
|
135
|
+
"field": "search_value",
|
|
136
|
+
"fk": "project_id",
|
|
137
|
+
"filter": "{}",
|
|
138
|
+
"relationTable": "",
|
|
139
|
+
"relationField": "",
|
|
140
|
+
"relationFk": "",
|
|
141
|
+
"relationFilter": "{}",
|
|
142
|
+
"relationFlow": {},
|
|
143
|
+
},
|
|
144
|
+
"postScript": "if (!ctx.value) { return {}; }\nreturn JSON.parse(ctx.value);",
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
payload = build_submit_payload(work)
|
|
148
|
+
|
|
149
|
+
self.assertEqual(payload["type"], "nested")
|
|
150
|
+
self.assertEqual(payload["postScript"], "if (!ctx.value) { return {}; }\nreturn JSON.parse(ctx.value);")
|
|
151
|
+
self.assertEqual(payload["sourceField"], "search_value")
|
|
152
|
+
self.assertNotIn("flowKey", payload)
|
|
153
|
+
|
|
154
|
+
def test_build_create_submit_payload_uses_snake_case(self) -> None:
|
|
155
|
+
work = {
|
|
156
|
+
"id": None,
|
|
157
|
+
"name": "产品系列编码",
|
|
158
|
+
"key": "product_series_code",
|
|
159
|
+
"type": "keyword",
|
|
160
|
+
"classify": "project",
|
|
161
|
+
"flowType": "flow876464415",
|
|
162
|
+
"flowKey": "",
|
|
163
|
+
"source": {
|
|
164
|
+
"table": "think_form_field",
|
|
165
|
+
"field": "search_value",
|
|
166
|
+
"fk": "project_id",
|
|
167
|
+
"filter": "{\n \"key\": \"product_series_code\"\n}",
|
|
168
|
+
"relationTable": "",
|
|
169
|
+
"relationField": "",
|
|
170
|
+
"relationFk": "",
|
|
171
|
+
"relationFilter": "{}",
|
|
172
|
+
"relationFlow": "",
|
|
173
|
+
},
|
|
174
|
+
"postScript": "",
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
payload = build_create_submit_payload(work)
|
|
178
|
+
|
|
179
|
+
self.assertEqual(payload["flow_type"], "flow876464415")
|
|
180
|
+
self.assertEqual(payload["source_table"], "think_form_field")
|
|
181
|
+
self.assertEqual(payload["source_field"], "search_value")
|
|
182
|
+
self.assertEqual(payload["source_fk"], "project_id")
|
|
183
|
+
self.assertEqual(payload["post_script"], "")
|
|
184
|
+
self.assertNotIn("flow_key", payload)
|
|
185
|
+
self.assertNotIn("flowType", payload)
|
|
186
|
+
self.assertNotIn("sourceTable", payload)
|
|
187
|
+
|
|
188
|
+
def test_build_create_submit_payload_omits_advanced_when_absent(self) -> None:
|
|
189
|
+
work = {
|
|
190
|
+
"id": None,
|
|
191
|
+
"name": "产品系列名称",
|
|
192
|
+
"key": "product_series_name",
|
|
193
|
+
"type": "keyword",
|
|
194
|
+
"classify": "project",
|
|
195
|
+
"flowType": "flow876464415",
|
|
196
|
+
"flowKey": "",
|
|
197
|
+
"source": {
|
|
198
|
+
"table": "think_form_field",
|
|
199
|
+
"field": "search_value",
|
|
200
|
+
"fk": "project_id",
|
|
201
|
+
"filter": "{}",
|
|
202
|
+
"relationTable": "",
|
|
203
|
+
"relationField": "",
|
|
204
|
+
"relationFk": "",
|
|
205
|
+
"relationFilter": "{}",
|
|
206
|
+
"relationFlow": "",
|
|
207
|
+
},
|
|
208
|
+
"postScript": "",
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
payload = build_create_submit_payload(work)
|
|
212
|
+
|
|
213
|
+
self.assertNotIn("source_computed", payload)
|
|
214
|
+
self.assertNotIn("match_rule", payload)
|
|
215
|
+
self.assertNotIn("match_logic", payload)
|
|
216
|
+
|
|
217
|
+
def test_virtual_work_requires_sql_output_and_join_fields(self) -> None:
|
|
218
|
+
work = {
|
|
219
|
+
"classify": "virtual",
|
|
220
|
+
"type": "keyword",
|
|
221
|
+
"flowType": "flow1",
|
|
222
|
+
"source": {},
|
|
223
|
+
"virtual": {
|
|
224
|
+
"sql": "select name from dual",
|
|
225
|
+
"outputField": "name",
|
|
226
|
+
"joinField": "",
|
|
227
|
+
},
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
with self.assertRaises(SystemExit):
|
|
231
|
+
validate_work_payload(work, mode="edit")
|
|
232
|
+
|
|
233
|
+
def test_virtual_sql_must_reference_join_field(self) -> None:
|
|
234
|
+
work = {
|
|
235
|
+
"classify": "virtual",
|
|
236
|
+
"type": "keyword",
|
|
237
|
+
"flowType": "flow1",
|
|
238
|
+
"source": {},
|
|
239
|
+
"virtual": {
|
|
240
|
+
"sql": "select name from dual",
|
|
241
|
+
"outputField": "name",
|
|
242
|
+
"joinField": "project_id",
|
|
243
|
+
},
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
with self.assertRaises(SystemExit):
|
|
247
|
+
validate_work_payload(work, mode="create")
|
|
248
|
+
|
|
249
|
+
def test_nested_string_source_requires_post_script(self) -> None:
|
|
250
|
+
work = {
|
|
251
|
+
"classify": "project",
|
|
252
|
+
"type": "nested",
|
|
253
|
+
"flowType": "flow1",
|
|
254
|
+
"source": {
|
|
255
|
+
"table": "think_form_field",
|
|
256
|
+
"field": "search_value",
|
|
257
|
+
},
|
|
258
|
+
"postScript": "",
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
with self.assertRaises(SystemExit):
|
|
262
|
+
validate_work_payload(work, mode="edit")
|
|
263
|
+
|
|
264
|
+
def test_verification_detects_mismatched_readback(self) -> None:
|
|
265
|
+
submit_payload = {
|
|
266
|
+
"name": "状态",
|
|
267
|
+
"key": "status",
|
|
268
|
+
"type": "keyword",
|
|
269
|
+
"classify": "project",
|
|
270
|
+
"sourceTable": "think_project",
|
|
271
|
+
"sourceField": "status",
|
|
272
|
+
"sourceFk": "project_id",
|
|
273
|
+
"sourceFilter": "{}",
|
|
274
|
+
"sourceRelationTable": "",
|
|
275
|
+
"sourceRelationField": "",
|
|
276
|
+
"sourceRelationFk": "",
|
|
277
|
+
"sourceRelationFilter": "{}",
|
|
278
|
+
"relationFlow": {},
|
|
279
|
+
"postScript": "",
|
|
280
|
+
}
|
|
281
|
+
readback = {
|
|
282
|
+
"name": "状态",
|
|
283
|
+
"key": "status",
|
|
284
|
+
"type": "keyword",
|
|
285
|
+
"classify": "project",
|
|
286
|
+
"source_table": "think_project",
|
|
287
|
+
"source_field": "status_name",
|
|
288
|
+
"source_fk": "project_id",
|
|
289
|
+
"source_filter": "{}",
|
|
290
|
+
"source_relation_table": "",
|
|
291
|
+
"source_relation_field": "",
|
|
292
|
+
"source_relation_fk": "",
|
|
293
|
+
"source_relation_filter": "{}",
|
|
294
|
+
"relation_flow": {},
|
|
295
|
+
"post_script": "",
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
verify = summarize_verification(submit_payload, readback)
|
|
299
|
+
|
|
300
|
+
self.assertFalse(verify["ok"])
|
|
301
|
+
self.assertEqual(verify["checks"]["sourceField"]["expected"], "status")
|
|
302
|
+
self.assertEqual(verify["checks"]["sourceField"]["actual"], "status_name")
|
|
303
|
+
|
|
304
|
+
def test_lint_blocks_project_list_in_post_script(self) -> None:
|
|
305
|
+
work = {
|
|
306
|
+
"id": 5328,
|
|
307
|
+
"name": "状态",
|
|
308
|
+
"key": "status",
|
|
309
|
+
"type": "keyword",
|
|
310
|
+
"classify": "project",
|
|
311
|
+
"flowType": "flow182032078",
|
|
312
|
+
"flowKey": "",
|
|
313
|
+
"source": {
|
|
314
|
+
"table": "think_project",
|
|
315
|
+
"field": "status",
|
|
316
|
+
"fk": "project_id",
|
|
317
|
+
"filter": "{}",
|
|
318
|
+
"relationTable": "",
|
|
319
|
+
"relationField": "",
|
|
320
|
+
"relationFk": "",
|
|
321
|
+
"relationFilter": "{}",
|
|
322
|
+
"relationFlow": {},
|
|
323
|
+
},
|
|
324
|
+
"postScript": "return ctx.$axios.post('/bpmax/project/list?page=1', { flow_type: 'flow5328', query: {} });",
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
report = lint_dataset_field_semantics(work, mode="edit")
|
|
328
|
+
|
|
329
|
+
self.assertFalse(report["ok"])
|
|
330
|
+
self.assertTrue(any("project/list" in item for item in report["errors"]))
|
|
331
|
+
|
|
332
|
+
def test_build_submit_payload_omits_advanced_when_work_file_does_not_include_it(self) -> None:
|
|
333
|
+
work = {
|
|
334
|
+
"id": 5328,
|
|
335
|
+
"name": "经销商编码",
|
|
336
|
+
"key": "robo_salechannelcode",
|
|
337
|
+
"type": "keyword",
|
|
338
|
+
"classify": "project",
|
|
339
|
+
"flowType": "flow956693507",
|
|
340
|
+
"flowKey": "",
|
|
341
|
+
"source": {
|
|
342
|
+
"table": "think_form_field",
|
|
343
|
+
"field": "search_value",
|
|
344
|
+
"fk": "project_id",
|
|
345
|
+
"filter": "{\n \"key\": \"robo_salechannelcode\"\n}",
|
|
346
|
+
"relationTable": "",
|
|
347
|
+
"relationField": "",
|
|
348
|
+
"relationFk": "",
|
|
349
|
+
"relationFilter": "{}",
|
|
350
|
+
"relationFlow": "",
|
|
351
|
+
},
|
|
352
|
+
"postScript": "",
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
payload = build_submit_payload(work)
|
|
356
|
+
|
|
357
|
+
self.assertNotIn("sourceComputed", payload)
|
|
358
|
+
self.assertNotIn("matchRule", payload)
|
|
359
|
+
self.assertNotIn("matchLogic", payload)
|
|
360
|
+
|
|
361
|
+
def test_build_submit_payload_preserves_explicit_empty_advanced_values(self) -> None:
|
|
362
|
+
work = {
|
|
363
|
+
"id": 5328,
|
|
364
|
+
"name": "经销商编码",
|
|
365
|
+
"key": "robo_salechannelcode",
|
|
366
|
+
"type": "keyword",
|
|
367
|
+
"classify": "project",
|
|
368
|
+
"flowType": "flow956693507",
|
|
369
|
+
"flowKey": "",
|
|
370
|
+
"source": {
|
|
371
|
+
"table": "think_form_field",
|
|
372
|
+
"field": "search_value",
|
|
373
|
+
"fk": "project_id",
|
|
374
|
+
"filter": "{}",
|
|
375
|
+
"relationTable": "",
|
|
376
|
+
"relationField": "",
|
|
377
|
+
"relationFk": "",
|
|
378
|
+
"relationFilter": "{}",
|
|
379
|
+
"relationFlow": "",
|
|
380
|
+
},
|
|
381
|
+
"postScript": "",
|
|
382
|
+
"advanced": {
|
|
383
|
+
"sourceComputed": "",
|
|
384
|
+
"matchRule": "",
|
|
385
|
+
"matchLogic": "",
|
|
386
|
+
},
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
payload = build_submit_payload(work)
|
|
390
|
+
|
|
391
|
+
self.assertIn("sourceComputed", payload)
|
|
392
|
+
self.assertEqual(payload["sourceComputed"], "")
|
|
393
|
+
self.assertIn("matchRule", payload)
|
|
394
|
+
self.assertEqual(payload["matchRule"], "")
|
|
395
|
+
self.assertIn("matchLogic", payload)
|
|
396
|
+
self.assertEqual(payload["matchLogic"], "")
|
|
397
|
+
|
|
398
|
+
def test_verification_tracks_advanced_fields_and_normalizes_null_post_script(self) -> None:
|
|
399
|
+
submit_payload = {
|
|
400
|
+
"name": "经销商编码",
|
|
401
|
+
"key": "robo_salechannelcode",
|
|
402
|
+
"type": "keyword",
|
|
403
|
+
"classify": "project",
|
|
404
|
+
"sourceTable": "think_form_field",
|
|
405
|
+
"sourceField": "search_value",
|
|
406
|
+
"sourceFk": "project_id",
|
|
407
|
+
"sourceFilter": "{\n \"key\": \"robo_salechannelcode\"\n}",
|
|
408
|
+
"sourceRelationTable": "",
|
|
409
|
+
"sourceRelationField": "",
|
|
410
|
+
"sourceRelationFk": "",
|
|
411
|
+
"sourceRelationFilter": "{}",
|
|
412
|
+
"relationFlow": "",
|
|
413
|
+
"postScript": "",
|
|
414
|
+
"matchRule": "",
|
|
415
|
+
"matchLogic": "strict",
|
|
416
|
+
}
|
|
417
|
+
readback = {
|
|
418
|
+
"name": "经销商编码",
|
|
419
|
+
"key": "robo_salechannelcode",
|
|
420
|
+
"type": "keyword",
|
|
421
|
+
"classify": "project",
|
|
422
|
+
"source_table": "think_form_field",
|
|
423
|
+
"source_field": "search_value",
|
|
424
|
+
"source_fk": "project_id",
|
|
425
|
+
"source_filter": "{\n \"key\": \"robo_salechannelcode\"\n}",
|
|
426
|
+
"source_relation_table": "",
|
|
427
|
+
"source_relation_field": "",
|
|
428
|
+
"source_relation_fk": "",
|
|
429
|
+
"source_relation_filter": "{}",
|
|
430
|
+
"relation_flow": "",
|
|
431
|
+
"post_script": None,
|
|
432
|
+
"match_rule": "",
|
|
433
|
+
"match_logic": "strict",
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
verify = summarize_verification(submit_payload, readback)
|
|
437
|
+
|
|
438
|
+
self.assertTrue(verify["ok"])
|
|
439
|
+
self.assertEqual(verify["advancedChecks"]["matchLogic"]["actual"], "strict")
|
|
440
|
+
self.assertEqual(verify["checks"]["postScript"]["actual"], "")
|
|
441
|
+
self.assertIn("matchLogic", verify["submittedFields"])
|
|
442
|
+
|
|
443
|
+
def test_verification_supports_create_payload_shape(self) -> None:
|
|
444
|
+
submit_payload = {
|
|
445
|
+
"name": "产品系列编码",
|
|
446
|
+
"key": "product_series_code",
|
|
447
|
+
"type": "keyword",
|
|
448
|
+
"classify": "project",
|
|
449
|
+
"flow_type": "flow876464415",
|
|
450
|
+
"source_table": "think_form_field",
|
|
451
|
+
"source_field": "search_value",
|
|
452
|
+
"source_fk": "project_id",
|
|
453
|
+
"source_filter": "{}",
|
|
454
|
+
"source_relation_table": "",
|
|
455
|
+
"source_relation_field": "",
|
|
456
|
+
"source_relation_fk": "",
|
|
457
|
+
"source_relation_filter": "{}",
|
|
458
|
+
"relation_flow": "",
|
|
459
|
+
"post_script": "",
|
|
460
|
+
}
|
|
461
|
+
readback = {
|
|
462
|
+
"name": "产品系列编码",
|
|
463
|
+
"key": "product_series_code",
|
|
464
|
+
"type": "keyword",
|
|
465
|
+
"classify": "project",
|
|
466
|
+
"flow_type": "flow876464415",
|
|
467
|
+
"source_table": "think_form_field",
|
|
468
|
+
"source_field": "search_value",
|
|
469
|
+
"source_fk": "project_id",
|
|
470
|
+
"source_filter": "{}",
|
|
471
|
+
"source_relation_table": "",
|
|
472
|
+
"source_relation_field": "",
|
|
473
|
+
"source_relation_fk": "",
|
|
474
|
+
"source_relation_filter": "{}",
|
|
475
|
+
"relation_flow": "",
|
|
476
|
+
"post_script": "",
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
verify = summarize_verification(submit_payload, readback)
|
|
480
|
+
|
|
481
|
+
self.assertTrue(verify["ok"])
|
|
482
|
+
self.assertEqual(verify["checks"]["sourceField"]["expected"], "search_value")
|
|
483
|
+
self.assertIn("flowType", verify["submittedFields"])
|
|
484
|
+
|
|
485
|
+
def test_verification_records_readback_only_advanced_fields_without_failing(self) -> None:
|
|
486
|
+
submit_payload = {
|
|
487
|
+
"name": "经销商编码",
|
|
488
|
+
"key": "robo_salechannelcode",
|
|
489
|
+
"type": "keyword",
|
|
490
|
+
"classify": "project",
|
|
491
|
+
"sourceTable": "think_form_field",
|
|
492
|
+
"sourceField": "search_value",
|
|
493
|
+
"sourceFk": "project_id",
|
|
494
|
+
"sourceFilter": "{}",
|
|
495
|
+
"sourceRelationTable": "",
|
|
496
|
+
"sourceRelationField": "",
|
|
497
|
+
"sourceRelationFk": "",
|
|
498
|
+
"sourceRelationFilter": "{}",
|
|
499
|
+
"relationFlow": "",
|
|
500
|
+
"postScript": "",
|
|
501
|
+
}
|
|
502
|
+
readback = {
|
|
503
|
+
"name": "经销商编码",
|
|
504
|
+
"key": "robo_salechannelcode",
|
|
505
|
+
"type": "keyword",
|
|
506
|
+
"classify": "project",
|
|
507
|
+
"source_table": "think_form_field",
|
|
508
|
+
"source_field": "search_value",
|
|
509
|
+
"source_fk": "project_id",
|
|
510
|
+
"source_filter": "{}",
|
|
511
|
+
"source_relation_table": "",
|
|
512
|
+
"source_relation_field": "",
|
|
513
|
+
"source_relation_fk": "",
|
|
514
|
+
"source_relation_filter": "{}",
|
|
515
|
+
"relation_flow": "",
|
|
516
|
+
"post_script": "",
|
|
517
|
+
"match_rule": "legacy",
|
|
518
|
+
"match_logic": "strict",
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
verify = summarize_verification(submit_payload, readback)
|
|
522
|
+
|
|
523
|
+
self.assertTrue(verify["ok"])
|
|
524
|
+
self.assertEqual(verify["readbackOnlyFields"]["matchRule"], "legacy")
|
|
525
|
+
self.assertEqual(verify["readbackOnlyFields"]["matchLogic"], "strict")
|
|
526
|
+
self.assertNotIn("matchRule", verify["checks"])
|
|
527
|
+
self.assertEqual(verify["advancedChecks"], {})
|
|
528
|
+
|
|
529
|
+
def test_submission_gate_requires_confirmed_state_and_matching_hashes(self) -> None:
|
|
530
|
+
with tempfile.TemporaryDirectory() as tmpdir:
|
|
531
|
+
root = Path(tmpdir)
|
|
532
|
+
work_path = root / "work.json"
|
|
533
|
+
submit_path = root / "submit.json"
|
|
534
|
+
meta_path = root / "meta.json"
|
|
535
|
+
work_payload = {"name": "work-v1"}
|
|
536
|
+
submit_payload = {"name": "submit-v1"}
|
|
537
|
+
work_path.write_text(json.dumps(work_payload, ensure_ascii=False), encoding="utf-8")
|
|
538
|
+
submit_path.write_text(json.dumps(submit_payload, ensure_ascii=False), encoding="utf-8")
|
|
539
|
+
meta_path.write_text(json.dumps({"fieldId": 5328}, ensure_ascii=False), encoding="utf-8")
|
|
540
|
+
|
|
541
|
+
with self.assertRaises(SystemExit):
|
|
542
|
+
ensure_submission_allowed(meta_path, work_path, submit_path)
|
|
543
|
+
|
|
544
|
+
update_confirmation_state(
|
|
545
|
+
meta_path,
|
|
546
|
+
field_id=5328,
|
|
547
|
+
actor="tester",
|
|
548
|
+
stage="work",
|
|
549
|
+
work_path=work_path,
|
|
550
|
+
)
|
|
551
|
+
with self.assertRaises(SystemExit):
|
|
552
|
+
ensure_submission_allowed(meta_path, work_path, submit_path)
|
|
553
|
+
|
|
554
|
+
update_build_meta(
|
|
555
|
+
meta_path,
|
|
556
|
+
field_id=5328,
|
|
557
|
+
work_path=work_path,
|
|
558
|
+
submit_path=submit_path,
|
|
559
|
+
submit_payload=submit_payload,
|
|
560
|
+
)
|
|
561
|
+
update_confirmation_state(
|
|
562
|
+
meta_path,
|
|
563
|
+
field_id=5328,
|
|
564
|
+
actor="tester",
|
|
565
|
+
stage="submit",
|
|
566
|
+
work_path=work_path,
|
|
567
|
+
submit_path=submit_path,
|
|
568
|
+
)
|
|
569
|
+
lint_path = root / "lint.json"
|
|
570
|
+
dump_json(lint_path, {"ok": True, "errors": [], "warnings": [], "checks": {}})
|
|
571
|
+
update_lint_meta(
|
|
572
|
+
meta_path,
|
|
573
|
+
field_id=5328,
|
|
574
|
+
submit_path=submit_path,
|
|
575
|
+
lint_path=lint_path,
|
|
576
|
+
lint_report={"ok": True},
|
|
577
|
+
)
|
|
578
|
+
meta = load_json(meta_path)
|
|
579
|
+
self.assertEqual(meta["status"], "submit_confirmed")
|
|
580
|
+
self.assertEqual(
|
|
581
|
+
meta["submitSha256"],
|
|
582
|
+
hashlib.sha256(submit_path.read_bytes()).hexdigest(),
|
|
583
|
+
)
|
|
584
|
+
ensure_submission_allowed(meta_path, work_path, submit_path)
|
|
585
|
+
|
|
586
|
+
submit_path.write_text(json.dumps({"name": "submit-v2"}, ensure_ascii=False), encoding="utf-8")
|
|
587
|
+
with self.assertRaises(SystemExit):
|
|
588
|
+
ensure_submission_allowed(meta_path, work_path, submit_path)
|
|
589
|
+
|
|
590
|
+
def test_create_submission_gate_does_not_require_remote_field_id(self) -> None:
|
|
591
|
+
with tempfile.TemporaryDirectory() as tmpdir:
|
|
592
|
+
root = Path(tmpdir)
|
|
593
|
+
work_path = root / "work.json"
|
|
594
|
+
submit_path = root / "submit.json"
|
|
595
|
+
meta_path = root / "meta.json"
|
|
596
|
+
work_path.write_text(json.dumps({"name": "work-v1"}, ensure_ascii=False), encoding="utf-8")
|
|
597
|
+
submit_path.write_text(json.dumps({"name": "submit-v1"}, ensure_ascii=False), encoding="utf-8")
|
|
598
|
+
meta_path.write_text(
|
|
599
|
+
json.dumps(
|
|
600
|
+
{
|
|
601
|
+
"artifactId": "create__flow876464415__product_series_code",
|
|
602
|
+
"mode": "create",
|
|
603
|
+
},
|
|
604
|
+
ensure_ascii=False,
|
|
605
|
+
),
|
|
606
|
+
encoding="utf-8",
|
|
607
|
+
)
|
|
608
|
+
|
|
609
|
+
update_confirmation_state(
|
|
610
|
+
meta_path,
|
|
611
|
+
field_id="create__flow876464415__product_series_code",
|
|
612
|
+
actor="tester",
|
|
613
|
+
stage="work",
|
|
614
|
+
work_path=work_path,
|
|
615
|
+
)
|
|
616
|
+
update_build_meta(
|
|
617
|
+
meta_path,
|
|
618
|
+
field_id="create__flow876464415__product_series_code",
|
|
619
|
+
work_path=work_path,
|
|
620
|
+
submit_path=submit_path,
|
|
621
|
+
submit_payload={"name": "submit-v1"},
|
|
622
|
+
)
|
|
623
|
+
update_confirmation_state(
|
|
624
|
+
meta_path,
|
|
625
|
+
field_id="create__flow876464415__product_series_code",
|
|
626
|
+
actor="tester",
|
|
627
|
+
stage="submit",
|
|
628
|
+
work_path=work_path,
|
|
629
|
+
submit_path=submit_path,
|
|
630
|
+
)
|
|
631
|
+
lint_path = root / "lint.json"
|
|
632
|
+
dump_json(lint_path, {"ok": True, "errors": [], "warnings": [], "checks": {}})
|
|
633
|
+
update_lint_meta(
|
|
634
|
+
meta_path,
|
|
635
|
+
field_id="create__flow876464415__product_series_code",
|
|
636
|
+
submit_path=submit_path,
|
|
637
|
+
lint_path=lint_path,
|
|
638
|
+
lint_report={"ok": True},
|
|
639
|
+
)
|
|
640
|
+
|
|
641
|
+
ensure_submission_allowed(meta_path, work_path, submit_path)
|
|
642
|
+
|
|
643
|
+
def test_submit_confirmation_requires_submit_built_state(self) -> None:
|
|
644
|
+
with tempfile.TemporaryDirectory() as tmpdir:
|
|
645
|
+
root = Path(tmpdir)
|
|
646
|
+
work_path = root / "work.json"
|
|
647
|
+
submit_path = root / "submit.json"
|
|
648
|
+
meta_path = root / "meta.json"
|
|
649
|
+
work_path.write_text(json.dumps({"name": "work-v1"}, ensure_ascii=False), encoding="utf-8")
|
|
650
|
+
submit_path.write_text(json.dumps({"name": "submit-v1"}, ensure_ascii=False), encoding="utf-8")
|
|
651
|
+
meta_path.write_text(json.dumps({"fieldId": 5328}, ensure_ascii=False), encoding="utf-8")
|
|
652
|
+
|
|
653
|
+
update_confirmation_state(
|
|
654
|
+
meta_path,
|
|
655
|
+
field_id=5328,
|
|
656
|
+
actor="tester",
|
|
657
|
+
stage="work",
|
|
658
|
+
work_path=work_path,
|
|
659
|
+
)
|
|
660
|
+
|
|
661
|
+
with self.assertRaises(SystemExit):
|
|
662
|
+
update_confirmation_state(
|
|
663
|
+
meta_path,
|
|
664
|
+
field_id=5328,
|
|
665
|
+
actor="tester",
|
|
666
|
+
stage="submit",
|
|
667
|
+
work_path=work_path,
|
|
668
|
+
submit_path=submit_path,
|
|
669
|
+
)
|
|
670
|
+
|
|
671
|
+
def test_submit_confirmation_allowed_after_submit_build_state(self) -> None:
|
|
672
|
+
with tempfile.TemporaryDirectory() as tmpdir:
|
|
673
|
+
root = Path(tmpdir)
|
|
674
|
+
work_path = root / "work.json"
|
|
675
|
+
submit_path = root / "submit.json"
|
|
676
|
+
meta_path = root / "meta.json"
|
|
677
|
+
work_path.write_text(json.dumps({"name": "work-v1"}, ensure_ascii=False), encoding="utf-8")
|
|
678
|
+
submit_path.write_text(json.dumps({"name": "submit-v1"}, ensure_ascii=False), encoding="utf-8")
|
|
679
|
+
meta_path.write_text(json.dumps({"fieldId": 5328}, ensure_ascii=False), encoding="utf-8")
|
|
680
|
+
|
|
681
|
+
update_confirmation_state(
|
|
682
|
+
meta_path,
|
|
683
|
+
field_id=5328,
|
|
684
|
+
actor="tester",
|
|
685
|
+
stage="work",
|
|
686
|
+
work_path=work_path,
|
|
687
|
+
)
|
|
688
|
+
update_build_meta(
|
|
689
|
+
meta_path,
|
|
690
|
+
field_id=5328,
|
|
691
|
+
work_path=work_path,
|
|
692
|
+
submit_path=submit_path,
|
|
693
|
+
submit_payload={"name": "submit-v1"},
|
|
694
|
+
)
|
|
695
|
+
update_confirmation_state(
|
|
696
|
+
meta_path,
|
|
697
|
+
field_id=5328,
|
|
698
|
+
actor="tester",
|
|
699
|
+
stage="submit",
|
|
700
|
+
work_path=work_path,
|
|
701
|
+
submit_path=submit_path,
|
|
702
|
+
)
|
|
703
|
+
|
|
704
|
+
meta = load_json(meta_path)
|
|
705
|
+
self.assertEqual(meta["status"], "submit_confirmed")
|
|
706
|
+
|
|
707
|
+
|
|
708
|
+
if __name__ == "__main__":
|
|
709
|
+
unittest.main()
|