強化 PChome accepted queue 變體防線
All checks were successful
CD Pipeline / deploy (push) Successful in 1m4s
All checks were successful
CD Pipeline / deploy (push) Successful in 1m4s
This commit is contained in:
@@ -320,6 +320,15 @@ def test_match_attempt_rescore_retracts_variant_review_from_accepted_queue():
|
||||
89, 0.872,
|
||||
'["focused_exact_identity_herbacin_classic_hand_cream_20ml_brandless"]',
|
||||
'matcher_rescore=accepted_current', '2026-05-24 14:24:17'
|
||||
),
|
||||
(
|
||||
'10524966', 'pchome', 'rescore_accepted_current', 10524966,
|
||||
'【Derma 丹麥德瑪】寶寶有機水嫩洗髮沐浴露 150ml(寶寶沐浴、嬰兒沐浴)',
|
||||
399, 1, 'DERMA-150ML',
|
||||
'Derma 寶寶洗髮沐浴露 150ml',
|
||||
349, 0.82,
|
||||
'["strong_exact_spec_match", "spec_name_alignment"]',
|
||||
'matcher_rescore=accepted_current', '2026-05-24 14:24:17'
|
||||
)
|
||||
"""))
|
||||
|
||||
@@ -343,15 +352,16 @@ def test_match_attempt_rescore_retracts_variant_review_from_accepted_queue():
|
||||
""")).mappings().all()
|
||||
after_rows = fetch_variant_rescore_accept_review_rows(conn, limit=10)
|
||||
|
||||
assert [row["sku"] for row in rows] == ["8884618"]
|
||||
assert stats["retracted"] == 1
|
||||
assert [row["sku"] for row in rows] == ["10922465", "8884618"]
|
||||
assert stats["retracted"] == 2
|
||||
latest_by_sku = {row["sku"]: row for row in latest}
|
||||
assert latest_by_sku["8884618"]["attempt_status"] == "true_low_confidence"
|
||||
assert "matcher_rescore:retracted_variant_selection_review" in json.loads(
|
||||
latest_by_sku["8884618"]["search_terms"]
|
||||
)
|
||||
assert "rescore_retracted_variant_selection_review" in latest_by_sku["8884618"]["error_message"]
|
||||
assert latest_by_sku["10922465"]["attempt_status"] == "rescore_accepted_current"
|
||||
assert latest_by_sku["10922465"]["attempt_status"] == "true_low_confidence"
|
||||
assert latest_by_sku["10524966"]["attempt_status"] == "rescore_accepted_current"
|
||||
assert after_rows == []
|
||||
|
||||
|
||||
|
||||
@@ -2371,6 +2371,53 @@ def test_marketplace_matcher_sends_single_sided_private_mousse_and_cream_variant
|
||||
assert "variant_selection_review" in diagnostics.reasons
|
||||
|
||||
|
||||
def test_marketplace_matcher_blocks_romand_lip_line_conflicts():
|
||||
from services.marketplace_product_matcher import score_marketplace_match
|
||||
|
||||
zero_velvet = score_marketplace_match(
|
||||
"【rom&nd】零絲絨 霧面唇釉 5.5g",
|
||||
"rom&nd 果汁唇釉5.5g_多款可選",
|
||||
)
|
||||
glasting = score_marketplace_match(
|
||||
"【rom&nd】果凍唇釉 5.5g",
|
||||
"rom&nd 果汁唇釉5.5g_多款可選",
|
||||
)
|
||||
|
||||
for diagnostics in (zero_velvet, glasting):
|
||||
assert diagnostics.hard_veto is True
|
||||
assert diagnostics.comparison_mode == "not_comparable"
|
||||
assert "romand_lip_line_conflict" in diagnostics.reasons
|
||||
|
||||
|
||||
def test_marketplace_matcher_sends_relove_brightening_cleanser_variant_to_review():
|
||||
from services.marketplace_product_matcher import score_marketplace_match
|
||||
|
||||
diagnostics = score_marketplace_match(
|
||||
"【Relove】胺基酸私密潔淨精華凝露120ml",
|
||||
"RELOVE傳明酸美白潔淨精華凝露120ml",
|
||||
)
|
||||
|
||||
assert diagnostics.hard_veto is False
|
||||
assert diagnostics.score >= 0.76
|
||||
assert diagnostics.price_basis == "manual_review"
|
||||
assert diagnostics.alert_tier == "identity_review"
|
||||
assert "relove_private_cleanser_variant_gap" in diagnostics.reasons
|
||||
assert "variant_selection_review" in diagnostics.reasons
|
||||
|
||||
|
||||
def test_marketplace_matcher_blocks_selection1990_wax_lamp_design_conflict():
|
||||
from services.marketplace_product_matcher import score_marketplace_match
|
||||
|
||||
diagnostics = score_marketplace_match(
|
||||
"【1990選物】歐式可彎融燭燈 香氛蠟燭暖燈-黑色款",
|
||||
"【1990選物】韓風原木底座融燭燈 香氛蠟燭暖燈-黑色款",
|
||||
)
|
||||
|
||||
assert diagnostics.hard_veto is True
|
||||
assert diagnostics.comparison_mode == "not_comparable"
|
||||
assert "selection1990_wax_lamp_design_conflict" in diagnostics.reasons
|
||||
|
||||
|
||||
def test_marketplace_matcher_promotes_eaoron_classic_tone_up_cream_exact_line():
|
||||
from services.marketplace_product_matcher import score_marketplace_match
|
||||
|
||||
|
||||
Reference in New Issue
Block a user