fix(home): stop silent rectification open after login (BUG-599)
Independent Staging Quality Gate / validate (push) Successful in 13m10s
Independent Staging Quality Gate / publish (push) Has been cancelled

Bare `/` was treating the latest history session as active, so a returning account could auto-open a failed rectification Case and left-align the starter home.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jesse_Chen
2026-09-09 10:47:47 +08:00
co-authored by Cursor
parent a43a6db884
commit c9ec541164
8 changed files with 199 additions and 14 deletions
@@ -45,11 +45,13 @@ test("the rectification surface is revealed once: Case hydration precedes the sw
assert.match(chat, /useEffect\(\(\) => \(\) => \{\s*runAbort\.current\?\.abort\(\);\s*snapshotAbort\.current\?\.abort\(\);\s*\}, \[\]\);/);
});
test("a rectification session selected at bootstrap is hydrated before the reveal, and popstate defers the same way", () => {
test("a rectification session named in the URL is hydrated before the reveal; bare / does not", () => {
// The resume effect runs during the prepare phase, not only after the reveal.
assert.match(page, /if \(\(!hydrated && bootstrapPhase === "account"\)\s*\|\| !account/);
assert.match(page, /shouldAutoOpenRectificationSession\(\{/);
assert.match(bootstrap, /if \(state\.rectificationApplicable && !state\.rectificationSettled\) return false;/);
assert.match(page, /rectificationApplicable: activeSession\?\.sessionType === "birth_time_rectification",\s*rectificationSettled: activeSession\?\.id === rectificationSessionId\s*\|\| rectificationError !== ""\s*\|\| !profileComplete,/);
assert.match(page, /rectificationApplicable: shouldAutoOpenRectificationSession\(\{/);
assert.match(page, /rectificationSettled: activeSession\?\.id === rectificationSessionId\s*\|\| rectificationError !== ""\s*\|\| !profileComplete,/);
// One deadline constant for hydration and the home reveal.
assert.match(read("../src/lib/rectification-surface-state.ts"), /export const RECTIFICATION_OPEN_HYDRATE_TIMEOUT_MS = BOOTSTRAP_PREPARE_TIMEOUT_MS;/);
// History navigation goes through selectSession, which defers the switch (locked above).