補齊 PChome 比價人工覆核閉環
All checks were successful
CD Pipeline / deploy (push) Successful in 1m7s

This commit is contained in:
OoO
2026-05-20 10:00:58 +08:00
parent 50af4be9a8
commit 756b01af66
12 changed files with 592 additions and 5 deletions

View File

@@ -42,6 +42,32 @@ def test_competitor_feeder_persists_all_match_attempt_outcomes():
assert "idx_comp_match_attempts_sku_source_time" in migration
def test_competitor_match_review_service_closes_human_review_loop():
service_source = (ROOT / "services/competitor_match_review_service.py").read_text(encoding="utf-8")
migration = (ROOT / "migrations/039_create_competitor_match_reviews.sql").read_text(encoding="utf-8")
dashboard_js = (ROOT / "web/static/js/page-dashboard-v2.js").read_text(encoding="utf-8")
assert "VALID_REVIEW_ACTIONS" in service_source
assert "accept_identity" in service_source
assert "reject_identity" in service_source
assert "unit_price_required" in service_source
assert "manual_accepted" in service_source
assert "manual_rejected" in service_source
assert "manual_unit_price_required" in service_source
assert "INSERT INTO competitor_match_reviews" in service_source
assert "INSERT INTO competitor_prices" in service_source
assert "INSERT INTO competitor_price_history" in service_source
assert "manual_review" in service_source
assert "manual_accept" in service_source
assert "CREATE TABLE IF NOT EXISTS competitor_match_reviews" in migration
assert "review_action" in migration
assert "reviewer_identity" in migration
assert "candidate_diagnostic" in migration
assert "idx_comp_match_reviews_sku_source_time" in migration
assert "runPchomeReviewDecision" in dashboard_js
assert "/api/pchome-review/" in dashboard_js
def test_competitor_feeder_logs_keyword_parser_fallback(monkeypatch, caplog):
from services import competitor_price_feeder
from services import marketplace_product_matcher

View File

@@ -144,6 +144,9 @@ def test_dashboard_v2_is_production_default_and_uses_real_dashboard_data():
assert "total_items = review_queue_total" in route_source
assert "REVIEW_STATUS_OPTIONS" in route_source
assert "current_review_status" in route_source
assert "@dashboard_bp.route('/api/pchome-review/<sku>/decision', methods=['POST'])" in route_source
assert "record_competitor_match_review" in route_source
assert "clear_competitor_intel_cache()" in route_source
assert "MockRecord" not in route_source
assert "{% for item in items %}" in dashboard
assert "比價監控總覽" in dashboard
@@ -159,6 +162,10 @@ def test_dashboard_v2_is_production_default_and_uses_real_dashboard_data():
assert "review_status=option.key" in dashboard
assert "需單位價" in dashboard
assert "dashboard-review-segments" in dashboard
assert "data-pchome-review-action" in dashboard
assert "採用同款" in dashboard
assert "否決候選" in dashboard
assert "標記單位價" in dashboard
assert "AI 挑品清單" in dashboard
assert "比價覆核隊列" in dashboard
assert "覆核動作" in dashboard
@@ -210,7 +217,9 @@ def test_pchome_review_export_and_diagnostics_use_real_queue_data():
assert "匯出覆核" in dashboard
assert "review.diagnostic_reasons" in dashboard
assert "dashboard-review-reasons" in dashboard
assert "dashboard-review-actions" in dashboard
assert ".dashboard-review-reasons" in dashboard_css
assert ".dashboard-review-actions" in dashboard_css
def test_ai_intelligence_uses_v2_shell_and_real_runtime_apis():