docs(tasks): brief for editable birth time of other subjects
Queued after Gitea #86. Drops the reported_birth_time immutability in chart_profiles_guard_birth (copied from the owner guard that was lifted on 07-21); active_* locks stay. Not for the agent loop: touches the database. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HwMNZEzdzmrbPhuRNmZe3C
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
117d8cbe53
commit
bd3ce0e7b5
@@ -511,3 +511,4 @@
|
||||
| `TASK-synastry-report-chat-20261018.md` | `PROGRESS-synastry-report-chat-20261018.md` | 从合盘报告某一节进入对话问依据(绑定报告与节、对话里可用术语、只依据已存计算结果并逐条核对、计费照普通对话) | 已验收 | `549e37b99`;动表 |
|
||||
| `TASK-synastry-staging-fix-20261021.md` | `PROGRESS-synastry-staging-fix-20261021.md` | #85 婚恋合盘 staging:P0 `.gte` 已在 staging(BUG-1399)。本分支补时间线起止、英文分析逻辑、删模型后旧对话改用默认模型、选人页开关文案,以及合盘创建真库测试(BUG-1400~1403) | 待验收 | `codex/synastry-staging-fix-20261021` |
|
||||
| `TASK-synastry-report-chat-fix-20261020.md` | `PROGRESS-synastry-report-chat-20261018.md` | 大运核对要认报告里的「小运」和英文 mahadasha / antardasha;预填文案只留一句 | 已验收 | `549e37b99` |
|
||||
| `TASK-other-subject-birth-time-edit-20261021.md` | — | 其他人的出生时间可以修改(去掉 `chart_profiles_guard_birth` 的填报时间不可改;推翻 people-archive P1 §验收 2 该条;active 锁不变) | 排队(等 #86 合入) | `codex/other-subject-birth-time-edit-20261021`;动表;不进循环 |
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
# TASK · 其他人物的出生时间可以修改(2026-10-21)
|
||||
|
||||
## 0. 基线与顺序
|
||||
|
||||
- 基线:`origin/staging` 117d8cbe5(开工时以最新 `origin/staging` 为准)。
|
||||
- **串行依赖**:必须等 Gitea issue **#86**(星盘页人名切换 / 出生资料就地编辑 / 报告行星表)合入 staging 之后再开工,并基于含 #86 的 staging 新建分支。#86 在星盘页编辑框里把「其他人的出生时间」锁住,本单负责解锁;两单都改 `people-page.tsx` 与同一编辑框,不得并行。
|
||||
- 不进 agent 循环:本单动数据库(新迁移 + 触发器),按 `tools/agent-loop` 规则由 Claude 或其派出的执行方在独立 worktree 完成,必须真跑 `npm run test:db`。
|
||||
- 分支 / 工作树:`codex/other-subject-birth-time-edit-20261021`,`.worktrees/other-subject-birth-time-edit-20261021`。
|
||||
|
||||
## 1. 事故实证(行号按符号定位)
|
||||
|
||||
用户在星盘档案或星盘页发现别人的出生时间填错了,改了保存,被拒「填报的出生时间不能再改」。挡住的有三层:
|
||||
|
||||
1. 数据库:`frontend/supabase/migrations/20260925020000_chart_subject_typed_columns.sql` 的 `public.chart_profiles_guard_birth()`。`tg_op = 'UPDATE'` 分支里,只要 `old.reported_birth_time is not null` 且新值不同,就 `raise exception 'reported_birth_time_is_immutable'`。
|
||||
2. 接口:`frontend/src/app/api/chart-profiles/[id]/route.ts` 的 `PUT`。它先查当前 `reported_birth_time`,与新值不同就直接返回 409 `reported_birth_time_is_immutable`;随后 `if (storedReported) delete columns.reported_birth_time`,把新时间静默丢掉。同文件和 `route.ts` 顶部的 `databaseFailure` 也把该异常映射成 409。
|
||||
3. 界面:`frontend/src/components/people/people-page.tsx` 的 `PeopleArchiveView` 中,`ChartProfileForm` 的 `description` 对他人写「填报的出生时间保存后不能再改。」(#86 合入后,星盘页编辑框里还会多一处时间格锁定和同样的说明。)
|
||||
|
||||
本人没有这个限制:`profiles` 表的同类锁已在 `20260721140000_repair_reported_birth_time_revision.sql` 去掉,本人走 `PATCH /api/account`,由 `resolveAccountBirthTimeApplicationPatch` 处理已采用时间的重置。
|
||||
|
||||
## 2. 根因
|
||||
|
||||
这把锁来自 `TASK-people-archive-p1-20260924.md` §验收 2:「他人类型化列具备与户主同级的守卫:`reported_*` 写入后不可改」。当时照抄的是户主 07-17 的守卫(`guard_birth_time_journey`),但户主那条 07-21 已为「用户可修改自己的声明」而撤销,抄过来的是过时规则。
|
||||
|
||||
他人目前**没有任何校正链路**:`use-rectification-surface.ts` 与 `consultation-tools.ts` 的 `not_self` 都明确「生时校正暂时只支持本人」;`chart_profiles_guard_birth` 在 INSERT/UPDATE 都禁止写 `active_birth_*` 和 `accepted|confirmed`,所以他人的 `active_birth_*` 恒为空。也就是说,锁住 `reported_birth_time` 没有在保护任何已采用的结果。
|
||||
|
||||
## 3. 决策记录(产品 2026-10-21 授权)
|
||||
|
||||
- **推翻** `TASK-people-archive-p1-20260924.md` §验收 2 中「他人 `reported_*` 写入后不可改」这一条,以及该单 §验收 中 `npm run test:db`「`reported_birth_time` 更新被拒」这一用例。其余守卫保持不变:`active_*` 仍只能由(P2 的)校正流程写入,客户端与 `/api/chart-profiles` 仍不得写 `active_*` 或 `accepted|confirmed`;人数上限不变。
|
||||
- 产品原话:「他人时间也放开改」,场景是「用户突然发现自己写错时间」,对任何人都应该能改。
|
||||
- 改了他人的出生时间、日期或地点后:星盘、星历、对话按新资料重排。已生成的个人报告、合盘报告保持原样,不自动重算、不删除,与本人改资料时的现行行为一致。
|
||||
- 原型(产品已确认):https://claude.ai/artifact/7j5Z1raYBMsSVG87KX1JE5
|
||||
|
||||
## 4. 硬红线
|
||||
|
||||
1. 只放开 `reported_birth_time`(以及与它同属声明层的 `birth_time_source / birth_time_period / declared_window_* / uncertainty_*`,若当前 PUT 本就允许改则保持)。`active_birth_time / active_birth_date / active_birth_timezone_offset` 的锁,以及 `birth_time_status` 不得被改成 `accepted|confirmed` 的锁,**一字不动**。
|
||||
2. 新增迁移,不改历史迁移文件:`frontend/supabase/migrations/20261021xxxxxx_chart_subject_reported_time_editable.sql`,用 `create or replace function public.chart_profiles_guard_birth()` 重定义,保留 `revoke all ... from public` 等权限语句与 `set search_path = ''`。
|
||||
3. 不碰 `profiles` 表、`guard_birth_time_journey`、`PATCH /api/account`。
|
||||
4. 不改 `.gitea/workflows/**`,不顺带升级依赖。
|
||||
5. Bug 历史 / 测试 / 文档不得出现任何真实用户资料,示例用虚构数据。
|
||||
6. 部署前须先在 staging 跑迁移(staging 门禁会触发迁移工作流;执行方在进度记录里写明迁移 run 号)。
|
||||
|
||||
## 5. 任务分解
|
||||
|
||||
**T1 迁移:去掉他人填报时间不可改**
|
||||
- 新迁移按 §4.2 重定义触发器,删除 `reported_birth_time_is_immutable` 这一段,其余逻辑原样保留。
|
||||
- 向后兼容(AGENTS §7.6):staging 迁移先于部署应用,此时线上旧代码的 PUT 仍会自行返回 409,只是放宽、不会出错,可以与 T2 同轮。
|
||||
- 验收:`npm run test:db` 中 `frontend/tests/database-chart-subject.test.ts` 用例改为「他人 `reported_birth_time` 可以从 08:00 改成 08:01,且改后 `active_birth_*` 仍为空、`birth_time_status` 不变」;原有「写 `active_*` 被拒」「改成 confirmed 被拒」用例保持并通过。原断言 `/reported_birth_time_is_immutable/` 的改动按 AGENTS §7.3 写「原值 / 新值 / 原因」三栏。
|
||||
|
||||
**T2 接口:PUT 接受新时间**
|
||||
- `chart-profiles/[id]/route.ts` 的 `PUT`:删除与 `storedReported` 比较后返回 409 的分支,以及 `delete columns.reported_birth_time`。`databaseFailure` 里 `reported_birth_time_is_immutable` 的映射可删(迁移后不再出现);POST 路由的同名映射一并清理。
|
||||
- 验收:新增或改写接口测试,覆盖「PUT 改他人时间 → 200 且返回新时间」「PUT 请求体带 `active_birth_time` → 仍被拒」。
|
||||
|
||||
**T3 界面:解锁他人时间**
|
||||
- `people-page.tsx`:他人编辑说明去掉「填报的出生时间保存后不能再改。」,与本人统一为「称呼和出生资料。」
|
||||
- #86 在星盘页编辑框里加的「他人时间格锁定 + 说明」:解除锁定、删掉说明。改了时间、日期或地点时,提示文案对他人用「改了出生时间、日期或地点,星盘会按新资料重排。」,不得出现「校正作废」字样(他人没有校正)。
|
||||
- 保存后,星盘页、星历页立即显示新时间,不需要手动刷新:对该人物沿用 #86 中本人保存后的缓存失效方式(以 #86 合入后的实现为准)。
|
||||
- 验收:前端测试覆盖他人时间可编辑、提示文案按本人/他人区分;`frontend/DESIGN.md` 与 `CHANGELOG.md` 同一提交更新。
|
||||
|
||||
**T4 记录**
|
||||
- `docs/BUG_HISTORY.md` 新增一条(编号开工时核对最大号;写本单时最大号为 BUG-1403,#86 也会占号):状态、现象、根因(照抄过时的户主守卫)、修复、验证、防复发(守卫测试改为「可改 reported、不可改 active」)、关联 BUG-196 与 people-archive P1。
|
||||
- `docs/tasks/PROGRESS-other-subject-birth-time-edit-20261021.md` 写执行记录。
|
||||
|
||||
## 6. 验收口径
|
||||
|
||||
- 前端:`tsc --noEmit` 0 错;`npm run lint` 0 error;全量 `npm test` 与开工基线逐条比对,fail 不增;`next build` 后 `/` 仍 Static;首屏 gzip ±2%。
|
||||
- 数据库:`npm run test:db --prefix frontend` 真跑(本机无 Docker 时按 `local-postgres-without-docker` 做法用 PG17 二进制),`database-chart-subject` 全绿。
|
||||
- Python:`.venv/bin/python scripts/run_quality_gate.py --profile quick` 通过(`tests/test_birth_time_journey_contract.py` 断言的是 07-17 旧迁移文件,不应受影响;若受影响,停下来报告)。
|
||||
- 部署:staging 迁移 run 绿,`/api/health` 的 `deployment.gitCommit` 等于本单提交。
|
||||
- 真机清单写进 `docs/testing/`:在星盘档案和星盘页各改一次他人的出生时间,确认保存成功、星盘立即重排、本人资料不受影响。
|
||||
|
||||
## 7. 让步顺序
|
||||
|
||||
时间不够时:T1、T2 不可让步(合在一起才能解锁)→ T3 的星盘页编辑框可以晚于档案页 → 记录类最后补,但不得缺。
|
||||
|
||||
## 8. 开工前置命令
|
||||
|
||||
```bash
|
||||
cd /workspace/Jyotisha && git status -sb | head -1
|
||||
git fetch origin --prune
|
||||
git log origin/staging --oneline | grep -m1 '#86' # 确认 #86 已合入,否则不开工
|
||||
git worktree add -b codex/other-subject-birth-time-edit-20261021 .worktrees/other-subject-birth-time-edit-20261021 origin/staging
|
||||
grep -o 'BUG-1[0-9]\{3\}' docs/BUG_HISTORY.md | sort -t- -k2 -n | tail -1
|
||||
```
|
||||
Reference in New Issue
Block a user