Files
Jyotisha/docs/tasks/PROGRESS-consultation-subject-binding-20260922.md
T

2.6 KiB
Raw Blame History

进度 · 普通聊天人物资料服务端真值与会话绑定(2026-09-22)

基线:10baeb2fa865743c428806e115ac92ca9d92fb71(开工时 origin/staging)。分支 codex/consultation-subject-binding-20260922。未推送,未部署。

做了什么

  • 新增 frontend/src/lib/consultation-subject-resolver.ts。self 和未绑定旧会话只读当前用户 profiles。other 只读当前用户拥有的 chart_profiles,服务端重新派生姓名和角色。
  • prepareConsultationRoute 在扣点前解析 subject。other 不继承登录用户的校正候选区间。客户端出生字段只被传入后丢弃。
  • POST /api/consult 读取 chart_profile_id/name/role,失败时返回固定中文错误,不扣点、不调用模型。
  • 会话创建与 PATCH 由服务端填写或核对绑定。空会话可以绑定;已有消息则拒绝改绑。刷新和深链只看库存绑定,不看 activeChartId。

断言变更

测试 原值 新值 原因
application-billing-contract.test.ts 会话 select ...,title,theme,chart_profile_role,context_summary 同一串中在 role 前增加 chart_profile_id,chart_profile_name 普通咨询必须按库存人物 id 解析,不能只看 role

其余既有测试名未改。展示名与资料最新姓名不一致时,咨询仍使用资料里的姓名,不因此失败:任务书要求后续聊天用该人物最新资料,展示快照不是排盘真值。伪造姓名不能写入绑定,也不能补全缺姓名的资料;角色不一致则直接失败,且不退回本人。

验证

  • tsc --noEmit:通过。
  • npm run lint:0 error(既有 warning 未改)。
  • npx tsx --test tests/consultation-subject-binding.test.ts:10 pass / 0 fail。
  • 同命令一起跑 consultation-subject-binding.test.ts、consultation-route-service.test.ts、application-billing-contract.test.ts、chat-session-write.test.ts、chat-session-authority.test.ts、consultation-birth-time-mode.test.ts、consultation-workflow-contract.test.ts:88 tests,87 pass / 1 fail。
  • 单独再跑 consultation-birth-time-mode.test.ts:9 pass / 1 fail。唯一失败是 general agent runtime has no Jyotish skill package and no personal chart tool,本机创建 skill symlink 报 EPERM。同文件里「consult route validates mode before billing」通过。
  • 未跑全量 npm test,未跑 next build。

留给下一轮人物选择 UI

  • 不改 page.tsx、首屏或聊天顶栏,不做选择器。
  • 不把 other 接到报告、每日星语或生时校正。
  • 全局 activeChartId 仍只在客户端;服务端不读它。