Add SKU-scoped PChome rescore pilot
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:
@@ -145,6 +145,32 @@ def test_fetch_match_attempt_rescore_rows_defaults_to_latest_sku_state():
|
||||
assert {row["sku"] for row in historical_rows} == {"SKU-A", "SKU-B"}
|
||||
|
||||
|
||||
def test_fetch_match_attempt_rescore_rows_can_limit_to_specific_skus():
|
||||
from services.competitor_match_attempt_rescore_audit import fetch_match_attempt_rescore_rows
|
||||
|
||||
engine = create_engine("sqlite:///:memory:")
|
||||
with engine.begin() as conn:
|
||||
_create_match_attempts_table(conn)
|
||||
conn.execute(text("""
|
||||
INSERT INTO competitor_match_attempts
|
||||
(sku, source, attempt_status, momo_product_name, best_competitor_product_id,
|
||||
best_competitor_product_name, best_match_score, diagnostic_codes, attempted_at)
|
||||
VALUES
|
||||
('SKU-A', 'pchome', 'true_low_confidence', 'MOMO A', 'P-A', 'PChome A', 0.82, '["current_low"]', '2026-05-24 09:00:00'),
|
||||
('SKU-B', 'pchome', 'true_low_confidence', 'MOMO B', 'P-B', 'PChome B', 0.83, '["current_low"]', '2026-05-24 10:00:00'),
|
||||
('SKU-C', 'pchome', 'true_low_confidence', 'MOMO C', 'P-C', 'PChome C', 0.84, '["current_low"]', '2026-05-24 11:00:00')
|
||||
"""))
|
||||
|
||||
rows = fetch_match_attempt_rescore_rows(
|
||||
conn,
|
||||
statuses=("true_low_confidence",),
|
||||
skus=("SKU-A", "SKU-C"),
|
||||
limit=10,
|
||||
)
|
||||
|
||||
assert [row["sku"] for row in rows] == ["SKU-C", "SKU-A"]
|
||||
|
||||
|
||||
def test_match_attempt_rescore_materializes_accepted_current_for_manual_review():
|
||||
from services.competitor_match_attempt_rescore_audit import materialize_rescore_accept_reviews
|
||||
|
||||
|
||||
Reference in New Issue
Block a user