From e6c6839742f261297db6b4922da484d96fd1f12e Mon Sep 17 00:00:00 2001 From: Jesse_Chen Date: Wed, 16 Sep 2026 01:45:39 +0000 Subject: [PATCH] test(home): follow the profile hook's return through the signOut marker The mount-once bootstrap effect keeps its literal `}, []);` dependency array: two existing contract tests use that exact text as a slicing landmark, so the effect stays as it was and its existing exhaustive-deps warning simply names two more stable setters. Only the signOut slice marker in chat-navigation-a11y-contract moves, with the three-column note; the assertion's subject is untouched. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01JUei7K13cYxLHE3Axe4A45 --- frontend/src/app/page.tsx | 2 +- frontend/tests/chat-navigation-a11y-contract.test.ts | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/page.tsx b/frontend/src/app/page.tsx index fc2eac83..e95043f0 100644 --- a/frontend/src/app/page.tsx +++ b/frontend/src/app/page.tsx @@ -1098,7 +1098,7 @@ export default function Home() { window.clearTimeout(bootstrapTimeout); controller.abort(); }; - }, [setProfile, setProfileDraft]); + }, []); useEffect(() => { if (!hydrated || uiPreview.current) return; diff --git a/frontend/tests/chat-navigation-a11y-contract.test.ts b/frontend/tests/chat-navigation-a11y-contract.test.ts index a49c9a2a..8f96de5f 100644 --- a/frontend/tests/chat-navigation-a11y-contract.test.ts +++ b/frontend/tests/chat-navigation-a11y-contract.test.ts @@ -76,7 +76,12 @@ test("auth redirects stay hard document loads so stale session state cannot surv assert.doesNotMatch(pageSource, /router\.replace\("\/login"\)/); // And: the login redirect after sign-out drops the whole React tree with the session. - const signOut = sourceBetween(pageSource, "async function signOut()", "return {\n refreshAccount,"); + // 原值: sourceBetween(..., "async function signOut()", "return {\n refreshAccount,") + // 新值: 同一起点,终点改成 "return {\n profile," + // 原因: 状态下沉第二批把六个 profile 状态搬进 use-profile-onboarding.ts,hook 的 + // return 现在以 profile 开头,refreshAccount 不再是第一个字段。切的还是 + // signOut 函数体,断言主语(退出后硬跳 /login)一字未改。 + const signOut = sourceBetween(pageSource, "async function signOut()", "return {\n profile,"); assert.match(signOut, /await selfHostedOtpActions\.signOut\(\);\n\s*window\.location\.assign\("\/login"\)/); // And: the billing pane keeps the same 401 precedent without a dedicated membership page.