比价记录失败卡展示具体原因(新增 fail_reason) #189
Reference in New Issue
Block a user
Delete Branch "compare-record-fail-reason"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
失败记录不再一律「网络开小差」:新增记录级 fail_reason 派生列——information
具体则直出,笼统则从 platform_results 救出业务原因(找不到店/菜、未起送、打烊、
单点不配送等),纯系统失败为 None → 端侧品牌兜底。store_closed/no_delivery 被
pricebot 漏成 status=failed 的按 reason 补判,打烊脏店名统一简短模板。接入
harvest_done 与灰度期 upsert_record 两条写路径。
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
🤖 review-pr 深审结论
🟢 可合并 — 逻辑正确、测试实跑通过、迁移干净。置信度 0.9(隔离 worktree 实跑 PG 测试 + alembic 校验 + 试合并)。
验证(隔离 worktree 实跑)
pytest tests/test_fail_reason.py tests/test_compare_harvest.py→ 20 passed,跑在 PostgreSQL(conftest 的shaguabijia_test)。新增失败派生测试 + 成功记录fail_reason=None断言均过;新测试用user_id=None,PG 外键安全。alembic heads→ 单头comparison_record_fail_reason,链路user_manual_risk_fields → comparison_record_fail_reason无分叉。main试合并:Already up to date(main 是 PR 祖先,无漂移)。ComparisonRecordOut仅被 compare_record 列表/详情/分页消费(admin 用独立 schema)→ 新增可选字段向后兼容,无共享类型破坏。正面
_derive_fail_display的[:256]截断 +fail_reason命名与既有WithdrawOrder.fail_reason约定一致。nit(可选,不阻塞)
reason(可能少报「两个平台都…」);笼统 information 场景下已是净提升,低优先。_GENERIC_INFO各写一份(迁移点时快照,可接受)。配套:与 android #351 配对,建议 server 先上(含
alembic upgrade head)、android 后上。