穩定 PChome retry verifier artifact hash
Some checks failed
CD Pipeline / deploy (push) Has been cancelled

This commit is contained in:
ogt
2026-07-02 00:04:17 +08:00
parent 368493c31d
commit af9fed45d9
2 changed files with 20 additions and 6 deletions

View File

@@ -3188,7 +3188,7 @@ def _build_retry_exception_verifier_artifact_payloads(
"preview_id": preview.get("preview_id"), "preview_id": preview.get("preview_id"),
"source_policy": preview_package.get("policy"), "source_policy": preview_package.get("policy"),
"created_from": "retry_exception_closeout_verifier_artifact_preview", "created_from": "retry_exception_closeout_verifier_artifact_preview",
"created_at": preview_package.get("generated_at"), "created_at": run_id,
"safety": { "safety": {
"writes_database": False, "writes_database": False,
"syncs_external_offers": False, "syncs_external_offers": False,

View File

@@ -808,8 +808,6 @@ def test_direct_mapping_retry_candidate_exception_closeout_verifier_artifact_pre
def fake_search(targets, limit_per_product, max_products, max_terms_per_product, min_score): def fake_search(targets, limit_per_product, max_products, max_terms_per_product, min_score):
call_count["search"] += 1 call_count["search"] += 1
if targets[0].get("source_artifact_id"): if targets[0].get("source_artifact_id"):
if call_count["search"] > 2:
return True, "retry_clear", []
return True, "retry_found", [ return True, "retry_found", [
{ {
"product_id": "MOMO-RETRY-REVIEW", "product_id": "MOMO-RETRY-REVIEW",
@@ -973,8 +971,6 @@ def test_direct_mapping_retry_candidate_exception_closeout_verifier_artifact_pre
def fake_search(targets, limit_per_product, max_products, max_terms_per_product, min_score): def fake_search(targets, limit_per_product, max_products, max_terms_per_product, min_score):
call_count["search"] += 1 call_count["search"] += 1
if targets[0].get("source_artifact_id"): if targets[0].get("source_artifact_id"):
if call_count["search"] > 2:
return True, "retry_clear", []
return True, "retry_found", [ return True, "retry_found", [
{ {
"product_id": "MOMO-RETRY-REVIEW", "product_id": "MOMO-RETRY-REVIEW",
@@ -1044,7 +1040,25 @@ def test_direct_mapping_retry_candidate_exception_closeout_verifier_artifact_pre
assert all(readback["hash_match"] for readback in package["artifact_readbacks"]) assert all(readback["hash_match"] for readback in package["artifact_readbacks"])
assert package["safety"]["reads_artifact_files"] is True assert package["safety"]["reads_artifact_files"] is True
assert package["safety"]["writes_database"] is False assert package["safety"]["writes_database"] is False
assert call_count["search"] == 2
drift_payload = json.loads(json.dumps(_payload()))
drift_payload["generated_at"] = "2026-07-01T23:59:59"
drift_package = build_pchome_direct_mapping_retry_candidate_exception_closeout_verifier_artifact_preflight_verifier_package(
drift_payload,
batch_size=1,
execute_search=True,
execute_retry_search=True,
max_terms_per_product=6,
search_func=fake_search,
materialize_artifacts=False,
artifact_root=tmp_path,
)
assert drift_package["result"] == "DIRECT_MAPPING_RETRY_EXCEPTION_VERIFIER_ARTIFACT_PREFLIGHT_VERIFIED"
assert drift_package["summary"]["artifact_readback_pass_count"] == 3
assert drift_package["summary"]["artifact_hash_match_count"] == 3
assert drift_package["summary"]["writes_artifact_count"] == 0
assert drift_package["safety"]["writes_database"] is False
assert call_count["search"] == 4
def test_ai_automation_readiness_makes_automation_visible_without_manual_primary_flow(): def test_ai_automation_readiness_makes_automation_visible_without_manual_primary_flow():