fix(api): keep session and birth-row types through next build
Independent Staging Quality Gate / validate (push) Successful in 9m45s
Independent Staging Quality Gate / publish (push) Successful in 10m53s

Transcript limits were collapsing the create schema, and joined profile selects typed as GenericStringError, so Docker next build failed after tests passed.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jesse_Chen
2026-08-19 21:15:33 +08:00
parent d434aa48ab
commit d7887b03e5
7 changed files with 79 additions and 51 deletions
+17 -1
View File
@@ -4617,7 +4617,7 @@
- 防复发:生时纠正用户面不得再渲染 CompletedActivityReceipt;分盘句来自公开 executed methods;宫位表来自 decision receipt,缺表不得由模型编造。
- 相关记录:BUG-179、BUG-181、BUG-304
- 复发自:BUG-181(完成凭证成为用户主结果后,分盘和宫位没有独立正文位置)
- 修复版本:待提交
- 修复版本:`c8af18e9`
## BUG-308 | 咨询重跑改了草稿回填条件后,源码合同仍切旧 if,staging 质量门 1807/1808
@@ -4633,4 +4633,20 @@
- 防复发:切 `send()` 失败回填不得再用无 `restoreOnFailure` 的旧 if。源码合同的起止标记必须随被切代码一起改,否则质量门会把无关提交打红。
- 相关记录:BUG-249、BUG-306
- 复发自:BUG-306(加了 `restoreOnFailure` 而未更新草稿隔离切片)
- 修复版本:`d434aa48`
## BUG-309 | Docker `npm run build` 因会话 schema 与动态 select 类型检查失败
- 状态:resolved
- 首次发现:2026-08-19
- 最近更新:2026-08-19
- 影响面:`deploy/railway-web.Dockerfile``RUN npm run build``POST /api/sessions``POST /api/daily-starlanguage``POST /api/synastry`
- 用户现象:staging publish 在 web 镜像构建失败。BuildKit 日志末尾是 `skill-package-registry.ts` 的 Import traces(动态文件访问追踪警告),真正失败是 `Failed to type check`
- 触发条件:向 `staging` 推送后走 publish 镜像构建。push 上的 validate 跳过 `npm run build`,因此质量门绿、镜像红。
- 根因:两处互不相关的 TypeScript 收口。`limitTranscriptSize()` 的泛型下界是 `{ messages: { text: string }[] }``.superRefine()` 之后推断输出被收成这个下界,`parsed.data` 不再有 `id`,也丢失消息上的 receipt 字段。每日星语与合盘把出生列 `.join(",")` 成普通 `string` 再交给 supabase-js`select` 结果变成 `GenericStringError`,无法传入 `AccountBirthRow`
- 修复:`limitTranscriptSize` 按输入 schema 的 `Output` 原样返回 `z.ZodType<Output>`。出生列改为共享字面量 `ACCOUNT_BIRTH_SELECT``globalBirthProfileFromAccountRow` 接受 `unknown` 再收成账户行。
- 验证:`npx tsc --noEmit` 无错误(修复前 3 个 route + 2 个测试文件)。`tsx --test tests/chat-session-write.test.ts tests/server-owned-birth-profile.test.ts tests/daily-starlanguage.test.ts tests/chart-library-other-profile.test.ts` 36/36。
- 防复发:创建会话 schema 必须保留 `id`;出生资料 `select` 不得用 `.join(",")` 得到非字面量字符串。staging push 的 validate 不跑 `next build`,类型回归只在 publish Docker 暴露。
- 相关记录:BUG-261、BUG-308
- 复发自:无
- 修复版本:待提交