diff --git a/services/competitor_match_attempt_rescore_audit.py b/services/competitor_match_attempt_rescore_audit.py index 3a04167..7bf1c95 100644 --- a/services/competitor_match_attempt_rescore_audit.py +++ b/services/competitor_match_attempt_rescore_audit.py @@ -116,7 +116,7 @@ def classify_match_attempt_row( elif diagnostics.comparison_mode == "unit_comparable": suggested_status = "unit_comparable_current" gate_pass = False - elif diagnostics.score >= min_score: + elif diagnostics.score >= min_score and "variant_selection_review" not in reasons: suggested_status = "accepted_current" gate_pass = True else: diff --git a/tests/test_competitor_match_attempt_rescore_audit.py b/tests/test_competitor_match_attempt_rescore_audit.py index bf16119..eadf34d 100644 --- a/tests/test_competitor_match_attempt_rescore_audit.py +++ b/tests/test_competitor_match_attempt_rescore_audit.py @@ -82,6 +82,26 @@ def test_match_attempt_rescore_audit_keeps_unit_price_cases_out_of_gate_pass(): assert "unit_comparable" in decision.reasons +def test_match_attempt_rescore_audit_keeps_variant_selection_review_out_of_gate_pass(): + from services.competitor_match_attempt_rescore_audit import classify_match_attempt_row + + decision = classify_match_attempt_row({ + "sku": "8884618", + "attempt_status": "true_low_confidence", + "momo_product_name": "【KATE 凱婷】怪獸級持色唇膏 水光款/經典款/微發色款(獨家技術持久不沾 高保濕)", + "best_competitor_product_name": "【KATE 凱婷】怪獸級持色唇膏(水光) 1.6g", + "momo_price": 420, + "best_competitor_price": 350, + "best_match_score": 0.623, + }) + + assert decision.current_score >= 0.76 + assert decision.suggested_status == "low_score_current" + assert decision.gate_pass is False + assert decision.alert_tier == "identity_review" + assert "variant_selection_review" in decision.reasons + + def test_match_attempt_rescore_audit_skips_missing_identity_text(): from services.competitor_match_attempt_rescore_audit import classify_match_attempt_row