fix(comparison): 派生 best 排除缺菜店, 避免虚低价当"最低价" #176

Merged
guke merged 1 commits from fix/comparison-exclude-short-stores into main 2026-07-27 10:35:17 +08:00
Member

pricebot comparison_results[].rank 是纯价格排序(含缺菜店), server 派生 best
若照单全收, 会把缺菜(漏菜)店的虚低总价当 best_price → 记录页戴"最低"红框 +
算出虚假省额。

  • _derive / _derive_from_results 派生 best 时按 platform_results[pid].
    skipped_dish_count 排除缺菜店; 源平台永远全菜, 全目标缺菜时回落到源
    (is_source_best、saved=0), 不虚报省额。
  • platform_results 内层结构宽松(老客户端透传可伪造), _is_short 用
    isinstance 兜底, 值非 dict 时按"不缺菜"处理, 不打 500。
  • harvest_done 传入 done_params.platform_results; 不传→纯 rank/price 老行为不变。
  • 新增纯函数测试: 排除缺菜 / 全缺菜回落源 / 不传保持老行为 / 内层非 dict 不崩,
    覆盖 _derive 与 _derive_from_results 两条路径。

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com

pricebot comparison_results[].rank 是纯价格排序(含缺菜店), server 派生 best 若照单全收, 会把缺菜(漏菜)店的虚低总价当 best_price → 记录页戴"最低"红框 + 算出虚假省额。 - _derive / _derive_from_results 派生 best 时按 platform_results[pid]. skipped_dish_count 排除缺菜店; 源平台永远全菜, 全目标缺菜时回落到源 (is_source_best、saved=0), 不虚报省额。 - platform_results 内层结构宽松(老客户端透传可伪造), _is_short 用 isinstance 兜底, 值非 dict 时按"不缺菜"处理, 不打 500。 - harvest_done 传入 done_params.platform_results; 不传→纯 rank/price 老行为不变。 - 新增纯函数测试: 排除缺菜 / 全缺菜回落源 / 不传保持老行为 / 内层非 dict 不崩, 覆盖 _derive 与 _derive_from_results 两条路径。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
guke added 1 commit 2026-07-26 18:07:05 +08:00
pricebot comparison_results[].rank 是纯价格排序(含缺菜店), server 派生 best
若照单全收, 会把缺菜(漏菜)店的虚低总价当 best_price → 记录页戴"最低"红框 +
算出虚假省额。

- _derive / _derive_from_results 派生 best 时按 platform_results[pid].
  skipped_dish_count 排除缺菜店; 源平台永远全菜, 全目标缺菜时回落到源
  (is_source_best、saved=0), 不虚报省额。
- platform_results 内层结构宽松(老客户端透传可伪造), _is_short 用
  isinstance 兜底, 值非 dict 时按"不缺菜"处理, 不打 500。
- harvest_done 传入 done_params.platform_results; 不传→纯 rank/price 老行为不变。
- 新增纯函数测试: 排除缺菜 / 全缺菜回落源 / 不传保持老行为 / 内层非 dict 不崩,
  覆盖 _derive 与 _derive_from_results 两条路径。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
guke merged commit b2a528eba1 into main 2026-07-27 10:35:17 +08:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: WonderableAI/shaguabijia-app-server#176