fix(test): follow the home split in source contracts and expose element colors
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:
+1
-1
@@ -13756,7 +13756,7 @@
|
||||
- 触发条件:首页拆分把引导屏 JSX 从 `page.tsx` 搬到 `home-onboarding-shell.tsx` 后推 staging。
|
||||
- 根因:合同把 `<BirthTimeRectification` 锁在旧的首页文件清单里。拆分后组件还在,清单没跟上。
|
||||
- 修复:扫描面加入 `home-onboarding-shell.tsx`,并要求 `page.tsx` 仍挂载 `<HomeOnboardingShell`。其余断言不放宽。
|
||||
- 验证:`tests/test_birth_time_journey_contract.py::test_web_onboarding_uses_the_deterministic_free_journey`。
|
||||
- 验证:Python 合同在 `81db05c6` 已过。run 2888 又露出 10 条前端源码合同:引导屏、恢复轮询、启动超时句、登录跳转搬出 `page.tsx` 后清单没跟上;西洋盘元素色没进 `@theme`。本提交把扫描面跟到新文件,并要求首页仍挂载这些模块;元素色补进 `@theme`。预览会话的墙钟只用于开发预览,标了既有豁免。
|
||||
- 防复发:引导屏再搬家时,合同必须同时锁住挂载点和组件文件,不能只扫 `page.tsx`。
|
||||
- 相关记录:TASK-home-page-split-20260925
|
||||
- 复发自:无
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,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/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user