Files
Jyotisha/docs/tasks/PROGRESS-rectification-open-retitles-session-20260915.md
T
jesse-ux 2d7698ead3
Independent Staging Quality Gate / validate (push) Successful in 11m43s
Independent Staging Quality Gate / publish (push) Successful in 2m3s
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.
2026-09-15 14:48:03 +08:00

47 lines
3.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# PROGRESS · 打开历史校正不再改名(BUG-6992026-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`,不得写成通过。