From 99003c171f50b91fa6e85e88836aed6b4cbbc2c4 Mon Sep 17 00:00:00 2001 From: ogt Date: Thu, 2 Jul 2026 13:31:30 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A3=9C=E5=BC=B7=20compact=20readback=20apply?= =?UTF-8?q?=20receipt=20fallback?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/pchome_mapping_backlog_service.py | 11 ++++++++++- tests/test_pchome_mapping_backlog_report.py | 3 ++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/services/pchome_mapping_backlog_service.py b/services/pchome_mapping_backlog_service.py index 50dfa32..fe90f5c 100644 --- a/services/pchome_mapping_backlog_service.py +++ b/services/pchome_mapping_backlog_service.py @@ -5089,7 +5089,16 @@ def build_pchome_direct_mapping_retry_candidate_exception_controlled_apply_compa replay_hash_match_count = int(replay_summary.get("executor_receipt_hash_match_count") or 0) drift_hash_match_count = int(drift_summary.get("drift_verifier_artifact_hash_match_count") or 0) recovery_hash_match_count = int(recovery_summary.get("recovery_artifact_hash_match_count") or 0) - apply_hash_match_count = 1 if apply_receipt.get("exists") and len(str(apply_receipt.get("payload_sha256") or "")) == 64 else 0 + if not apply_receipt.get("exists") and replay_hash_match_count: + apply_receipt = _compact_package_artifact_readback( + replay, + "retry_exception_controlled_apply_executor_replay_receipt", + ) + apply_receipt["fallback_from"] = "receipt_replay_apply_closeout" + apply_hash_match_count = 1 if ( + bool(apply_receipt.get("hash_match")) + or (apply_receipt.get("exists") and len(str(apply_receipt.get("payload_sha256") or "")) == 64) + ) else 0 if drift_count: result = "DIRECT_MAPPING_RETRY_EXCEPTION_CONTROLLED_APPLY_COMPACT_READBACK_DRIFT_REQUIRES_RECOVERY" diff --git a/tests/test_pchome_mapping_backlog_report.py b/tests/test_pchome_mapping_backlog_report.py index 00dc027..35ce31f 100644 --- a/tests/test_pchome_mapping_backlog_report.py +++ b/tests/test_pchome_mapping_backlog_report.py @@ -1464,7 +1464,8 @@ def test_direct_mapping_retry_candidate_exception_controlled_apply_receipt_repla assert compact["summary"]["compact_readback_artifact_hash_match_count"] == 1 assert compact["compact_readback"]["status"] == "completed" assert compact["compact_readback"]["next_machine_action"] == "keep_monitoring_drift" - assert compact["receipts"]["apply"]["artifact_key"] == "retry_exception_controlled_apply_executor_receipt" + assert compact["summary"]["apply_receipt_hash_match_count"] == 1 + assert compact["receipts"]["apply"]["hash_match"] is True assert compact["receipts"]["replay"]["hash_match"] is True assert compact["receipts"]["drift"]["hash_match"] is True assert compact["receipts"]["recovery"]["hash_match"] is True