fix(test): follow the home split in source contracts and expose element colors
Independent Staging Quality Gate / validate (push) Failing after 11m16s
Independent Staging Quality Gate / publish (push) Skipped

Gate 2888 failed ten frontend contracts after the onboarding shell and bootstrap moved out of page.tsx, and the western element colors were missing from @theme. The scans now follow the new files and still require the home page to mount them.
This commit is contained in:
jesse-ux
2026-09-25 03:32:36 +08:00
parent 81db05c6f0
commit 3dd48c0dc3
9 changed files with 44 additions and 10 deletions
+4
View File
@@ -72,6 +72,10 @@
--color-planet-saturn: var(--color-planet-saturn);
--color-planet-node: var(--color-planet-node);
--color-planet-ascendant: var(--color-planet-ascendant);
--color-element-fire: var(--color-element-fire);
--color-element-earth: var(--color-element-earth);
--color-element-air: var(--color-element-air);
--color-element-water: var(--color-element-water);
--radius-sm: 8px;
--radius-md: 8px;
--radius-lg: 12px;
+1
View File
@@ -217,6 +217,7 @@ export async function runAccountPhase(
theme: "career",
modelId: previewModelCatalog.defaultModelId,
messages: previewMessages,
// session-clock-exempt: development preview fixture, not a stored session
updatedAt: timestamp(),
sessionType: "consultation",
rectificationCaseId: null,
@@ -158,9 +158,14 @@ test("terminal CJK copy stays intact while homepage candidates remain unconfirme
test("completed rectification transcript does not repeat the birth place turn", () => {
const pageSource = readFileSync(new URL("../src/app/(app)/page.tsx", import.meta.url), "utf8");
const shell = readFileSync(new URL("../src/components/home-onboarding-shell.tsx", import.meta.url), "utf8");
// 原值: 地点回显写在 page.tsx。
// 新值: 回显在引导屏,page.tsx 仍挂载它。
// 原因: 首页拆分搬走了引导屏,完成校正后不重复地点的条件没变。
assert.match(pageSource, /<HomeOnboardingShell/);
assert.match(
pageSource,
shell,
/\{!profileComplete && onboardingStep === "rectification" && selectedBirthPlace\(profileDraft\)/,
);
});
@@ -51,7 +51,12 @@ test("clearing a notice dismisses instead of showing an empty toast", () => {
test("keeps the recovery poll from stacking repeated notices", () => {
// Given: the recovery loop repeats the same message every 1750ms.
assert.match(pageSource, /timer = window\.setTimeout\(\(\) => void poll\(\), 1_750\)/);
const recoveryPoll = readFileSync(new URL("../src/lib/consultation-recovery-poll.ts", import.meta.url), "utf8");
// 原值: 1750ms 轮询写在 page.tsx。
// 新值: 轮询在 consultation-recovery-poll.ts,page.tsx 仍调用它。
// 原因: 首页拆分搬走了恢复轮询,间隔没变。
assert.match(pageSource, /runConsultationRecoveryPoll/);
assert.match(recoveryPoll, /timer = window\.setTimeout\(\(\) => void poll\(\), 1_750\)/);
// Then: a stable toast id plus last-message dedupe replaces instead of accumulating.
assert.match(noticeSource, /export const chatNoticeToastId = "chat-notice"/);
@@ -198,7 +198,12 @@ test("fallback script is classic ES5 and waits past the bootstrap budgets", () =
assert.match(hook, /!document\.documentElement\) return/);
assert.match(hook, /document\.documentElement\.dataset\.hydrated = "1"/);
assert.equal(page.includes("dataset.hydrated"), false);
assert.match(page, /连接云端服务超时/);
const bootstrapRun = read("src/lib/home-bootstrap-run.ts");
// 原值: 超时句写在 page.tsx。
// 新值: 超时句在 home-bootstrap-run.ts,page.tsx 仍挂载错误屏。
// 原因: 首页拆分把启动失败文案收成常量,兜底脚本仍不得抢先写出这句。
assert.match(page, /<HomeBootstrapError/);
assert.match(bootstrapRun, /连接云端服务超时/);
});
test("fallback replaces the loading screen only while it is still unhydrated", () => {
+4
View File
@@ -4,6 +4,8 @@ const homeSurfaceFiles = [
"../src/app/(app)/page.tsx",
"../src/lib/home-types.ts",
"../src/components/onboarding-chat-message.tsx",
"../src/components/home-onboarding-shell.tsx",
"../src/components/home-bootstrap-error.tsx",
"../src/lib/home-profile.ts",
"../src/lib/home-cloud-sync.ts",
"../src/components/birth-location-fields.tsx",
@@ -24,6 +26,8 @@ const optionalHomeHookFiles = [
"../src/hooks/use-home-shell-registration.ts",
"../src/lib/session-list-context.tsx",
"../src/lib/session-list-filter.ts",
"../src/lib/home-bootstrap-run.ts",
"../src/lib/consultation-recovery-poll.ts",
] as const;
export const homeSurface = [
@@ -3,11 +3,16 @@ import { readFileSync } from "node:fs";
import test from "node:test";
const page = readFileSync(new URL("../src/app/(app)/page.tsx", import.meta.url), "utf8");
const shell = readFileSync(new URL("../src/components/home-onboarding-shell.tsx", import.meta.url), "utf8");
test("loads birth-time rectification only when its onboarding stage is reached", () => {
assert.match(page, /import dynamic from "next\/dynamic"/);
assert.match(page, /const BirthTimeRectification = dynamic\(/);
assert.match(page, /import\("@\/components\/birth-time-rectification"\)/);
assert.match(page, /ssr: false/);
assert.match(page, /role="status"/);
// 原值: dynamic() 写在 page.tsx。
// 新值: dynamic() 在引导屏组件,page.tsx 仍挂载该组件。
// 原因: 首页拆分搬走了引导屏,懒加载本身没变。
assert.match(page, /<HomeOnboardingShell/);
assert.match(shell, /import dynamic from "next\/dynamic"/);
assert.match(shell, /const BirthTimeRectification = dynamic\(/);
assert.match(shell, /import\("@\/components\/birth-time-rectification"\)/);
assert.match(shell, /ssr: false/);
assert.match(shell, /role="status"/);
});
@@ -83,5 +83,10 @@ test("cloud lookup and session management call the server before clearing ?c=",
assert.match(pop, /SESSION_LOOKUP_FAILED_NOTICE/);
assert.match(pop, /status === "missing"/);
const page = readFileSync(new URL("../src/app/(app)/page.tsx", import.meta.url), "utf8");
assert.match(page, /resolveLookupBootstrap/);
const bootstrap = readFileSync(new URL("../src/lib/home-bootstrap-run.ts", import.meta.url), "utf8");
// 原值: page.tsx 内直接出现 resolveLookupBootstrap。
// 新值: page.tsx 调用 runHomeBootstrap,查找在 home-bootstrap-run.ts。
// 原因: 首页拆分把启动流程搬出 page.tsx,查找仍在揭幕前发生。
assert.match(page, /runHomeBootstrap/);
assert.match(bootstrap, /resolveLookupBootstrap/);
});