给别人出报告能读到档案,对话和报告标明 AI 生成
BUG-1063:后台按列只读档案,授权前数据库拒绝读表,授权后通过。对话输入框下和报告标题下加上 AI 生成说明。状态板按已部署提交改措辞,不标 resolved。下载文件元数据没有做。 自测:tsc 退出码 0;lint 0 error;定向测试 51 通过;test:db 82 项里 13 项为 Windows 已知失败,无新增;隐私标记退出码 0。 Co-Authored-By: Grok (agent loop)
This commit is contained in:
co-authored by
Grok (agent loop)
parent
f4c53e7f9f
commit
fca62fda43
@@ -1,5 +1,10 @@
|
||||
# 印度占星 Skill 更新日志
|
||||
|
||||
## 2026-10-14 — 给别人出报告能读到档案;对话和报告标明 AI 生成(待合入 staging)
|
||||
|
||||
- 给人物档案里的其他人出报告时,后台只能按出报告要用的那些列读取,不能改档案(BUG-1063)。
|
||||
- 对话输入框下方,以及报告标题下,标明由 AI 生成、仅供参考。报告结尾原有的免责还在。Skill 版本不变(BUG-1347)。
|
||||
|
||||
## 2026-10-14 — 回答生成时侧栏不再跟着闪动 / 卡顿(待合入 staging)
|
||||
|
||||
- 回答生成时侧栏不再跟着闪动 / 卡顿。点会话、改名、换人仍是当前这一下的操作。Skill 版本不变(BUG-1329)。
|
||||
|
||||
+48
-33
@@ -4243,9 +4243,9 @@
|
||||
|
||||
## BUG-283 | 今日星语每次进入首页都停在“没能生成”
|
||||
|
||||
- 状态:regressed
|
||||
- 状态:superseded(由 BUG-299 取代)
|
||||
- 首次发现:2026-08-18
|
||||
- 最近更新:2026-08-19
|
||||
- 最近更新:2026-10-14
|
||||
- 影响面:`/` 首页“今日星语”卡片、`POST /api/daily-starlanguage`、进程内缓存与浏览器当日缓存
|
||||
- 用户现象:资料完整的账号每次打开首页,卡片都显示“今天的星语没能生成,稍后再回来看看;这里不会用通用文案顶替。”,没有当日内容。
|
||||
- 触发条件:出生时间可用于个人星盘的账号进入首页。冷路径或换实例后必现。
|
||||
@@ -13636,7 +13636,7 @@
|
||||
|
||||
## BUG-906 | 星盘 SVG 把 CSS 的 height:auto 写成了属性
|
||||
|
||||
- 状态:investigating(分支已修,定向回归见进度记录;未部署,不标 resolved)
|
||||
- 状态:investigating(已部署 staging `82c8aeb0`,真机欠;不标 resolved)
|
||||
- 首次发现:2026-09-16
|
||||
- 最近更新:2026-09-25
|
||||
- 影响面:星盘页西洋盘 `WesternWheelSvg`、报告与星盘页共用的 `VedicChartSvg`。
|
||||
@@ -13648,11 +13648,11 @@
|
||||
- 防复发:星盘 SVG 合同禁止再写 `height="auto"`。高度自适应只放在已有的 CSS 规则里;离线导出要长度时写在导出序列化,不写回组件属性。
|
||||
- 相关记录:无。引入提交为星盘页 `830799fa` 与报告盘面 `2fdcb14f`,不是已编号缺陷的复发。
|
||||
- 复发自:无
|
||||
- 修复版本:本分支 `codex/console-noise-20260916`,待提交与部署核对。
|
||||
- 修复版本:已部署 staging `82c8aeb0`,真机欠。
|
||||
|
||||
## BUG-907 | 没有后台咨询任务时,状态查询仍返回 404
|
||||
|
||||
- 状态:investigating(分支已修,定向回归见进度记录;未部署,不标 resolved)
|
||||
- 状态:investigating(已部署 staging `82c8aeb0`,真机欠;不标 resolved)
|
||||
- 首次发现:2026-09-16
|
||||
- 最近更新:2026-09-25
|
||||
- 影响面:`GET /api/consult/status` 无参查询,以及首页启动、页面重新可见、`online` 时的 `fetchActiveConsultationStatus`。
|
||||
@@ -13664,7 +13664,7 @@
|
||||
- 防复发:无参空结果不得再返回 404。带参「咨询请求不存在」必须保持 404。客户端读无参状态必须先看 204/404,不得先解析没有 body 的 204。
|
||||
- 相关记录:BUG-276(带参 404 与刷新重放,本条不改那条语义)。控制台第三条 `reportAllChanges` 读取 `startTime` 的报错是浏览器扩展注入脚本,非本仓代码,不加 web-vitals、不加 try/catch;验证方法是无痕窗口。
|
||||
- 复发自:无
|
||||
- 修复版本:本分支 `codex/console-noise-20260916`,待提交与部署核对。
|
||||
- 修复版本:已部署 staging `82c8aeb0`,真机欠。
|
||||
|
||||
## BUG-1001 | 校正会话标题仍写日期,同一天多条无法区分
|
||||
|
||||
@@ -14366,18 +14366,18 @@
|
||||
|
||||
## BUG-1063 | 他人报告 worker 用服务角色读 `chart_profiles`,但服务角色对这张表没有任何权限
|
||||
|
||||
- 状态:investigating(静态证据;本轮不修,授权范围需要产品 / 安全决定)
|
||||
- 首次发现 / 最近更新:2026-09-27 / 2026-09-27
|
||||
- 状态:fixed-pending-verify(本分支已修;部署并真机给别人出一份报告前不标 resolved)
|
||||
- 首次发现 / 最近更新:2026-09-27 / 2026-10-14
|
||||
- 影响面:报告 worker 为「星盘档案里的其他人」生成报告(`personal-report-worker-subject.ts` → `loadSubjectBirth(admin, …)` → `from("chart_profiles").select(CHART_SUBJECT_SELECT)`)。
|
||||
- 现象(推断,未在真实库复现):选别人生成的报告,worker 读人物资料失败,按 `subject_unavailable` → `profile_incomplete`(可重试)处理,报告可能一直排队或最终失败退款。
|
||||
- 触发条件:BUG-1031 让 worker 改走 `loadSubjectBirth` 之后(`4d801e53` 起)的他人报告。
|
||||
- 根因(已确认的事实):`20260718100000_repair_missing_chart_profiles.sql` 对 `service_role` 执行 `revoke all on table public.chart_profiles`,之后没有任何迁移把它授回;admin 客户端在自托管模式下是 `set local role service_role`(`admin-client-core.ts`)。BYPASSRLS 只绕过行级策略,不给表权限。未在真实库验证 staging 是否另有手工授权。
|
||||
- 修复:未修。可选做法是给 `service_role` 授 `chart_profiles` 的逐列 `SELECT`(只列 `CHART_SUBJECT_SELECT` 的列),或让 worker 走 SECURITY DEFINER 的只读函数;两者都扩大服务端能读到的他人出生资料范围,需要决定。
|
||||
- 验证:—(建议先在 staging 库只读执行 `select has_table_privilege('service_role','public.chart_profiles','select')` 确认)
|
||||
- 防复发:新增的服务角色读取路径必须有真实 PostgreSQL 用例,mock 客户端测不出表权限。
|
||||
- 根因(已确认):`20260718100000_repair_missing_chart_profiles.sql` 对 `service_role` 执行 `revoke all on table public.chart_profiles`,之后没有迁移把读权限授回。后台 admin 客户端在自托管模式下是 `set local role service_role`。BYPASSRLS 只绕过行级策略,不给表权限。改授权前,本地 PostgreSQL 用服务角色按 `CHART_SUBJECT_SELECT` 读取返回 `42501` `permission denied for table chart_profiles`。
|
||||
- 修复:`20261014010000_chart_profiles_service_role_select.sql` 只给 `service_role` 授 `CHART_SUBJECT_SELECT` 那些列的 SELECT。不授写,不改 RLS,不动 `authenticated` 已有授权。产品 2026-10-14 选择逐列只读,不建 SECURITY DEFINER 函数。
|
||||
- 验证:`frontend/tests/database-report-worker-subject.test.ts` 在授权后读到虚构人物档案;`frontend/tests/chart-profiles-service-role-select-20261014.test.ts` 锁住选择列都在授权列里,且迁移不授写、不改策略。全量 `npm run test:db` 与 Windows 已知失败名单比对,见进度记录。
|
||||
- 防复发:上述两则测试。新增服务角色读取路径必须有真实 PostgreSQL 用例,mock 客户端测不出表权限。
|
||||
- 相关记录:BUG-1031、BUG-1062
|
||||
- 复发自:无
|
||||
- 修复版本:待定
|
||||
- 修复版本:分支 `codex/beta-main-path-20261014`,尚未合入 staging。真机给别人出一份报告后才 resolved。
|
||||
|
||||
## BUG-1070 | 普通对话替用户和当事人说心思:反差写到人身上、是非题被改写成「你是否需要」
|
||||
|
||||
@@ -14540,7 +14540,7 @@
|
||||
|
||||
## BUG-1080 | 新账号首次建盘:看不到群星过场,只看到「解锁完整咨询」兑换弹窗
|
||||
|
||||
- 状态:investigating(修复已在分支 `codex/birth-sky-pacing-20260928`,待部署 staging 后真机确认;过场没出现的确切原因未在真实环境取证)
|
||||
- 状态:investigating(修复 `dec36bce` 已部署 staging,真机欠;过场没出现的确切原因未在真实环境取证)
|
||||
- 首次发现 / 最近更新:2026-09-28 / 2026-09-28
|
||||
- 影响面:0 点数、无订阅的新账号,首页 onboarding 保存本人出生地之后的那一刻(`TASK-birth-sky-followup-20260928` F4 群星过场)。
|
||||
- 现象:产品在 staging 真机新建账号、走完 onboarding 后,没有看到群星汇聚过场,只看到「解锁完整咨询」兑换弹窗。
|
||||
@@ -14552,7 +14552,7 @@
|
||||
- 验证:`frontend/tests/birth-sky-polish-20260928.test.ts`(兑换弹窗只由被拒的发送打开、第一次兑换弹窗第二次 billing、UI 预览不弹、402 后草稿退回、过场 portal 到 body);`membership-page.test.ts` 改写的时机断言;全量前端测试失败清单与基线逐条相同。无头 Chrome 最小复现见上。
|
||||
- 防复发:首页不得在「本人刚保存出生地」这一刻自动弹出任何弹窗;顶层 `<dialog>` 也要 portal 到 `SidebarInset` 之外;过场是否真的放了,部署后按 `docs/testing/birth-sky-cover-checklist.md` 新账号条目真机走一遍(若仍看不到过场,优先查 3 秒预算内 `/api/birth-sky` 的耗时)。
|
||||
- 相关记录:BUG-968(`SidebarInset` inert 与 portal 约定)、BUG-434(兑换弹窗样式);`TASK-birth-sky-followup-20260928` F4、`TASK-birth-sky-polish-20260928` P4。
|
||||
- 修复版本:分支 `codex/birth-sky-pacing-20260928`(本条所在提交),未部署。
|
||||
- 修复版本:已部署 staging `dec36bce`,真机欠。
|
||||
|
||||
## BUG-1081 | 全站没有任何地方能改本人的出生资料(星盘档案只给他人「编辑」)
|
||||
|
||||
@@ -15127,7 +15127,7 @@
|
||||
|
||||
## BUG-1128 | 每次部署后浏览器重新下载全部 JS 与宋体字体
|
||||
|
||||
- 状态:字体部分 resolved(待部署,staging 两次部署地址不变待核);JS 部分 blocked(`supportsImmutableAssets` 在自托管构建下不生效,见 BLOCKED.md)
|
||||
- 状态:字体部分 resolved(已部署 staging `8112f62b`,真机欠);JS 部分 blocked(`supportsImmutableAssets` 在自托管构建下不生效,见 BLOCKED.md)
|
||||
- 首次发现 / 最近更新:2026-09-30 / 2026-09-30
|
||||
- 影响面:`frontend/next.config.ts`(`deploymentId`)、`src/app/fonts/serif-sc/`。
|
||||
- 现象:进站慢、标题宋体很久才出来;staging 一天部署多次,用户几乎每次都是冷缓存。
|
||||
@@ -15137,7 +15137,7 @@
|
||||
- 验证:本地生产构建:CSS 里的切片地址为 `url(/fonts/serif-sc/jyotisha-serif-sc-00.1812be0085.woff2)`,不带 `?dpl`;`next start` 返回 `Cache-Control: public, max-age=31536000, immutable`。`tests/test_serif_font_slices.py` 新增「文件名哈希与内容一致、public 旁有 OFL」;`serif-headings-contract.test.ts` 新增 next.config 长期缓存断言;`font-stack-loadable-contract.test.ts` 按 public 解析绝对地址。
|
||||
- 防复发:要长期缓存的静态资源不走 Next 打包(打包资源带每次部署都变的 `?dpl=`),放 public/、文件名带内容哈希、配 immutable 响应头,并用测试钉住「名字对得上内容」。JS 的每次部署失效要等部署方式支持 immutable assets(adapter)后再议,不得为此去掉 `deploymentId`(BUG-936)。
|
||||
- 相关记录:BUG-936(引入 `deploymentId` 的原因)、BUG-737
|
||||
- 修复版本:分支 `codex/home-first-load-20260930`(`8112f62b`)
|
||||
- 修复版本:已部署 staging `8112f62b`,真机欠。JS 部分仍 blocked。
|
||||
|
||||
## BUG-1129 | 加载屏标题用宋体,JS 就绪前先下载 3~4 个字体切片
|
||||
|
||||
@@ -16723,7 +16723,7 @@
|
||||
|
||||
## BUG-1244 | 普通对话首轮按固定小标题汇报,读起来不像聊天
|
||||
|
||||
- 状态:fixed-pending-verify(分支 `codex/consult-conversational-answer-20261006`;部署和真机清单完成前不标 resolved)
|
||||
- 状态:fixed-pending-verify(已部署 staging `e62d0a32`,真机欠;不标 resolved)
|
||||
- 首次发现 / 最近更新:2026-10-06 / 2026-10-06
|
||||
- 来源:产品看普通对话首轮,反馈像机器在汇报。任务书 `docs/tasks/TASK-consult-conversational-answer-20261006.md`。
|
||||
- 影响面:普通咨询本命 / 无出生分钟 / 申报时段的首轮写作指令、续写提示、思考计划里的「这周可以做什么」、没有标题时的写作行。不改证据卡、工具、模型、输出长度上限、答题时钟、计费。每日星语和「深入看今日」的骨架不动。生时校正的口气不动。
|
||||
@@ -16738,7 +16738,7 @@
|
||||
|
||||
## BUG-1245 | 提示词里的行动示范被回答逐字照抄
|
||||
|
||||
- 状态:fixed-pending-verify(分支 `codex/consult-conversational-answer-20261006`;部署和真机清单完成前不标 resolved)
|
||||
- 状态:fixed-pending-verify(已部署 staging `e62d0a32`,真机欠;不标 resolved)
|
||||
- 首次发现 / 最近更新:2026-10-06 / 2026-10-06
|
||||
- 来源:同上任务书。产品指出示范里的具体做法会出现在真实回答里。
|
||||
- 影响面:`product-voice.ts` 的 Good 示范。不改计算,不改证据卡。
|
||||
@@ -16753,7 +16753,7 @@
|
||||
|
||||
## BUG-1252 | iPhone 上回答右侧一条空白,输出时正文抖动
|
||||
|
||||
- 状态:fixed-pending-verify(分支 `codex/consult-readable-20261006`;真机确认前不标 resolved)
|
||||
- 状态:fixed-pending-verify(已部署 staging `52d14e8f`,真机欠;不标 resolved)
|
||||
- 首次发现 / 最近更新:2026-10-06 / 2026-10-06
|
||||
- 来源:产品 iPhone 真机截图(staging,普通对话婚恋题)。
|
||||
- 影响面:所有对话里的助手回答正文(普通咨询、生时校正旁白);首次引导气泡另有规则,未动。
|
||||
@@ -16768,7 +16768,7 @@
|
||||
|
||||
## BUG-1253 | 情感等回答把内部分析清单原样念给用户,看不懂
|
||||
|
||||
- 状态:fixed-pending-verify(分支 `codex/consult-readable-20261006`;无模型凭据,真机复核前不标 resolved)
|
||||
- 状态:fixed-pending-verify(已部署 staging `52d14e8f`,真机欠;不标 resolved)
|
||||
- 首次发现 / 最近更新:2026-10-06 / 2026-10-06
|
||||
- 来源:同 BUG-1252 截图。
|
||||
- 影响面:普通咨询各领域回答的措辞;工具结果里的精简清单、通用读法;首轮与追问轮指令。不改证据卡、工具、打分。
|
||||
@@ -16782,7 +16782,7 @@
|
||||
|
||||
## BUG-1254 | staging 门禁偶发红:数据库测试排队等 PostgreSQL 槽位超时
|
||||
|
||||
- 状态:fixed-pending-verify(分支 `codex/postgres-fixture-queue-20261006`;需在门禁上连续通过才标 resolved)
|
||||
- 状态:fixed-pending-verify(已部署 staging `52d14e8f`;门禁 run 1747、1750、1753、1756、1759、1762 连续六次通过;再观察前不标 resolved)
|
||||
- 首次发现 / 最近更新:2026-10-06 / 2026-10-06
|
||||
- 来源:门禁 run 1746(`171a3f25`)「Frontend and database tests」红;同日 run 1742(`da226db1`)同一步红,随后同代码的 run 1743(`e62d0a32`)通过。
|
||||
- 影响面:Gitea `backend-quality-gate.yml` 的 `npm test --prefix frontend`;`frontend/tests/helpers/postgres-fixture.ts`。与被测提交的改动无关时也会红,阻断部署。
|
||||
@@ -16798,7 +16798,7 @@
|
||||
|
||||
## BUG-1255 | 回答口吻与首页不一致、读心一刀切禁掉;人设规则互相打架
|
||||
|
||||
- 状态:fixed-pending-verify(分支 `codex/consult-voice-sister-20261007`;无模型凭据,真机复核前不标 resolved)
|
||||
- 状态:fixed-pending-verify(已部署 staging `b8385adb`,真机欠;不标 resolved)
|
||||
- 首次发现 / 最近更新:2026-10-07 / 2026-10-07
|
||||
- 来源:产品审阅当前回答规则清单后的决定(非线上报错)。
|
||||
- 影响面:普通咨询三种模式共用的口吻(`product-voice.ts` 的 `productConversationVoice`)、本命合同的 Never 列表、追问指令、`mastra/index.ts` 末尾一句。校正 Agent 口吻、首页开场语不动。
|
||||
@@ -16813,7 +16813,7 @@
|
||||
|
||||
## BUG-1256 | 普通对话系统提示 5.5 万字符:同一形状说 4 遍、方法书带进工程记录与冲突的输出合同
|
||||
|
||||
- 状态:fixed-pending-verify(分支 `codex/prompt-slim-20261007`;部署与真机前不标 resolved)
|
||||
- 状态:fixed-pending-verify(已部署 staging `c76fdda7`,真机欠;不标 resolved)
|
||||
- 首次发现 / 最近更新:2026-10-07 / 2026-10-07
|
||||
- 来源:产品问「提示词规则 2 万多字能不能优化」,Claude 实测体量后产品授权直接执行,并提供临时模型 key 做改前改后对比。
|
||||
- 影响面:本命对话与申报时段对话的系统提示(`mastra/index.ts`、`product-voice.ts` 合同、`consultation-thinking-plan.ts` 的 natal 标题规则、`skill-binding.ts` 的方法块)。不改证据卡、工具、领域清单、用户轮指令、模型与时钟。
|
||||
@@ -16827,7 +16827,7 @@
|
||||
|
||||
## BUG-1257 | 生时校正口吻与普通对话不一致;开场 / 只读轮整本 Skill 进模型
|
||||
|
||||
- 状态:fixed-pending-verify(分支 `codex/rectification-voice-slim-20261007`;部署与真机前不标 resolved)
|
||||
- 状态:fixed-pending-verify(已部署 staging `61d6f248`,真机欠;不标 resolved)
|
||||
- 首次发现 / 最近更新:2026-10-07 / 2026-10-07
|
||||
- 来源:产品要求把生时校正也按普通对话的方式优化、口吻统一由 Claude 直接做。
|
||||
- 影响面:`mastra/agentic-rectification.ts` 两版系统提示的开头;`v9/skill-slice.ts` 的按轮次切片。不改校正打分、出卡、采用门、工具、服务器写的固定文案、Skill 文件。
|
||||
@@ -16842,7 +16842,7 @@
|
||||
|
||||
## BUG-1258 | 生时校正服务器固定句口气生硬(「已记录。」回执、「请……」、内部词)
|
||||
|
||||
- 状态:fixed-pending-verify(分支 `codex/rectification-copy-voice-20261007`;真机前不标 resolved)
|
||||
- 状态:fixed-pending-verify(已部署 staging `6ec8efd5`,真机欠;不标 resolved)
|
||||
- 首次发现 / 最近更新:2026-10-07 / 2026-10-07
|
||||
- 来源:BUG-1257 后产品要求把服务器写死的提示语也改成知心姐姐口吻;Claude 出 15 句样稿,产品认可后全量改。
|
||||
- 影响面:`user-copy.ts`、`v9/choice-action.ts`、`v9/post-adopt-verdict.ts`、`v9/adopt-narration.ts`(及其旁白提示词里引用的同一句)、`v9/run-diagnostic.ts` 的重复文案、`rectification-chat-choice-run.ts` 兜底、`rectification-agentic-chat.tsx` 两句输入框提示。不改系统报错、写给模型的规则、题库与盘型说明、数字与诚实边界。
|
||||
@@ -16856,7 +16856,7 @@
|
||||
|
||||
## BUG-1247 | 首页生时校正按钮与文字口令:入口在对话之外、对话里只靠固定口令跳转
|
||||
|
||||
- 状态:fixed-pending-verify(分支 `codex/rectification-in-chat-step1-20261006`;部署与真机清单完成前不标 resolved)
|
||||
- 状态:fixed-pending-verify(已部署 staging `11333460`,真机欠;不标 resolved)
|
||||
- 首次发现 / 最近更新:2026-10-07 / 2026-10-07
|
||||
- 来源:产品决定生时校正并入对话(任务书 `docs/tasks/TASK-rectification-in-chat-step1-20261006.md`,P1–P3、C1–C8),产品要求直接执行。
|
||||
- 现象:首页有独立「生时校正」pill;普通对话里只有打出「生时校正 / 先完成生时校正」这类原话才会新开一条校正会话,原问题只剩一行展示。
|
||||
@@ -16868,7 +16868,7 @@
|
||||
|
||||
## BUG-1248 | 对话里没有「推得不准」时的校正提议
|
||||
|
||||
- 状态:fixed-pending-verify(分支 `codex/rectification-in-chat-step1-20261006`;部署与真机清单完成前不标 resolved)
|
||||
- 状态:fixed-pending-verify(已部署 staging `11333460`,真机欠;不标 resolved)
|
||||
- 首次发现 / 最近更新:2026-10-07 / 2026-10-07
|
||||
- 来源:产品决定生时校正并入对话(任务书 `docs/tasks/TASK-rectification-in-chat-step1-20261006.md`,P1–P3、C1–C8),产品要求直接执行。
|
||||
- 现象:用户在普通对话里说过去的事对不上、出生时间是估的,agent 没有任何校正相关的指令或入口。
|
||||
@@ -16878,7 +16878,7 @@
|
||||
|
||||
## BUG-1249 | 校正不知道是从哪条对话开始的
|
||||
|
||||
- 状态:fixed-pending-verify(分支 `codex/rectification-in-chat-step1-20261006`;部署与真机清单完成前不标 resolved)
|
||||
- 状态:fixed-pending-verify(已部署 staging `11333460`,真机欠;不标 resolved)
|
||||
- 首次发现 / 最近更新:2026-10-07 / 2026-10-07
|
||||
- 来源:产品决定生时校正并入对话(任务书 `docs/tasks/TASK-rectification-in-chat-step1-20261006.md`,P1–P3、C1–C8),产品要求直接执行。
|
||||
- 修复:打开接口在 `intent=homepage` 且带 `sourceSessionId` 时,把该会话里最新一张 `offered` 提议卡改为 `opened` 并写入 `caseId` / `rectificationSessionId`(调用者自己的客户端,`messages` 为本人可更新列;best effort)。新 `GET /api/rectification/cases/[caseId]/source` 在本人最近 20 条咨询会话里找绑定该 case 的提议卡,刷新后仍能找回来源。不改表。
|
||||
@@ -16887,7 +16887,7 @@
|
||||
|
||||
## BUG-1250 | 校正做完让用户「新建对话」,原问题和上下文丢失
|
||||
|
||||
- 状态:fixed-pending-verify(分支 `codex/rectification-in-chat-step1-20261006`;部署与真机清单完成前不标 resolved)
|
||||
- 状态:fixed-pending-verify(已部署 staging `11333460`,真机欠;不标 resolved)
|
||||
- 首次发现 / 最近更新:2026-10-07 / 2026-10-07
|
||||
- 来源:产品决定生时校正并入对话(任务书 `docs/tasks/TASK-rectification-in-chat-step1-20261006.md`,P1–P3、C1–C8),产品要求直接执行。
|
||||
- 修复:`POST /api/rectification/cases/[caseId]/source` 由服务端读 case 的 `accepted_time` 判断是否改了时间,在来源对话末尾追加一条分隔消息(`rectificationReturn`,每个 case 一次)并把提议卡标为 `returned`;浏览器重读该会话并切过去。校正面「回到刚才的对话」按钮(仅有来源时);采用后核对结束(`verified_idle`)或 case 终态时,在本视图做过操作的校正 2.5 s 后自动回去(`useRectificationAutoReturn`),历史打开的已结束 case 不自动跳。分隔线下「按新时间重新看」走 `onFollowUp`,点击才发送。分隔消息不显示操作行、不参与「重新生成」。
|
||||
@@ -16896,7 +16896,7 @@
|
||||
|
||||
## BUG-1251 | 改了出生时间后,模型仍读得到旧时间下的回答
|
||||
|
||||
- 状态:fixed-pending-verify(分支 `codex/rectification-in-chat-step1-20261006`;部署与真机清单完成前不标 resolved)
|
||||
- 状态:fixed-pending-verify(已部署 staging `11333460`,真机欠;不标 resolved)
|
||||
- 首次发现 / 最近更新:2026-10-07 / 2026-10-07
|
||||
- 来源:产品决定生时校正并入对话(任务书 `docs/tasks/TASK-rectification-in-chat-step1-20261006.md`,P1–P3、C1–C8),产品要求直接执行。
|
||||
- 修复:`storedConsultationTurns` 跳过分隔消息;最近一次改时间的分隔线之前的助手回答,在模型历史里前缀「(以下回答按校正前的出生时间,不要沿用其中的盘面判断)」;会话摘要早于改时间时同样加这句。
|
||||
@@ -16905,7 +16905,7 @@
|
||||
|
||||
## BUG-1259 | 新对话里还没发第一句就换模型,提示「云端同步失败」
|
||||
|
||||
- 状态:fixed-pending-verify(真机复核前不标 resolved)
|
||||
- 状态:fixed-pending-verify(已部署 staging `0ed45a4b`,真机欠;不标 resolved)
|
||||
- 首次发现 / 最近更新:2026-10-07 / 2026-10-07
|
||||
- 来源:产品 iPhone 真机截图(staging 首页,新对话未发消息时切到 gpt-5.6-luna)。
|
||||
- 影响面:`use-session-management.ts` 的 `selectSessionModel` → `patchSessionModel` → `PATCH /api/sessions/{id}`;首页 / 新建的空对话。
|
||||
@@ -16917,7 +16917,7 @@
|
||||
- 验证:`session-list-filter.test.ts` 新增 1 条源码合同(守卫在任何 PATCH 之前、清失败标记并 return、create 写入 `model_id`);去掉修复后该测试失败、恢复后通过。全量 4988 项 fail 24,与 `11333460` 逐条一致;tsc 0、lint 0 error;build `/` Static,首屏 gzip 568,343 → 568,362 B。
|
||||
- 防复发:上述测试;以后凡是对会话发 PATCH 的入口,先判断会话是否已落库(BUG-989 的「第一问才落库」)。
|
||||
- 相关记录:BUG-989、BUG-928。
|
||||
- 修复版本:待发布
|
||||
- 修复版本:已部署 staging `0ed45a4b`,真机欠。
|
||||
|
||||
## BUG-1260 | D5/D6/D8/D11 分盘映射与 PVR 6.2 不一致
|
||||
|
||||
@@ -17930,3 +17930,18 @@
|
||||
- 复发自:无。
|
||||
- 修复版本:分支 `codex/node-runtime-resources-20261013`,尚未合入 staging。
|
||||
|
||||
## BUG-1347 | 对话和报告阅读页没有标明内容由 AI 生成
|
||||
|
||||
- 状态:fixed-pending-verify(代码与组件测试已过;真机看对话和报告前不标 resolved)
|
||||
- 首次发现 / 最近更新:2026-10-14 / 2026-10-14
|
||||
- 来源:内测主路径。产品 2026-10-14 同意文案。
|
||||
- 现象:协议里写了回答和报告由人工智能生成,报告结尾也有免责。普通对话、生时校正的输入框下,以及报告标题下,都没有一行能直接看见的标识。
|
||||
- 触发条件:打开对话或打开一份报告。
|
||||
- 根因:合规那一轮只写进协议和生成正文的结尾,没有放到界面上。
|
||||
- 修复:`ChatComposer` 在输入框下方加一行说明,普通对话和生时校正一起生效,不改首页状态数。报告的 Markdown 阅读页和结构化阅读页在标题下加一行。中英文文案按产品同意的句子。不改报告生成正文,结尾免责保留。下载的 PDF 与 Word 目前没有这套导出;Markdown 下载有字节锁,本轮不改下载文件。
|
||||
- 验证:`frontend/tests/ai-generated-notice-20261014.test.ts`。tsc 与 lint 见进度记录。
|
||||
- 防复发:上述测试锁住两处对话都走同一个组件里的这行,以及报告中英文标题下的句子。
|
||||
- 相关记录:BUG-1063
|
||||
- 复发自:无
|
||||
- 修复版本:分支 `codex/beta-main-path-20261014`,尚未合入 staging。
|
||||
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
# PROGRESS · 内测主路径:给别人出报告、AI 生成标识、状态板清账(issue #73)
|
||||
|
||||
- 分支:`codex/beta-main-path-20261014`
|
||||
- 实际基线:`origin/staging` `f4c53e7f9fad1a3de08b613c3470f8e4a2f62116`
|
||||
- 任务书基线写成 `48a2fadd`,计划评论里的 base 是 `13bde11539bc99f76330376145c756da22d149e3`。开工时远端 staging 已是上面的 `f4c53e7f`。方向没有改,不需要拍板。
|
||||
- 产品 2026-10-14 已同意标识文案,并指定 BUG-1063 用逐列只读授权(任务书 §11)。
|
||||
- 开工时 `docs/BUG_HISTORY.md` 最大号是 BUG-1346。本单新增 BUG-1347。BUG-1246 在本文件里没有对应标题,没有改。
|
||||
- 未改 `page.tsx`。没有授写权限,没有改 RLS,没有改 `authenticated` 现有授权。Skill 版本不变。
|
||||
|
||||
## 做了什么
|
||||
|
||||
T0:给别人出报告的后台在授权之前读不到档案表。同一条数据库用例失败,错误原文是 `permission denied for table chart_profiles`,代码 `42501`。这不是绿的,所以继续做 T1。
|
||||
|
||||
T1:新迁移只给 `service_role` 增加档案表上、报告读档所需各列的 `SELECT`。合同测试核对选择列都在授权里,并且新文件里没有写授权、没有策略改动、没有改登录用户授权。BUG-1063 记为 fixed-pending-verify:部署并真机给别人出一份报告之前不标 resolved。
|
||||
|
||||
T2:对话输入框下方一行中文说明「回答由 AI 生成,仅供参考,不构成医疗、法律或投资建议。」报告的两种阅读页在标题下加「本报告由 AI 生成,仅供参考。」英文阅读用「This report is AI-generated and for reference only.」英文对话那句写在文案口径里,界面是中文,不另画一行。没有单独的公开分享页,两种阅读页都带上了这行。DESIGN、VOICE 同提交更新。
|
||||
|
||||
T2b 让掉:仓库里没有 PDF / DOCX 导出器。Markdown 下载是按字节锁定的,没有改生成正文,也没有往下载文件里写元数据。记在 BUG-1347。
|
||||
|
||||
T3–T5:状态行只改措辞和部署证据。下列提交都已在 `origin/staging` 上:`82c8aeb0`(906、907)、`dec36bce`(1080)、`8112f62b`(1128 字体部分)、`e62d0a32`(1244、1245)、`52d14e8f`(1252、1253、1254)、`b8385adb`(1255)、`c76fdda7`(1256)、`61d6f248`(1257)、`6ec8efd5`(1258)、`11333460`(1247–1251)、`0ed45a4b`(1259)。仍是 fixed-pending-verify 或 investigating,没有改成 resolved。1254 写明门禁 run 1747、1750、1753、1756、1759、1762 连续六次通过,再观察前不标 resolved。BUG-283 状态改为 superseded(由 BUG-299 取代),根因原文保留。
|
||||
|
||||
T6:`scratchpad/beta-smoke-checklist-20261014.md` 不在这棵树上。冒烟清单已经在 `docs/testing/beta-smoke-20261014.md`,本单只补了第 4、8、9 行(对话标识、他人报告、报告标题中英文标识)。
|
||||
|
||||
## 断言三栏
|
||||
|
||||
没有改既有断言。新增用例只加期望。
|
||||
|
||||
## 自测
|
||||
|
||||
| 检查 | 命令 | 结果 |
|
||||
| --- | --- | --- |
|
||||
| 类型 | `frontend\node_modules\.bin\tsc --noEmit -p frontend` | 退出码 0,约 51 秒。中途一次失败是测试里 `createRef()` 没写元素类型,已改成文本框类型后重跑通过 |
|
||||
| 规范 | `npm run lint --prefix frontend` | 退出码 0,0 error,125 条原有 warning。本单改的文件没有新增 warning |
|
||||
| 定向测试 | `tsx --test`:AI 标识、授权合同、输入框合同、报告阅读 | tests 51,pass 51,fail 0,cancelled 0,退出码 0,约 3.3 秒 |
|
||||
| 数据库 | `npm run test:db --prefix frontend` | 退出码 1。tests 82,pass 69,fail 13,cancelled 0,约 1390 秒。13 条失败的名字与 `tools/agent-loop/windows-known-failures.txt` 逐条相同,没有多出来的。本单那条是 ok 54 |
|
||||
| 全量前端测试 / 构建 / Python 快速门 | 未跑 | 留给验收。本单不改 `scripts/` |
|
||||
| 隐私标记 | `.venv\Scripts\python.exe -m pytest tests/test_repo_privacy_markers.py -q` | 退出码 0,约 59 秒 |
|
||||
|
||||
## 偏离
|
||||
|
||||
- 任务书点名的数据库文件可以新建 `database-report-worker-subject.test.ts`,用的是这个名字,没有改旧的 `database-chart-subject.test.ts`。
|
||||
- 英文对话说明没有画在界面上,因为对话外壳只有中文。句子留在 VOICE。
|
||||
- T2b 按让步顺序跳过。
|
||||
- 冒烟草稿不在树里,改的是已经落盘的清单,没有另起一份。
|
||||
@@ -332,7 +332,7 @@
|
||||
| `TASK-rectification-refresh-r3-r4-20260913.md` | `PROGRESS-rectification-refresh-r3-r4-20260913.md` | 刷新阶段 R3(MIN_BOUNDARY_DAYS 45→30)+ R4(pratyantar 与 D9/D10 上升 Narayana);首轮出题不变。即使放宽仍有 0 题例子,定向补事另线保留(BUG-664/665) | 已实现 `ab1ade59`,已部署;2026-09-13 验收通过(实现单由执行方自拟,无产品决策记录段;收益口径见研究文档) | `codex/rectification-refresh-r3-r4-20260913` |
|
||||
| `TASK-upstream-sync6-20261007.md` | [PROGRESS-upstream-sync6-20261007.md](PROGRESS-upstream-sync6-20261007.md) | **上游同步第六轮(`23be1807`)**:10-05 五个计算修正一行未合——D5/D6/D8/D11 映射(乔布斯盘四张分盘星座全不同)、Vimsopaka 权重、Yogini 顺序与出生余额、Panchadhikari 宫位参照、Narayana 并列、特殊上升、出生秒数、Neecha Bhanga 两条件、首段大运子运、岁差被覆盖;逐项对照原书核实;最先做 | 已验收(门禁补修 `2df6ee72`,已部署 staging) | [PROGRESS-upstream-sync6-20261007.md](PROGRESS-upstream-sync6-20261007.md) |
|
||||
| `TASK-upstream-sync7-20261014.md` | [PROGRESS-upstream-sync7-20261014.md](PROGRESS-upstream-sync7-20261014.md) | **上游同步第七轮(BUG-1318 起)**:婚恋评级断语改证据档位、DK「婚姻质量 X/100」改对;KP 宫头到宫头判宫;瑜伽宫主排序去重;api_server 大运年长 365.25;星历路径只核查。不动校正打分。Grok 执行(agent 循环) | 待验收 | `codex/upstream-sync7-20261014`(BUG-1318~1321 已改;BUG-1322 星历路径核查中,未改代码) |
|
||||
| `TASK-beta-main-path-20261014.md` | — | **内测主路径**:BUG-1063 他人报告 worker 读档案(逐列只读授权 + test:db);对话与报告「AI 生成,仅供参考」标识与免责;BUG-1080/283 状态;状态板按事实清账;冒烟清单 `docs/testing/beta-smoke-20261014.md`。与发布单并行 | 待执行 | — |
|
||||
| `TASK-beta-main-path-20261014.md` | `PROGRESS-beta-main-path-20261014.md` | **内测主路径**:BUG-1063 他人报告 worker 读档案(逐列只读授权 + test:db);对话与报告「AI 生成,仅供参考」标识与免责;BUG-1080/283 状态;状态板按事实清账;冒烟清单 `docs/testing/beta-smoke-20261014.md`。与发布单并行 | 待验收 | `codex/beta-main-path-20261014` |
|
||||
| `TASK-release-path-production-20261014.md` | — | **发布通路 + 生产首发**:产品 10-14 授权改生产工作流(发布 SHA = 最近门禁成功提交 + 其后纯文档);63 个迁移清单与演练脚本、首发 runbook;生产拒绝测试验证码。Grok 不 dispatch 生产工作流 | 待执行 | — |
|
||||
| `TASK-beta-safety-net-20261014.md` | — | **内测安全网**:每日备份 + 恢复演练、探活告警、本地错误汇总、日志轮转、按 requestId 查日志。**等发布通路单合入、#58 合入后开工** | 待前置 | — |
|
||||
| `TASK-beta-capacity-20261014.md` | — | **内测容量**:按用户限流、重计算短排队与对话重试、兑换码当邀请码、staging 10/20 并发压测。**等 #58 合入后开工,压测等 #57 合入** | 待前置 | — |
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
| 1 | 新人第一次进站 | 一个从没用过的邮箱;手机 Safari | 打开登录页 → 勾选同意 → 输入邮箱 → 发验证码 → 输入固定码 → 填出生资料(城市、日期、时间) | 不要求设密码;建盘后先看到群星汇聚过场,**不先弹兑换窗**;过场后进入首页 | BUG-1080、1152;`staging-otp-skip-password-20261001.md`、`birth-sky-cover-checklist.md` | | | |
|
||||
| 2 | 首页 | 第 1 条的账号 | 停留首页、刷新一次 | 不卡在「正在载入账户」;今日星语有当天内容(不是「没写出来」);会话列表正常 | BUG-936、283 / 299;`home-first-load-20260930.md`、`session-list-rebuild-20260921.md` | | | |
|
||||
| 3 | 寒暄不扣点 | 记下当前点数 | 新对话发「你好」 | 一句简短回应,不排盘、不出长解读;点数不变 | BUG-976、977;`consult-smalltalk-fastpath-20260920.md` | | | |
|
||||
| 4 | 普通对话 + AI 标识 | 有点数 | 问一个事业问题,再追问一句 | 回答几段人话、不念内部清单;输入框下方有「回答由 AI 生成,仅供参考……」一行;iPhone 上正文右侧无大块空白、不抖;收起键盘页面不上移 | BUG-1252、1253、1255、920、内测主路径单 T2;`consult-readable-20261006.md`、`mobile-viewport-scroll-lock-20260917.md` | | | |
|
||||
| 4 | 普通对话 + AI 标识 | 有点数 | 问一个事业问题,再追问一句;再打开一条生时校正看输入框 | 回答几段人话、不念内部清单;两处输入框下方都有「回答由 AI 生成,仅供参考,不构成医疗、法律或投资建议。」,窄屏不换行、不挡住发送;iPhone 上正文右侧无大块空白、不抖;收起键盘页面不上移 | BUG-1252、1253、1255、920、1347、内测主路径单 T2;`consult-readable-20261006.md`、`mobile-viewport-scroll-lock-20260917.md` | | | |
|
||||
| 5 | 明说要校正 | 档案出生时间是「大约」 | 新对话说「帮我做一下生时纠正」;另开一个对话说「这个解读我不认同」 | 第一句直接进入校正,不先写解读;第二句**不**进入校正,只改读法 | BUG-1306、1317;`rectification-explicit-entry-20261012.md` 第 1、1b、4、9 步 | | | |
|
||||
| 6 | 校正开场 | 第 5 条进入的校正 | 看开场三句 | 说出填的时间离最近换段差几分钟、两边哪几件事不同;离得近时有「这里连本命上升都换」;不出现秒、「记录时间是错的」 | BUG-1307、1309;`rectification-nearest-boundary-opening-20261012.md` | | | |
|
||||
| 7 | 人物档案不串人 | 人物档案里加一位家人 | 切换到家人 → 设为默认 → 回到本人 → 再切家人 | 每次显示的资料都是对应的人,名字、出生资料不串 | BUG-1030;`people-archive-p1-20260924.md` | | | |
|
||||
| 8 | 给别人出报告 | 第 7 条的家人;有点数 | 选家人 → 生成报告 → 等完成 → 打开 | 报告能生成完成(不一直排队、不失败退款),标题下有「本报告由 AI 生成,仅供参考。」 | BUG-1063、内测主路径单 T1/T2 | | | |
|
||||
| 9 | 本人报告 | 本人 | 生成一份中文完整报告并打开;切英文看一眼 | 开篇重点卡正常;英文版无中文残留;结尾免责在 | BUG-1312~1316;`report-translation-gaps-20261013.md`、`report-focus-card-20261013.md` | | | |
|
||||
| 8 | 给别人出报告 | 第 7 条的家人;有点数 | 选家人 → 生成报告 → 等完成 → 打开 | 报告能生成完成(不一直排队、不失败退款),标题下有「本报告由 AI 生成,仅供参考。」 | BUG-1063、1347、内测主路径单 T1/T2 | | | |
|
||||
| 9 | 本人报告 | 本人 | 生成一份中文完整报告并打开;切英文看一眼 | 开篇重点卡正常;中文标题下有「本报告由 AI 生成,仅供参考。」,英文标题下是 “This report is AI-generated and for reference only.”;英文版无中文残留;结尾免责在 | BUG-1312~1316、1347;`report-translation-gaps-20261013.md`、`report-focus-card-20261013.md` | | | |
|
||||
| 10 | 反馈与注销 | 任一测试账号 | 对一条回答点踩并写一句反馈 → 后台「反馈」页查看;账户设置里申请注销 → 再撤销 | 后台能看到反馈;注销申请显示 7 天冷静期,撤销后账户恢复 | `surface-feedback-20260929.md`、`legal-consent-20260930.md`、`compliance-launch-20260930.md` | | | |
|
||||
| 11 | 限流与排队(容量单合入后) | 两台设备同一账号 | 1 分钟内连发 7 次提问;另找 3 个账号同时做校正 | 第 7 次得到一句「太快了,稍等一下」类提示,不扣点;同时校正的人看到「排一下队」后照常继续,不报错 | 内测容量单 T1/T2 | | | |
|
||||
|
||||
+2
-2
@@ -339,11 +339,11 @@ Radii have two visual steps. Controls use 8px (`--radius-md`; `--radius-xs` and
|
||||
### Input and composer
|
||||
|
||||
- **Structure:** a column, not a row — warm canvas field on top, the composer's own bottom row beneath it. The row carries the model picker on the left and the send/stop control on the right, with the character count inline beside it.
|
||||
- **No strip below the composer.** `.composer-footer` used to sit under the field at a permanent `min-height: 44px`, holding the model picker and a count that only appears near the cap — so most of the time it was 44px of empty chrome on every screen. The row is inside the box now and only renders what it has.
|
||||
- **No tool strip below the composer.** `.composer-footer` used to sit under the field at a permanent `min-height: 44px`, holding the model picker and a count that only appears near the cap — so most of the time it was 44px of empty chrome on every screen. The row is inside the box now and only renders what it has. A single line of copy (`.composer-ai-notice`, 2026-10-14) sits under the box: it is not a tool row, has no 44px slot, and on a narrow screen it stays one line and ellipsizes instead of wrapping over the send control.
|
||||
- **States:** default, hover, focus with deep-brown ring, disabled only for structural reasons (readonly, session loading, onboarding, the other surface open, **a rectification session whose surface is not yet open**), invalid. Generating does not disable the textarea; the send control becomes stop. On a rectification session the ordinary composer is only a disabled field with placeholder「正在打开生时校正…」; if opening failed, a「重新打开生时校正」button sits above it. No spinner.
|
||||
- **Queue:** one pending card (`.composer-queue`) sits above the field while an answer is in flight. Copy: “已排队,回答结束后发出”, plus the text and a 44px “撤回”. A second Enter appends to the same card with a newline. Successful settlement sends it; stop, failure, or recovery puts the text back in the field. The send button is disabled while a card is waiting. No spinner.
|
||||
- **Accessibility:** persistent label where practical; composer has an explicit accessible label.
|
||||
- **One composer:** the rectification surface renders the same `ChatComposer` as the main chat; there is no second composer. A surface that owns its own draft passes it as `value`; the main chat reads the draft store. Both count down from the same 500-character ceiling through `CharacterRemaining`, which the composer renders inline and only once `characterRemainingVisible()` is true — it no longer has a permanent container. Controls that belong to the composer go through the `toolbar` slot; nothing is stacked below it.
|
||||
- **One composer:** the rectification surface renders the same `ChatComposer` as the main chat; there is no second composer. A surface that owns its own draft passes it as `value`; the main chat reads the draft store. Both count down from the same 500-character ceiling through `CharacterRemaining`, which the composer renders inline and only once `characterRemainingVisible()` is true — it no longer has a permanent container. Controls that belong to the composer go through the `toolbar` slot. The only thing under the box is the one-line AI notice, not another control.
|
||||
- **Inner field corners:** the textarea inside `.composer` has `border-radius: 0`. Rounding stays on the outer `.composer` only. The field has no horizontal padding, so a radius on the textarea itself clips the first glyph's left edge (BUG-1311).
|
||||
|
||||
### Answer start anchor
|
||||
|
||||
@@ -239,6 +239,12 @@ Jyotisha 的可见文案是产品的一部分。正确性红线(真实性、
|
||||
|
||||
星盘、星历、报告列表几秒内就会出现,等待时只放轨道环动画,不在屏幕上写「这一张盘还没拿到。」一类句子;这些句子只给读屏器。首页不再写「上次那次校正还没完成,可以在历史对话里接着做。」。
|
||||
|
||||
## AI 生成标识(2026-10-14)
|
||||
|
||||
对话输入框下方一行,普通对话和生时校正共用,不进回答正文:「回答由 AI 生成,仅供参考,不构成医疗、法律或投资建议。」英文壳还没有,对应英文先定下:「AI-generated. For reference only; not medical, legal or financial advice.」
|
||||
|
||||
报告标题下(中文阅读页、结构化阅读页、英文版)一行:「本报告由 AI 生成,仅供参考。」英文:「This report is AI-generated and for reference only.」报告结尾原有的免责保留,不改生成正文。
|
||||
|
||||
## 协议与同意(2026-09-30)
|
||||
|
||||
- 勾选框:「我已阅读并同意《用户协议》和《隐私政策》」;未勾选就提交:「请先阅读并勾选同意,再继续。」(只在框下一行,不弹 toast)。
|
||||
|
||||
@@ -1850,6 +1850,7 @@ section[popover]:has(> [data-sonner-toaster]), section[popover][aria-label^="页
|
||||
outline-offset: 3px;
|
||||
}
|
||||
.composer { width: min(760px, 100%); display: flex; flex-direction: column; gap: var(--space-2); margin: 0 auto; border: 1px solid var(--color-border-strong); transition: border-color 140ms ease-out; padding: var(--space-3) var(--space-3) var(--space-2); border-radius: var(--radius-lg); background: var(--color-canvas); }
|
||||
.composer-ai-notice { width: min(760px, 100%); margin: var(--space-2) auto 0; overflow: hidden; color: var(--color-ink-tertiary); font-size: var(--type-overline); line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
|
||||
/* The composer's own bottom row. It replaces .composer-footer, a strip below
|
||||
the composer that held a permanent 44px whether or not it had anything to
|
||||
show. The row only exists when there is a toolbar or a count to render. */
|
||||
@@ -4352,6 +4353,12 @@ input:not([type="radio"]):not([type="checkbox"]):not([class^="ant-"]):not([class
|
||||
font-size: var(--type-caption);
|
||||
line-height: 1.5;
|
||||
}
|
||||
.personal-report-ai-notice {
|
||||
margin: 0 0 var(--space-3);
|
||||
color: var(--color-ink-tertiary);
|
||||
font-size: var(--type-overline);
|
||||
line-height: 1.45;
|
||||
}
|
||||
.personal-report-focus-card {
|
||||
display: grid;
|
||||
gap: var(--space-3);
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
serverComposerDraftSnapshot,
|
||||
subscribeComposerDraft,
|
||||
} from "@/lib/composer-draft";
|
||||
import { CHAT_AI_NOTICE_ZH } from "@/lib/ai-generated-notice";
|
||||
import { COMPOSER_QUEUE_LABEL, COMPOSER_QUEUE_RECALL_LABEL } from "@/lib/queued-draft";
|
||||
|
||||
export const composerRemainingId = "composer-character-remaining";
|
||||
@@ -133,6 +134,7 @@ export function ChatComposer({
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<p className="composer-ai-notice">{CHAT_AI_NOTICE_ZH}</p>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import {
|
||||
type ReportDocument,
|
||||
type ReportDocumentV2,
|
||||
} from "@/lib/personal-report-contract";
|
||||
import { reportAiNotice } from "@/lib/ai-generated-notice";
|
||||
import { reportThemeLabel } from "@/lib/personal-report-progress";
|
||||
|
||||
const CLAIM_STATUS_LABELS: Record<ClaimStatus, string> = {
|
||||
@@ -191,6 +192,7 @@ function ReportCover({ document, d1 }: { document: ReportDocument; d1: ChartV1 |
|
||||
<div>
|
||||
<p className="personal-report-kicker">个人报告</p>
|
||||
<h1>{document.subject.displayName}</h1>
|
||||
<p className="personal-report-ai-notice">{reportAiNotice("zh")}</p>
|
||||
<p className="personal-report-deck">{document.executiveSummary.headline}</p>
|
||||
</div>
|
||||
<dl className="personal-report-metadata">
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
parseReportChartBlock,
|
||||
toNorthIndianChart,
|
||||
} from "@/lib/report-chart-block";
|
||||
import { reportAiNotice } from "@/lib/ai-generated-notice";
|
||||
import { parseReportFocusBlock, reportTitleByline } from "@/lib/report-focus-block";
|
||||
import { reportChartGrid } from "@/lib/report-chart-grid-rehype";
|
||||
import { NorthIndianChartSvg } from "@/components/personal-report/vedic-chart-svg";
|
||||
@@ -69,10 +70,12 @@ function markdownComponents(
|
||||
h1: ({ children }) => {
|
||||
const title = flattenText(children).trim();
|
||||
const line = byline.shown ? null : reportTitleByline({ title, subjectName, createdAt, language });
|
||||
const notice = byline.shown ? null : reportAiNotice(language);
|
||||
byline.shown = true;
|
||||
return (
|
||||
<>
|
||||
<h1>{children}</h1>
|
||||
{notice ? <p className="personal-report-ai-notice">{notice}</p> : null}
|
||||
{line ? <p className="personal-report-md-byline">{line}</p> : null}
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import type { ReportLanguage } from "./report-language.ts";
|
||||
|
||||
/** Visible label under the chat field. The product shell is Chinese. */
|
||||
export const CHAT_AI_NOTICE_ZH = "回答由 AI 生成,仅供参考,不构成医疗、法律或投资建议。";
|
||||
|
||||
/** English equivalent, locked for a future English shell. Not shown in the Chinese UI. */
|
||||
export const CHAT_AI_NOTICE_EN = "AI-generated. For reference only; not medical, legal or financial advice.";
|
||||
|
||||
export const REPORT_AI_NOTICE_ZH = "本报告由 AI 生成,仅供参考。";
|
||||
export const REPORT_AI_NOTICE_EN = "This report is AI-generated and for reference only.";
|
||||
|
||||
export function reportAiNotice(language: ReportLanguage): string {
|
||||
return language === "en" ? REPORT_AI_NOTICE_EN : REPORT_AI_NOTICE_ZH;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
-- BUG-1063: the report worker reads another person's archive through
|
||||
-- service_role (loadSubjectBirth → CHART_SUBJECT_SELECT). The 2026-07-18
|
||||
-- repair revoked every privilege on chart_profiles and never granted SELECT
|
||||
-- back. Column-level SELECT only, matching CHART_SUBJECT_SELECT. No write,
|
||||
-- no RLS change, no change to authenticated grants.
|
||||
begin;
|
||||
|
||||
grant select (
|
||||
id,
|
||||
user_id,
|
||||
role,
|
||||
name,
|
||||
birth_date,
|
||||
reported_birth_time,
|
||||
birth_time_source,
|
||||
birth_time_period,
|
||||
declared_window_start,
|
||||
declared_window_end,
|
||||
uncertainty_before_minutes,
|
||||
uncertainty_after_minutes,
|
||||
latitude,
|
||||
longitude,
|
||||
timezone_id,
|
||||
timezone_offset,
|
||||
birth_place_label,
|
||||
birth_place_type,
|
||||
birth_place_provider,
|
||||
birth_place_provider_id,
|
||||
ayanamsa,
|
||||
active_birth_time,
|
||||
active_birth_date,
|
||||
active_birth_timezone_offset,
|
||||
birth_time_status,
|
||||
gender
|
||||
) on table public.chart_profiles to service_role;
|
||||
|
||||
commit;
|
||||
@@ -0,0 +1,79 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { createElement, createRef } from "react";
|
||||
import { readFileSync } from "node:fs";
|
||||
import test from "node:test";
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
|
||||
import { ChatComposer } from "../src/components/chat-composer.tsx";
|
||||
import { PersonalReportDocumentView } from "../src/components/personal-report/personal-report-document-view.tsx";
|
||||
import { PersonalReportMarkdownView } from "../src/components/personal-report/personal-report-markdown-view.tsx";
|
||||
import {
|
||||
CHAT_AI_NOTICE_EN,
|
||||
CHAT_AI_NOTICE_ZH,
|
||||
REPORT_AI_NOTICE_EN,
|
||||
REPORT_AI_NOTICE_ZH,
|
||||
} from "../src/lib/ai-generated-notice.ts";
|
||||
import type { LegacyReportDocumentV1 } from "../src/lib/personal-report-contract.ts";
|
||||
|
||||
const styles = readFileSync(new URL("../src/app/globals.css", import.meta.url), "utf8");
|
||||
const page = readFileSync(new URL("../src/app/(app)/page.tsx", import.meta.url), "utf8");
|
||||
const rectification = readFileSync(new URL("../src/components/rectification-agentic-chat.tsx", import.meta.url), "utf8");
|
||||
const fixture = JSON.parse(readFileSync(
|
||||
new URL("../../tests/fixtures/personal_report_document.v1.json", import.meta.url),
|
||||
"utf8",
|
||||
)) as LegacyReportDocumentV1;
|
||||
|
||||
function composerHtml(): string {
|
||||
return renderToStaticMarkup(createElement(ChatComposer, {
|
||||
inputRef: createRef<HTMLTextAreaElement>(),
|
||||
value: "",
|
||||
inputLabel: "输入你的问题",
|
||||
placeholder: "想聊什么都可以",
|
||||
maxLength: 500,
|
||||
inputDisabled: false,
|
||||
submitLabel: "发送",
|
||||
submitBlocked: false,
|
||||
stopVisible: false,
|
||||
stopLabel: "停止回答",
|
||||
stopTitle: "停止回答",
|
||||
onSubmit() {},
|
||||
onChange() {},
|
||||
onKeyDown() {},
|
||||
onStop() {},
|
||||
}));
|
||||
}
|
||||
|
||||
test("both chat surfaces share the composer notice, under the field and not over the send control", () => {
|
||||
assert.equal(CHAT_AI_NOTICE_ZH, "回答由 AI 生成,仅供参考,不构成医疗、法律或投资建议。");
|
||||
assert.equal(CHAT_AI_NOTICE_EN, "AI-generated. For reference only; not medical, legal or financial advice.");
|
||||
const html = composerHtml();
|
||||
const noticeAt = html.indexOf("composer-ai-notice");
|
||||
const sendAt = html.indexOf("发送");
|
||||
assert.ok(noticeAt > sendAt, "the notice follows the send control");
|
||||
assert.match(html, new RegExp(CHAT_AI_NOTICE_ZH));
|
||||
assert.match(page, /<ChatComposer/);
|
||||
assert.match(rectification, /<ChatComposer/);
|
||||
assert.doesNotMatch(page, /CHAT_AI_NOTICE_ZH|composer-ai-notice/);
|
||||
assert.doesNotMatch(rectification, /CHAT_AI_NOTICE_ZH|composer-ai-notice/);
|
||||
assert.match(styles, /\.composer-ai-notice\s*\{[^}]*white-space:\s*nowrap/);
|
||||
assert.match(styles, /\.composer-ai-notice\s*\{[^}]*overflow:\s*hidden/);
|
||||
assert.doesNotMatch(styles, /\.composer-footer\s*\{/);
|
||||
});
|
||||
|
||||
test("report readers show the AI notice in Chinese and English under the title", () => {
|
||||
assert.equal(REPORT_AI_NOTICE_ZH, "本报告由 AI 生成,仅供参考。");
|
||||
assert.equal(REPORT_AI_NOTICE_EN, "This report is AI-generated and for reference only.");
|
||||
const chinese = renderToStaticMarkup(createElement(PersonalReportMarkdownView, {
|
||||
markdown: "# 虚构报告\n\n一段说明。",
|
||||
language: "zh",
|
||||
}));
|
||||
const english = renderToStaticMarkup(createElement(PersonalReportMarkdownView, {
|
||||
markdown: "# Fictional report\n\nA paragraph.",
|
||||
language: "en",
|
||||
}));
|
||||
const document = renderToStaticMarkup(createElement(PersonalReportDocumentView, { document: fixture }));
|
||||
assert.ok(chinese.indexOf("<h1>") < chinese.indexOf(REPORT_AI_NOTICE_ZH));
|
||||
assert.match(english, new RegExp(REPORT_AI_NOTICE_EN.replaceAll(".", "\\.")));
|
||||
assert.match(document, new RegExp(REPORT_AI_NOTICE_ZH));
|
||||
assert.match(document, /id="report-disclaimer"/);
|
||||
});
|
||||
@@ -0,0 +1,40 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { readdirSync, readFileSync } from "node:fs";
|
||||
import test from "node:test";
|
||||
|
||||
import { CHART_SUBJECT_SELECT } from "../src/lib/subject-birth.ts";
|
||||
|
||||
// BUG-1063: every column loadSubjectBirth selects from chart_profiles must
|
||||
// have a service_role SELECT grant after the 2026-07-18 revoke.
|
||||
const REVOKE = "20260718100000";
|
||||
const directory = new URL("../supabase/migrations/", import.meta.url);
|
||||
const grantFile = new URL(
|
||||
"../supabase/migrations/20261014010000_chart_profiles_service_role_select.sql",
|
||||
import.meta.url,
|
||||
);
|
||||
|
||||
function serviceRoleChartSelectGrants(): Set<string> {
|
||||
const granted = new Set<string>();
|
||||
for (const name of readdirSync(directory).filter((file) => file.endsWith(".sql")).sort()) {
|
||||
if (name.slice(0, 14) < REVOKE) continue;
|
||||
const sql = readFileSync(new URL(name, directory), "utf8").replace(/--.*$/gm, "");
|
||||
const pattern = /grant\s+([a-z ,]+?)\s*\(([^)]*)\)\s*on\s+table\s+public\.chart_profiles\s+to\s+([a-z_, ]+);/gi;
|
||||
for (const match of sql.matchAll(pattern)) {
|
||||
if (!/select/i.test(match[1]!) || !/service_role/.test(match[3]!)) continue;
|
||||
for (const column of match[2]!.split(",")) {
|
||||
const trimmed = column.trim();
|
||||
if (trimmed) granted.add(trimmed);
|
||||
}
|
||||
}
|
||||
}
|
||||
return granted;
|
||||
}
|
||||
|
||||
test("service_role chart_profiles select covers CHART_SUBJECT_SELECT and nothing writable", () => {
|
||||
const sql = readFileSync(grantFile, "utf8").replace(/--.*$/gm, "");
|
||||
assert.doesNotMatch(sql, /grant\s+(insert|update|delete)\b/i);
|
||||
assert.doesNotMatch(sql, /create\s+policy|alter\s+policy|enable\s+row\s+level\s+security/i);
|
||||
assert.doesNotMatch(sql, /to\s+authenticated/i);
|
||||
const missing = CHART_SUBJECT_SELECT.split(",").map((column) => column.trim()).filter((column) => !serviceRoleChartSelectGrants().has(column));
|
||||
assert.deepEqual(missing, []);
|
||||
});
|
||||
@@ -0,0 +1,83 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { randomUUID } from "node:crypto";
|
||||
import { spawnSync } from "node:child_process";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import test from "node:test";
|
||||
|
||||
import { closeLocalPostgresDataPool, createLocalPostgresDataClient } from "../src/lib/db/local-postgres-client-core.ts";
|
||||
import { loadReportWorkerProfile } from "../src/lib/personal-report-worker-subject.ts";
|
||||
import { CHART_SUBJECT_SELECT } from "../src/lib/subject-birth.ts";
|
||||
import { startPostgresFixture, type PostgresFixture } from "./helpers/postgres-fixture.ts";
|
||||
|
||||
// BUG-1063: the report worker reads another person's archive through
|
||||
// service_role. Fictional rows only.
|
||||
const runner = fileURLToPath(new URL("../scripts/db-migrate.mjs", import.meta.url));
|
||||
const docker = spawnSync("docker", ["version", "--format", "{{.Server.Version}}"], { stdio: "ignore" }).status === 0;
|
||||
const SERVICE_URL_ROLE = ["service_runtime", "service-runtime-test-password"] as const;
|
||||
|
||||
function applyMigrations(fixture: PostgresFixture): void {
|
||||
const result = spawnSync(process.execPath, [runner], {
|
||||
encoding: "utf8",
|
||||
env: {
|
||||
...process.env,
|
||||
SCHEMA_DATABASE_URL: fixture.connectionUrl("schema_owner", "schema-owner-test-password"),
|
||||
},
|
||||
});
|
||||
assert.equal(result.status, 0, result.stderr || result.stdout);
|
||||
}
|
||||
|
||||
test("service_role can read another person's chart profile for a report", {
|
||||
skip: docker ? false : "docker unavailable",
|
||||
}, async () => {
|
||||
const fixture = startPostgresFixture();
|
||||
const serviceUrl = fixture.connectionUrl(...SERVICE_URL_ROLE);
|
||||
try {
|
||||
applyMigrations(fixture);
|
||||
const owner = randomUUID();
|
||||
const subjectId = randomUUID();
|
||||
fixture.psql(`insert into identity.users (id, name, email, email_verified, email_verified_at)
|
||||
values ('${owner}', 'Fictional owner', '${owner}@example.invalid', true, now());`);
|
||||
fixture.psql(`insert into public.chart_profiles (
|
||||
id, user_id, role, profile, updated_at, name, birth_date, reported_birth_time,
|
||||
birth_time_source, latitude, longitude, timezone_id, timezone_offset,
|
||||
birth_place_label, ayanamsa, birth_time_status
|
||||
) values (
|
||||
'${subjectId}', '${owner}', 'other', '{"name":"虚构乙"}'::jsonb, now(),
|
||||
'虚构乙', '1990-01-01', '08:00', 'family_exact', 22.3, 114.1,
|
||||
'Asia/Shanghai', 8, '虚构港', 'lahiri', 'reported'
|
||||
);`);
|
||||
|
||||
const admin = createLocalPostgresDataClient(serviceUrl, null, "service_role");
|
||||
const probe = await admin
|
||||
.from("chart_profiles")
|
||||
.select(CHART_SUBJECT_SELECT)
|
||||
.eq("id", subjectId)
|
||||
.maybeSingle();
|
||||
assert.equal(probe.error, null, probe.error?.message ?? "chart_profiles select failed");
|
||||
|
||||
const loaded = await loadReportWorkerProfile(admin, owner, subjectId) as { name?: string };
|
||||
assert.equal(loaded.name, "虚构乙");
|
||||
|
||||
for (const column of CHART_SUBJECT_SELECT.split(",")) {
|
||||
assert.equal(
|
||||
fixture.psql(`select has_column_privilege('service_role', 'public.chart_profiles', '${column}', 'select')`),
|
||||
"t",
|
||||
column,
|
||||
);
|
||||
}
|
||||
for (const privilege of ["insert", "update", "delete"]) {
|
||||
assert.equal(
|
||||
fixture.psql(`select has_table_privilege('service_role', 'public.chart_profiles', '${privilege}')`),
|
||||
"f",
|
||||
privilege,
|
||||
);
|
||||
}
|
||||
assert.equal(
|
||||
fixture.psql("select has_table_privilege('authenticated', 'public.chart_profiles', 'select')"),
|
||||
"t",
|
||||
);
|
||||
} finally {
|
||||
await closeLocalPostgresDataPool(serviceUrl);
|
||||
fixture.stop();
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user