fix(home): one new-chat intent and a scoped login-return stash (BUG-1038)
Coming back to / from /people could show the previous rectification session
as a locked page: its title in the header, the composer stuck on
"正在打开生时校正…", and the new-chat greeting in the middle.
The state that survived between pages is the sessionStorage login-return
stash that secondary-page sidebar links write from the current ?c=:
- /people「和 TA 对话」used a second intent (?newChat=1) parsed by a
component mounted inside Home after bootstrap, so the bootstrap new-chat
branch never ran and the stash won.
- A stash id not in the current person's loaded list was looked up and
landed with urlAction "keep", which assumes ?c= is already in the address
bar. It was not, so the rectification auto-open never fired. The stash
also ignored which person was current.
- An in-page new chat left the stash in place.
Fix: delete NewChatDeepLink / ?newChat and route「和 TA 对话」through
newChatHref(); a looked-up stash writes ?c= back (replace-selected) and is
dropped when it belongs to another person; startNewChat and
openChatBoundToProfile clear the stash. ?c= deep links, BUG-989 and BUG-705
are unchanged.
Tests: new real-lifecycle suite mounting the real Home, sidebar and people
page (10 cases: four secondary pages + mobile drawer, 和 TA 对话 for self and
another person, out-of-scope stash, same-person stash beyond the first page,
in-page new chat), plus two contract/unit tests. Six fail on origin/staging,
all pass here. Full suite 3928 / 61 failing, failure names identical to the
0ab061b9 baseline (3916 / 61).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017eEAG8HD3mm8gsKXgk8uU8
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
f4b8f26e15
commit
0a8350cc01
@@ -13885,6 +13885,21 @@
|
||||
- 相关记录:BUG-1028。
|
||||
- 修复版本:`codex/round-0925-followup-20260925`,未部署。
|
||||
|
||||
## BUG-1038 | 回首页落到上一次生时校正:标题是旧校正、输入框「正在打开生时校正…」,中间却是新对话开场
|
||||
|
||||
- 状态:investigating(已修复待部署;登录态真机未复测)
|
||||
- 首次发现 / 最近更新:2026-09-26 / 2026-09-26
|
||||
- 影响面:首页启动落点(`home-bootstrap-run.ts` `resolveLanding`、`home-cloud-sync.ts` `resolveLookupBootstrap`、`chat-session-url.ts`)、`/people`「和 TA 对话」、只读侧栏的次级页链接与账户页脚、首页内「新建对话」。
|
||||
- 用户现象:产品 09-26 iPhone Safari:从星盘档案页回到首页后,标题栏是上一次的「生时校正 · 时段」,输入框占位「正在打开生时校正…」且发送禁用,页面中间却是新对话的开场问候和两个入口按钮,一直不打开。
|
||||
- 触发条件(本机 Chrome 与真实 React 生命周期测试均复现):先打开一条生时校正会话 → 点侧栏次级页链接(星盘 / 星历 / 我的报告 / 星盘档案都会把当前 `?c=` 存进 sessionStorage 的登录返回存根)→ ① 在 `/people` 让当前人物变成另一个人(选中他人后「看星盘」「和 TA 对话」或顶栏切人),再经不带新建意图的 `/` 回首页(只读侧栏账户页脚、刷新):画面与产品截图逐项一致,永久停住;② 在 `/people` 对本人点「和 TA 对话」:启动按存根落到旧校正并把 `?c=` 写回地址栏,后台自动打开旧校正,约 2 秒后从新对话翻回旧校正界面。侧栏「新建对话」(`/?new=1`)在本机浏览器 4 种变体(默认 / 慢网 / 慢打开 / 只有校正会话)和 lifecycle 测试的四个次级页 + 手机抽屉下都没有复现:新建分支本来就忽略并清掉存根。产品描述的入口与复现入口不同,需产品真机确认。
|
||||
- 根因:跨页存活的是登录返回存根 `sessionStorage["jyotisha.session-url-return"]`(侧栏次级页链接的 `leaveChat()` → `persistLoginSessionReturn()` 写入)。三处缺口:1) `/people`「和 TA 对话」用第二套意图 `?newChat=1`,由首页里挂载的 `NewChatDeepLink` 在启动之后才解析,启动的 new-chat 分支从未生效,存根照常胜出(违反 BUG-1015 红线 3);2) 存根 id 不在当前人物已加载的列表里时,启动走 lookup,找到后返回 `urlAction: "keep"`——这个语义只为地址栏已有 `?c=` 设计,存根来源时地址栏没有 `?c=`,`shouldAutoOpenRectificationSession` 永远不成立,校正会话成了活动会话却不打开,`composerLocksAsRectification` 锁住输入框;存根也不区分人物,别人的会话照样被拿来落地;3) 首页内新建对话不清存根,之后回裸 `/` 仍可能落回旧会话。
|
||||
- 修复:删除 `NewChatDeepLink` 与 `?newChat`,「和 TA 对话」改走 `newChatHref()`(人物由 current-subject 存储带过去,启动的新建分支按当前人物建本地空咨询);`bootstrapSelectionFromLookup` 增加来源参数:存根来源找到时用 `replace-selected`(写回 `?c=`,校正会话照常自动打开),存根会话不属于当前人物时(`other-subject`)落默认并清存根;`resolveLanding` 把当前人物判定传给 lookup;`startNewChat` / `openChatBoundToProfile` 清存根。`?c=` 深链的 `keep`、BUG-989 首问前不落库、BUG-705 lookup 均不变。
|
||||
- 验证:新增 `frontend/tests/new-chat-from-people-lifecycle.test.tsx`(挂载真实 `Home` + 真实 `AppSidebar` + 真实 `PeoplePage`,与 `(app)/layout.tsx` 同构,客户端导航换路由、文档加载重置模块状态保留 storage):四个次级页 + 手机抽屉的侧栏新建、「和 TA 对话」本人 / 他人、他人存根不落锁死页、同人存根带 URL 打开、首页内新建清存根,共 10 条;另加 2 条纯函数 / 源码合同。修复前在 `origin/staging` 上 4 条行为测试 + 2 条合同失败(锁死页那条正是占位「正在打开生时校正…」),修复后全绿。本地 `next start` + Chrome 151(CDP 拦截 `/api/*` 返回虚构数据)修复前后截图见 `docs/testing/new-chat-from-people-20260926-*.png`。全量与失败名单对照见 PROGRESS。
|
||||
- 防复发:lifecycle 测试锁「先开校正 → 客户端导航到次级页(写存根)→ 回首页」的组合;源码合同锁「只剩一套新建意图」。BUG-1015 当时的测试只执行 URL 纯函数和启动函数(参数优先级、reserved 恢复),没有真实组件生命周期,也没有把次级页链接写存根、第二套 `?newChat` 入口、存根 lookup 分支连起来,所以没拦住。
|
||||
- 相关记录:BUG-1015(同一新建意图链路)、BUG-705(lookup 分支)、BUG-989(首问前不落库)、BUG-1030 / BUG-1035(不打开别人的会话)。
|
||||
- 复发自:BUG-1015 的新建意图链路,组合路径遗漏;不是同一根因。
|
||||
- 修复版本:`codex/new-chat-from-people-20260926`,未部署。
|
||||
|
||||
## BUG-1039 | 星盘档案页 `/people` 没有任何样式
|
||||
|
||||
- 状态:resolved(Claude 2026-09-26 独立复验通过;门禁 run 2908、迁移 2909、部署 2910 成功,`/api/health` `gitCommit` = `0ab061b9`;登录态真机清单 `docs/testing/people-ephemeris-ui-20260926.md` 由产品走)
|
||||
|
||||
Reference in New Issue
Block a user