Files
Jyotisha/docs/tasks/TASK-home-sidebar-rerender-fix-20261014.md
T

2.7 KiB
Raw Blame History

TASK · 侧栏重渲染修复单(issue #59,第 1 次打回)

  • 日期:2026-10-14
  • 原任务书:docs/tasks/TASK-home-sidebar-rerender-20261013.md
  • 被验 SHA:63509431529d212c7847371e7717660d823b40e6(codex/home-sidebar-rerender-20261013)
  • 执行方:Grok,同一分支续做(落后 staging 时用 merge,不改写已推历史)
  • BUG 编号:沿用 BUG-1329

1. 验收结论:一项未通过,其余全部通过

检查 结果 证据
前端全量 npm test(与 staging 基线逐名比对) 未通过:新增 1 条失败 frontend/tests/chat-navigation-a11y-contract.test.ts「in-app destinations navigate client-side so the chat survives the round trip」:The input did not match the regular expression /onOpenBilling: \(\) => openAccountDialog\("billing", \{ source: "account-menu" \}\)/
T1 稳定包装 + 比较后发布 通过 逐行看过:latestRef 在无依赖 effect 里写,发布 effect 在其后;未冻结首次闭包;HomeProbe 的故意不稳定输入未改
T2 visibleSessions 记忆化 通过 —
T3 SidebarProvider context 记忆化 通过 —
改既有断言 通过 session-list-lifecycle 三栏齐全,且加强了(再改一版后仍调到最新)
tsc / lint 通过 0 错 / 0 error

根因:use-home-shell-registration.ts 把 onOpenBilling 从 () => openAccountDialog("billing", { source: "account-menu" }) 改成了 () => { latestRef.current?.openAccountDialog("billing", { source: "account-menu" }); },而 chat-navigation-a11y-contract.test.ts 第 42 行按源码文本断言旧写法(AGENTS.md §7.8:改写语句前要 grep 按源码文本断言的合同测试,同一轮跟着改)。

2. 修法要求

  1. 只改 frontend/tests/chat-navigation-a11y-contract.test.ts 第 42 行这条断言,按 §7.3 写「原值 / 新值 / 原因」三栏。新正则要仍然锁住意图:账户菜单里的「充值」打开 billing 且 source: "account-menu"。例如匹配 onOpenBilling: \(\) => \{ latestRef\.current\?\.openAccountDialog\("billing", \{ source: "account-menu" \}\); \};不得放宽成只查 "billing"。
  2. 再 grep 一遍:grep -rn "onOpenProfile\|onOpenGeneral\|onOpenLogout\|onNewChat\|onSelectSession\|onLoadMore" frontend/tests,有按旧写法断言源码文本的同样处理(本次全量里只红了这一条,但要确认)。
  3. 业务代码不改。先把最新 origin/staging 合并进分支(用 merge)。
  4. PROGRESS 末尾记一行。

3. 验收标准

  • 前端全量 npm test 失败清单与 staging 基线逐名相同;
  • git diff 63509431..<新 SHA> -- frontend/src 为空。

4. 让步顺序

无。第 1 次打回;再打回会停下等产品负责人。