refactor(chat): extract profile onboarding and rectification surface hooks

Close the home-page split by moving account/onboarding and rectification glue out of page.tsx without relocating React state, keeping the route static and hook order intact.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jesse_Chen
2026-09-02 05:56:58 +08:00
co-authored by Cursor
parent fbb80fa376
commit bf6989eccf
15 changed files with 920 additions and 527 deletions
+4 -2
View File
@@ -2,14 +2,16 @@ import assert from "node:assert/strict";
import { existsSync, readFileSync } from "node:fs";
import test from "node:test";
import { homeSurface } from "./home-surface.ts";
test("upserts a missing profile when saving account details", () => {
const source = readFileSync(new URL("../src/app/page.tsx", import.meta.url), "utf8");
const source = homeSurface;
assert.match(source, /fetch\("\/api\/account",[\s\S]*?\{[\s\S]*?method:\s*"PATCH"/);
assert.match(source, /credentials:\s*"same-origin"/);
});
test("every profile save adopts the birth-time truth the account write returned", () => {
const source = readFileSync(new URL("../src/app/page.tsx", import.meta.url), "utf8");
const source = homeSurface;
// Given: the account write derives birth-time status and active minute.
assert.match(source, /const savedProfile = applyPersistedBirthTime\(nextProfile, payload\?\.birthTime\)/);