fix(chat): keep stored rectification titles on open
Opening a saved birth-time session no longer restamps the title or updatedAt from the wall clock. Occupies BUG-699, recurrence of BUG-553.
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
# PROGRESS · 打开历史校正不再改名(BUG-699,2026-09-15)
|
||||
|
||||
- 执行分支:`codex/rectification-open-retitles-session-20260915`
|
||||
- 工作树:`.worktrees/rectification-open-retitles-session-20260915`
|
||||
- 基线:`origin/staging` @ `224244c0`(任务书写 `ff5023a2`;其后一笔是本任务书)
|
||||
|
||||
## 做了什么
|
||||
|
||||
任务 1:`openRectificationCase` 用 `rectificationOpenIdentity(existing, minted)`。已有会话的 `title` / `updatedAt` 全等于 `existing`;新建才 `resolveSessionTitle` + `timestamp()`。`pinned` / `archivedAt` 仍从 `existing` 继承。
|
||||
|
||||
任务 1.3 `messages: []`:**无害,保持原样。** `persistSession` 的 update 分支不写 `messages`,服务端对话不受影响。校正面从 turns 渲染。
|
||||
|
||||
任务 2.1:`session-open-preserves-identity.test.ts` 断言 existing 命中时 identity 全等、未命中才用 minted,并锁 hook 里 `merged` 只用 `openIdentity`。
|
||||
|
||||
任务 2.2:同一文件扫 `frontend/src/hooks/` 与 `frontend/src/lib/` 里带 `id` + `sessionType`/`messages` 的对象字面量,禁止无条件 `updatedAt: timestamp()`(`randomUUID` 新建除外)。把 1.1 改回 `updatedAt: timestamp()` 后这两条变红,已改回,未提交破坏。
|
||||
|
||||
任务 2.3:`SessionTitleOptions.at` 与 `resolveSessionTitle` 默认 `new Date()` 处加了注释:只能用于新建。
|
||||
|
||||
任务 3:修回逻辑在 `rectification-session-title-repair.ts`,运维脚本 `frontend/scripts/repair-rectification-session-titles.mjs`(默认只读 `--check`,`--apply` 才写)。幂等,只动匹配正则且月日与 `created_at` 的 Asia/Shanghai 不一致的行。本机没有 `SCHEMA_DATABASE_URL`,**staging 未跑**,损坏面数字待产品在 staging 执行后回填。
|
||||
|
||||
## 测试数字
|
||||
|
||||
| | `test(` 声明(`git grep -E '^test\(' -- frontend/tests`) |
|
||||
| --- | ---: |
|
||||
| 基线 `224244c0` | 3213 |
|
||||
| 改后 | 3221(+4 identity,+4 title-repair) |
|
||||
|
||||
定向:`session-open-preserves-identity` 4 pass;`rectification-session-title-repair` 4 pass。破坏性复核:把 `merged.updatedAt` 改回 `timestamp()` 后 identity 源码合同与跨文件时钟合同变红。
|
||||
|
||||
`tsc --noEmit` 0 错。`npm run lint` **0 error** / 120 warning(既有,未动)。
|
||||
|
||||
本机 Windows 全量 TAP 仍受 CRLF / Skill 软链 / Docker 影响,不能当作 Linux 27 的证据。
|
||||
|
||||
## 任务 1.3
|
||||
|
||||
`persistSession` update 字段是 title / theme / model_id / chart_profile_*,不含 messages,也不含 `updated_at`。结论:清空本地 `messages` 再 hydrate turns 对服务端无害,不改。
|
||||
|
||||
## 生产 `7b620c7a`
|
||||
|
||||
该 SHA 没有 `use-rectification-surface.ts`。当时 `page.tsx` 的 `merged` 用固定标题「生时校正」,**没有**墙钟日期,也**没有** `persistSession(merged)`。生产不受「标题写成今天并写库」影响。`updatedAt: timestamp()` 当时只动客户端,刷新可恢复。任务 3 **不必在生产跑**。
|
||||
|
||||
## 偏离
|
||||
|
||||
- 任务 3 staging 核对 / 修补因本机没有库连接而未跑。脚本已落地。产品在 staging 跑:`node frontend/scripts/repair-rectification-session-titles.mjs` 看行数,确认后加 `--apply`。
|
||||
- CHANGELOG 写的是修回规则已交付;实际写库要等 staging 脚本跑完。
|
||||
- 浏览器项见 `docs/testing/rectification-open-identity-20260915.md`,不得写成通过。
|
||||
@@ -120,7 +120,7 @@
|
||||
| `TASK-chat-reading-load-20260915.md` | `PROGRESS-chat-reading-load-20260915.md` | 首页主题卡下线 + 回答两层可见性 + 折叠层宽表可横滑 + 输入框 16px。内容一字不删。⚠️ BUG-630 走查路径失效 | 已验收(2 条契约测试未通过,见修复单) | `8144fca2` |
|
||||
| `TASK-mobile-touch-and-breakpoints-20260915.md` | `PROGRESS-mobile-touch-and-breakpoints-20260915.md` | 消息操作按钮触屏命中区 27×34、相邻仅隔 1px(BUG-695);CSS 平板上限 900px 与 `sidebarViewportForWidth` 的 1024 不一致,901–1023 是混合态(BUG-696);报告域 720/760/860 三个断点互不对齐,761–860 目录已塌、正文还是桌面(BUG-697)。含断点白名单契约测试。**串行在 chat-reading-load 之后** | 已验收 | `6c748d86`(BUG-695~697) |
|
||||
| `TASK-chat-reading-load-fix-20260915.md` | `PROGRESS-chat-reading-load-fix-20260915.md` | **验收修复单**:`chat-bundle-splitting-contract`(`message-markdown` 包裹数 1→2、`plainParagraphs(spoken)` 字面量已不存在)与 `chat-navigation-a11y-contract`(`window.location.assign("/login")` 4→3,建议问题入口删除带走一处)两条既有断言被本轮打红且未更新;Linux 全量 27→29。只改测试不改产品代码 | 待验收 | `codex/chat-reading-load-fix-20260915` |
|
||||
| `TASK-rectification-open-retitles-session-20260915.md` | — | **P0 复发单**:点侧栏历史校正会话,`openRectificationCase` 无条件用墙钟重算 `title` 并把 `updatedAt` 盖成此刻(同一处 `pinned`/`archivedAt` 却从 `existing` 继承了),`persistSession` 把改名写回服务端 → 12 号的会话被改成「9月15日 · 生时校正」并顶到列表最前。标题**永久损坏**、排序刷新可恢复。复发自 BUG-553(其防复发只是一句话,无测试执行,且没覆盖校正 open 路径)。含历史标题按 `created_at` 修回(BUG-699) | 待领取 | `codex/rectification-open-retitles-session-20260915` |
|
||||
| `TASK-rectification-open-retitles-session-20260915.md` | `PROGRESS-rectification-open-retitles-session-20260915.md` | **P0 复发单**:点侧栏历史校正会话,`openRectificationCase` 无条件用墙钟重算 `title` 并把 `updatedAt` 盖成此刻(同一处 `pinned`/`archivedAt` 却从 `existing` 继承了),`persistSession` 把改名写回服务端 → 12 号的会话被改成「9月15日 · 生时校正」并顶到列表最前。标题**永久损坏**、排序刷新可恢复。复发自 BUG-553(其防复发只是一句话,无测试执行,且没覆盖校正 open 路径)。含历史标题按 `created_at` 修回(BUG-699) | 待验收 | `codex/rectification-open-retitles-session-20260915` |
|
||||
| `TASK-settings-dialog-size-and-nav-20260915.md` | — | **复发单**:设置弹窗四个分区尺寸仍随内容跳变(BUG-698,复发自 BUG-554——旧防复发只查「有没有写 height」,查不到「写了没生效」);首要嫌疑是 `.settings-modal` 的 `dvh` 没有 `vh` 回退,不支持时整条 `height` 作废退化成内容高度,需先复现确认。另按产品要求去掉分区菜单左侧强调条,并拆开与悬停共用的选中态 | 待领取 | `codex/settings-dialog-size-and-nav-20260915` |
|
||||
|
||||
### 个人报告
|
||||
|
||||
Reference in New Issue
Block a user