Compare commits

..

2 Commits

Author SHA1 Message Date
Jesse_Chen 56577504d8 docs: record BUG-344 fix SHA
Independent Staging Quality Gate / validate (push) Successful in 10m8s
Independent Staging Quality Gate / publish (push) Successful in 13m20s
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-21 20:38:05 +08:00
Jesse_Chen eeee0e49af fix(web): narrow natal-minute consultation mode for the production build
BUG-341 added declared_birth_window, but the natal-minute helper still returned boolean, so next build could not pass that mode into serverChartFromProfile.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-21 20:37:44 +08:00
3 changed files with 28 additions and 1 deletions
+16
View File
@@ -5195,3 +5195,19 @@
- 复发自:BUG-339(盘面入口 effect 同步 setState;点选卡与快照加载又写了同一模式)
- 修复版本:a4ab229e
## BUG-344 | 声明窗口模式未收窄本命类型,staging publish 镜像构建失败
- 状态:resolved
- 首次发现:2026-08-21
- 最近更新:2026-08-21
- 影响面:Gitea `backend-quality-gate` `publish``consultation-route-service.serverChartFromProfile``isNatalMinuteConsultationMode`
- 用户现象:run `2029` `validate` 12 分钟通过,`publish``npm run build` 失败,镜像未发。站点仍停在 `e7f4030e`
- 触发条件:staging push 的 publish 镜像构建跑 `next build`。validate 对 staging push 跳过 production build。
- 根因:BUG-341 给 `ConsultationBirthTimeMode` 增加了 `declared_birth_window`,但 `isNatalMinuteConsultationMode` 仍返回 `boolean`TypeScript 无法收窄成 `verified_chart | unverified_birth_time``serverChartFromProfile``next build` 报 TS2345。
- 修复:把该函数改成 `mode is NatalMinuteConsultationMode` 类型谓词。
- 验证:`frontend/tests/consultation-birth-time-mode.test.ts`;本地 `tsc --noEmit` 通过。
- 防复发:本命分钟模式判定必须是类型谓词。新增咨询模式时不得把窗口/百科模式传入 `serverChartFromProfile`。staging push 的类型错误只会在 publish 的 `next build` 暴露。
- 相关记录:BUG-341、BUG-343
- 复发自:BUG-341(第三条咨询路径扩大了 mode 联合类型,未改类型谓词)
- 修复版本:eeee0e49
@@ -12,10 +12,16 @@ export const consultationBirthTimeModeSchema = z.enum([
]);
export type ConsultationBirthTimeMode = z.infer<typeof consultationBirthTimeModeSchema>;
export type NatalMinuteConsultationMode = Extract<
ConsultationBirthTimeMode,
"verified_chart" | "unverified_birth_time"
>;
export const UNVERIFIED_BIRTH_TIME_NOTICE = "使用未校正填报时间;分钟敏感结论的置信度已降低。";
export function isNatalMinuteConsultationMode(mode: ConsultationBirthTimeMode): boolean {
export function isNatalMinuteConsultationMode(
mode: ConsultationBirthTimeMode,
): mode is NatalMinuteConsultationMode {
return mode === "verified_chart" || mode === "unverified_birth_time";
}
@@ -13,6 +13,11 @@ import { getGeneralJyotishAgent } from "../src/mastra/index.ts";
import type { ResolvedLanguageModel } from "../src/mastra/model.ts";
test("general-no-birth-time is an explicit server mode that never runs a chart workflow", () => {
const source = readFileSync(new URL("../src/lib/consultation-birth-time-mode.ts", import.meta.url), "utf8");
assert.match(
source,
/export function isNatalMinuteConsultationMode\(\s*mode: ConsultationBirthTimeMode,\s*\): mode is NatalMinuteConsultationMode/,
);
assert.equal(consultationBirthTimeModeSchema.safeParse("verified_chart").success, true);
assert.equal(consultationBirthTimeModeSchema.safeParse("unverified_birth_time").success, true);
assert.equal(consultationBirthTimeModeSchema.safeParse("declared_birth_window").success, true);