[V10.336] 避免 PChome 低信心重評空轉
All checks were successful
CD Pipeline / deploy (push) Successful in 1m5s

This commit is contained in:
OoO
2026-05-20 14:55:32 +08:00
parent c0ec430587
commit 255140224b
3 changed files with 8 additions and 2 deletions

View File

@@ -320,7 +320,7 @@ YOUTUBE_API_KEY = os.getenv('YOUTUBE_API_KEY', '')
# ==========================================
# 系統版本與路徑
# ==========================================
SYSTEM_VERSION = "V10.335"
SYSTEM_VERSION = "V10.336"
LOG_FILE_PATH = os.path.join(BASE_DIR, 'logs/system.log')
public_url = PUBLIC_URL # 用於模板顯示

View File

@@ -679,6 +679,7 @@ class CompetitorPriceFeeder:
這條路徑不重新搜尋,只用前次留下的 PChome product_id 批次查詢最新商品資料,
適合把舊 scorer 卡在 0.70~0.759 的真同款重新推進正式比價。
已重評後仍不足門檻的 refresh_low_score 不再重複進隊列,避免排程空轉。
"""
if self.engine is None:
raise RuntimeError("需要注入 SQLAlchemy engine")
@@ -733,7 +734,7 @@ class CompetitorPriceFeeder:
AND COALESCE(cp.tags, '[]'::jsonb) ? 'identity_v2'
WHERE lm.rn = 1
AND cp.sku IS NULL
AND la.attempt_status IN ('low_score', 'refresh_low_score')
AND la.attempt_status = 'low_score'
AND COALESCE(la.best_match_score, 0) >= :min_score
AND COALESCE(la.hard_veto, false) = false
ORDER BY la.best_match_score DESC NULLS LAST, lm.momo_price DESC NULLS LAST, lm.sku

View File

@@ -31,6 +31,11 @@ def test_competitor_feeder_persists_all_match_attempt_outcomes():
assert "run_expired_identity_refresh" in source
assert "_fetch_retryable_candidate_skus" in source
assert "run_retryable_candidate_revalidation" in source
retryable_source = source.split("def _fetch_retryable_candidate_skus", 1)[1].split(
"def _fetch_expired_identity_skus", 1
)[0]
assert "la.attempt_status = 'low_score'" in retryable_source
assert "refresh_low_score')" not in retryable_source
assert "refresh_known_identity" in source
assert 'attempt_status="unit_comparable"' in source
assert 'attempt_status="refresh_unit_comparable"' in source