修复:补齐比价记录状态枚举映射 #100
Reference in New Issue
Block a user
Delete Branch "codex/comparison-status-enums"
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?
变更说明
验证
🤖 review-pr 深审结论
🟢 可合并 · 置信度 0.9 — 比价记录状态展示映射的前端补齐,与 server#209 同一枚举口径。合并最新
main后隔离 worktree 实跑tsc --noEmit(strict)零报错,type-safe。纯展示层改动,低风险。改动 & 正面点
STATUS_COLOR / STATUS_LABEL补齐历史细分值(below_minimum→绿/成功;store_closed / store_not_found / items_not_found / no_delivery / unsupported→红/失败)并新增running→蓝/进行中;迁移前后数据都能正确显示。platformResultRows():兼容raw_payload.platform_results既是**对象(dict,按 platform_id 键)**也是数组两种形态,dict 时补platform_id字段;无platform_results时回退platforms数组。修了一个真 bug——原代码as Record<string, unknown>[]直接把 dict 当数组,详情抽屉「结局」表对 dict 型 payload 实际渲染不出内容(server#209 测试里platform_results正是 dict)。running;结局列颜色改用STUCK_COLOR映射(替代原s === 'success' ? green : orange二值)。:352、详情抽屉:563、结局表:661)均走映射且带|| s原值兜底,未知值降级为默认色 + 原文,不崩。构建 / 类型(已实跑,诚实)
main(merge 为 no-op),隔离 worktree 用 clone 的 node_modules(junction)跑tsc --noEmit(TS 5.9.3,tsconfigstrict:true)→ 退出 0,零类型错误。next build(tsc --noEmit已做全量类型检查;纯展示改动无需运行时验证)。铁律1(跨 PR 类型契约)
@/lib/types中ComparisonRecordListItem.status: string、ComparisonRecordDetail.raw_payload: Record<string, unknown> | null均为宽松类型;新代码签名 / 索引与之相容,无兄弟 PR 收紧成 union 而致编译不过。关注
建议
:352)也加|| '-'末级兜底(与:661一致),极端 null 更稳(当前 status 类型非空,影响可忽略)。🤖 自动深审 · 全程只读 · 合并 base 后隔离 worktree 实跑 tsc
🤖 review-pr 深审结论(增量复审 @0f921f9e)
🟢 可合并 · 0.9 — 本次把「逐平台结局」表重构为「逐平台结果卡片判定」(状态归一 + 卡片分类 + 菜品差异 / 复杂规格摘要)。合并最新
main后隔离 worktree 实跑tsc --noEmit(strict)退出 0,type-safe。与 server#209@f1dd0f4a的platforms透传正确配对。本次增量(
0c75c4f → 0f921f9e,2 文件 +161/-45)src/lib/types.ts:ComparisonRecordDetail新增platforms: Record<string, unknown>[]—— 对接 server#209 后台详情新透传的platforms字段(铁律1 跨仓契约 ✓)。page.tsx:删除旧STUCK_LABEL/STUCK_COLOR,改由platformDisplay(row)统一判定:success/source→ok,按is_best/role/is_user_original/has_dish_diff归「#1 全网最低赢家 / #2 原选择 / #3 其他成功」,并覆盖below_minimum/store_closed/items_not_found/store_not_found/failed/unsupported/no_delivery/not_installed/not_compared_this_time+ 未知兜底;新增hasDishDiff/dishDiffSummary/complexSpecSummary/stringList摘要;表格扩为「平台 / 逐平台状态 / 卡片分类 / 价格 / 说明」五列。detail.platforms→raw_payload.platforms→raw_payload.platform_results(灰度旧记录兜底)。构建 / 类型(已实跑,诚实)
node_modulesjunction)跑tsc --noEmit(TS 5.9.3,strict)→ 退出 0,零类型错误。正面点
detail?.platforms、(platforms?.length ?? 0)、typeof/Array.isArray守卫 —— 即便后端 server#209 尚未上线(无platforms字段)也优雅降级不崩,回退raw_payload。未知 status 走「#9 兜底」不异常。关注(低)
types.ts里platforms标为必填,但现网后端要等 server#209 上线后才保证有该字段;运行时代码已?.兜底、不会崩,仅类型与现网契约暂不符 —— 待 #209 合并后即一致。建议两者一并上线。建议
🤖 自动深审 · 增量复审 · 合并 base 后隔离 worktree 实跑 tsc