From 034ac639597670ef23a74ca5c862811b826f5f09 Mon Sep 17 00:00:00 2001 From: ogt Date: Thu, 2 Jul 2026 00:46:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20PChome=20retry=20executor?= =?UTF-8?q?=20=E7=A9=BA=20selector=20=E7=8B=80=E6=85=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/pchome_mapping_backlog_service.py | 4 +++- tests/test_pchome_mapping_backlog_report.py | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/services/pchome_mapping_backlog_service.py b/services/pchome_mapping_backlog_service.py index 8dc44fd..d7036a8 100644 --- a/services/pchome_mapping_backlog_service.py +++ b/services/pchome_mapping_backlog_service.py @@ -4037,7 +4037,9 @@ def build_pchome_direct_mapping_retry_candidate_exception_controlled_apply_execu applied_count = len(applied_records) if execute_apply and missing_tables: result = "DIRECT_MAPPING_RETRY_EXCEPTION_CONTROLLED_APPLY_EXECUTOR_BLOCKED_MISSING_TABLE" - elif execute_apply and applied_count == len(selectors) and readback_pass_count == len(selectors): + elif execute_apply and not selectors: + result = "WAITING_FOR_RETRY_EXCEPTION_CONTROLLED_APPLY_PREFLIGHT" + elif execute_apply and selectors and applied_count == len(selectors) and readback_pass_count == len(selectors): result = "DIRECT_MAPPING_RETRY_EXCEPTION_CONTROLLED_APPLY_EXECUTED" elif execute_apply: result = "DIRECT_MAPPING_RETRY_EXCEPTION_CONTROLLED_APPLY_EXECUTION_INCOMPLETE" diff --git a/tests/test_pchome_mapping_backlog_report.py b/tests/test_pchome_mapping_backlog_report.py index 817a8af..57ee883 100644 --- a/tests/test_pchome_mapping_backlog_report.py +++ b/tests/test_pchome_mapping_backlog_report.py @@ -1272,6 +1272,25 @@ def test_direct_mapping_retry_candidate_exception_controlled_apply_executor_writ assert call_count["search"] == 2 +def test_direct_mapping_retry_candidate_exception_controlled_apply_executor_blocks_zero_selector_apply(): + package = build_pchome_direct_mapping_retry_candidate_exception_controlled_apply_executor_package( + _payload(), + batch_size=1, + execute_apply=True, + ) + + assert package["result"] == "WAITING_FOR_RETRY_EXCEPTION_CONTROLLED_APPLY_PREFLIGHT" + assert package["summary"]["target_selector_count"] == 0 + assert package["summary"]["applied_record_count"] == 0 + assert package["summary"]["executor_receipt_ready_count"] == 0 + assert package["summary"]["executor_receipt_materialized_count"] == 0 + assert package["controlled_apply_executor"]["write_attempted"] is False + assert "engine_required_for_execute_apply" in package["write_blockers"] + assert "controlled_apply_preflight_not_ready" in package["write_blockers"] + assert package["post_executor_receipt_verifier"]["passed"] is False + assert package["safety"]["writes_database_count"] == 0 + + def test_ai_automation_readiness_makes_automation_visible_without_manual_primary_flow(): readiness = build_pchome_growth_ai_automation_readiness(_payload(), batch_size=1)