Skip to content

Commit 370e14d

Browse files
fix(auth): sign-out keeps the list layout for the same person; a change of user still clears it (#36867)
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} --> _Requested by **Yibo Wang** · [project thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBDHJBvzScLgkhKgms97sNuU)_ repo:objectstack#3 · os-support-ai · session_01WGufzhoBbwh8URjwQHde8v Fixes #36110 Clause-②: no Metadata-protocol: none ## 维护者速读 - 控制台用户退出登录(或会话自行过期)后再以同一账号登录,列表的列宽、行高和视图标签顺序都还在;换另一个人在同一浏览器登录,仍然全部清空、回到视图默认。 - 落实维护者在列表布局只存浏览器这一裁决里的第一点:布局不再有服务器副本,退出登录不能再把它清掉。 - 出错的话,最坏是同一人退出后布局又被清空(与今天一样),或者存了布局以外的东西的条目被当作普通数据清掉;可以直接撤回本改动。 - 无。 ## What changes - `@object-ui/auth`: the sign-out tier (`purgeSignedOutUserClientState`, run on `signOut()` and on every session read that answers "no session", including the 401 re-check) now keeps two `localStorage` key families by prefix, the first prefix exception to the allowlist sweep: `list-layout:` (app-shell's list layout store: tab order, per-view widths and row height) and `grid-columns-` (the grid's own copy of column widths and order, read by a record page's related tab). An entry is kept **only while its value holds that layout and nothing more** (`holdsOnlyListLayout` / `holdsOnlyGridColumns`: view ids, field names, finite widths, one of the five spec row heights). Anything else under those prefixes (a filter, a search term, rows, unparsable text) is swept like any other key. `sessionStorage` is untouched by the exception. - The change-of-user tier (`purgePreviousUserClientState`) is unchanged and keeps none of it. - Both prefixes are spelled out in auth (it depends on neither app-shell nor plugin-grid), following the file's existing "held together by a behaviour test" pattern. `listLayoutStore.ts` and `objectGridColumnState.ts` get comment-only notes pointing at the exception. - `ui/packages/auth/README.md` sign-out section, the P1 checklist item `identity-auth.console-sign-out-and-ended-session` (revision 4: title, acceptance[0], new acceptance[1], negative[1]/[2], steps), and one `@object-ui/auth` patch changeset. ## Tests - New `ui/packages/auth/src/__tests__/signOutKeepsListLayout-36110.test.tsx`: well-formed entries kept byte for byte; every row height kept; 13 not-only-layout values removed; sessionStorage copies removed; look-alike prefixes removed; change of user removes both families; a same-person re-adopt removes nothing. - `ui/packages/app-shell/src/context/__tests__/signOutPurge.test.tsx` rewritten for the new behaviour. Both families are written by their **real writers** (`useObjectListLayout`; `ObjectGrid` resize + reorder), then: `signOut()` keeps them byte for byte; the same person signing back in gets the layout back through the hook; a "no session" read and a 401 re-check (sessions that end on their own) keep them; every `ROW_HEIGHT_TO_DENSITY_MODE` row height written through the writer survives; a different person signing in clears both families and opens at `{}`; with nobody signed in nothing is written. The shape pin therefore applies to what the writers store: a writer that adds a part loses its entry and these cases go red. <details><summary>Runs and ablations</summary> - `pnpm --dir ui exec vitest run packages/auth/ packages/app-shell/src/context/__tests__/signOutPurge.test.tsx`: 51 files, 530 passed and 2 failed: the two change-of-user cases in the pin, which failed on test isolation, not on the purge. After the fix (described under Acceptance notes) the pin passed 10/10 (`VERDICT command-exit 0`). - `pnpm --filter @object-ui/auth --filter @object-ui/app-shell run type-check`: both `Done`, `VERDICT command-exit 0`. - Ablation 1, via `scripts/ablation-replace.mjs` (`isKeptListLayoutEntry` dropped from the sign-out sweep): 13 failed / 17 passed across the two files, i.e. every "kept" case in both. Restored, blob == HEAD. - Ablation 2 (value shape check replaced by `raw !== null`): the 13 "removes an entry holding …" cases failed. Restored, blob == HEAD. - Tests resolve `@object-ui/auth` to `src` through the vitest alias, so no dist rebuild was needed for the ablations. </details> ## Acceptance notes - What I measured, not assumed: tab order lives in `list-layout:` (`viewOrder`). The only browser-only layout families are `list-layout:` and `grid-columns-`. The grid copy also stores **column order** (`order`, field names) next to widths. The card's To-do 1 keeps that family as a whole, and the ruling's "object names, field names, widths and view ids" covers it, so the shape allows `order` there. - The main list hands the grid a `columnState` (falls back to `{}`), so on the list page `grid-columns-` is written but never read. Only the related tab reads it. A related tab mounts after its record loads, which is after `AuthProvider`'s adopt effect has purged a previous owner's keys. So the kept copy is never read by a different person. - `pnpm check:platform-checklist` is red on `origin/main` itself, from an ABSENT SYMBOL anchor in `areas/access-security.json` (`anonymousFormExplicitWithdrawals`). This diff does not touch that area, and `identity-auth.json` passes. - The app-shell pin plants `auth-session-user-id` in `beforeEach`, because `SessionUserScope` keeps its owner in memory across the cases of one file. The comment there explains why. ## Verification Read first: (1) `ActiveOrganizationStorage.ts`, `holdsOnlyListLayout` / `isKeptListLayoutEntry` and the one-argument change in `purgeSignedOutUserClientState`; (2) `signOutPurge.test.tsx`, the grid writer cases; (3) the checklist item's acceptance[0]. Two-minute check: `pnpm --dir ui exec vitest run packages/app-shell/src/context/__tests__/signOutPurge.test.tsx` should report 10 passed. --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- signed: repo:objectstack#3 · os-support-ai · session_01WGufzhoBbwh8URjwQHde8v --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 97e0f93 commit 370e14d

8 files changed

Lines changed: 560 additions & 65 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
'@object-ui/auth': patch
3+
'@object-ui/plugin-grid': patch
4+
---
5+
6+
fix(auth): signing out keeps the list layout for the same person; a change of user still clears it
7+
8+
Clause-②: no
9+
Metadata-protocol: none
10+
11+
Column widths, row height and tab order are kept only in the browser, so the sign-out purge (`purgeSignedOutUserClientState`, run by `AuthProvider` on `signOut()` and on every session read that answers "no session", including a session that ended on its own) reset every list at every sign-out. It now keeps the list layout: `localStorage` keys starting `list-layout:` (written by `@object-ui/app-shell`) and `grid-columns-` (the grid's own copy of column widths and order, also used by a record page's related tab). An entry is kept only while it holds that layout and nothing else: view ids, field names, widths and a row height. An entry holding anything more, such as a filter, a search term or record data, is removed like any other key. These keys are kept only in `localStorage`; the same keys in `sessionStorage` are still removed.
12+
13+
A different person signing in on that browser still clears everything (`purgePreviousUserClientState` keeps none of these keys), so their lists open at each view's defaults. Nothing changes for an app that writes no keys under these prefixes.

‎docs/qa/platform-checklist/areas/identity-auth.json‎

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3618,10 +3618,10 @@
36183618
},
36193619
{
36203620
"id": "identity-auth.console-sign-out-and-ended-session",
3621-
"title": "Sign-out leaves none of the signed-out user's browser state and no return link, while a session that ended on the server sends the next in-app navigation to sign-in with its return link",
3621+
"title": "Sign-out leaves none of the signed-out user's browser state but their list layout, and no return link, while a session that ended on the server sends the next in-app navigation to sign-in with its return link",
36223622
"since": "v18.4",
36233623
"status": "active",
3624-
"revision": 3,
3624+
"revision": 4,
36253625
"priority": "P1",
36263626
"surface": "browser",
36273627
"personas": [
@@ -3637,18 +3637,26 @@
36373637
},
36383638
"steps": [
36393639
"sign in as the admin; open a showcase list and one record; in the page's devtools write localStorage 'qa-probe-<run>' and sessionStorage 'qa-probe-<run>'; list both stores' keys",
3640-
"sign out from the user menu; on the login page list both stores' keys again and read the URL",
3641-
"sign in as the org member; read where the Console lands",
3640+
"on that list drag one column's width and pick another row height; open the record page's related tab and drag one of its column widths; read the value of every list-layout:* and grid-columns-* key",
3641+
"sign out from the user menu; on the login page list both stores' keys again with the value of every list-layout:* and grid-columns-* key, and read the URL",
3642+
"sign in as the admin again; reopen the list and the record's related tab; read the column widths and row height",
3643+
"sign out; sign in as the org member; read where the Console lands; list localStorage's keys; open the same list",
36423644
"sign out; sign in as the admin in the tab and open a showcase record; from the second client, signed in as the admin, POST /api/v1/auth/revoke-other-sessions",
36433645
"in the tab, click another app navigation entry (no reload); read the network log and the URL"
36443646
],
36453647
"acceptance": [
36463648
{
36473649
"clause": "sign-out sweeps both stores down to the device keys before the sign-in page shows",
36483650
"oracle": "dom",
3649-
"verify": "after sign-out no key the signed-out user's session wrote survives in either store (the same test as negative[1]): every key left is in the kept set (SIGNED_OUT_KEPT_KEYS: auth-session-token, auth-session-user-id, vite-ui-theme, objectui-locale, objectui-locale-seed and objectui:auth:signed-out-via-provider) or is anonymous-shell state that a never-signed-in visit to /_console/login writes too, which today is exactly flow-palette-recents holding [] (the unscoped key ui/packages/app-shell/src/context/FlowPaletteRecentsProvider.tsx#FlowPaletteRecentsProvider writes when it re-hydrates with no user after the sweep); qa-probe-<run>, every objectui:metadata:* key and every user-scoped :u:<id> key are gone from both, and flow-palette-recents holding anything but [] is the signed-out user's. A key outside both lists is judged against a fresh never-signed-in context opening /_console/login: written there with the same value, it is anonymous-shell state to name in the run record for this verify to list; otherwise it is a FAIL (ui/packages/auth/src/ActiveOrganizationStorage.ts#purgeSignedOutUserClientState, run by ui/packages/auth/src/AuthProvider.tsx#AuthProvider on every sign-out path)",
3651+
"verify": "after sign-out no key the signed-out user's session wrote survives in either store (the same test as negative[1]): every key left is in the kept set (SIGNED_OUT_KEPT_KEYS: auth-session-token, auth-session-user-id, vite-ui-theme, objectui-locale, objectui-locale-seed and objectui:auth:signed-out-via-provider), is the signed-out user's list layout (a list-layout:<user>:<object> key holding only viewOrder and perView widths / rowHeight, or a grid-columns-<object>[-<view>] key holding only order and widths: SIGNED_OUT_KEPT_LAYOUT_FAMILIES, #36110) or is anonymous-shell state that a never-signed-in visit to /_console/login writes too, which today is exactly flow-palette-recents holding [] (the unscoped key ui/packages/app-shell/src/context/FlowPaletteRecentsProvider.tsx#FlowPaletteRecentsProvider writes when it re-hydrates with no user after the sweep); qa-probe-<run>, every objectui:metadata:* key and every user-scoped :u:<id> key are gone from both, and flow-palette-recents holding anything but [] is the signed-out user's. A key outside both lists is judged against a fresh never-signed-in context opening /_console/login: written there with the same value, it is anonymous-shell state to name in the run record for this verify to list; otherwise it is a FAIL (ui/packages/auth/src/ActiveOrganizationStorage.ts#purgeSignedOutUserClientState, run by ui/packages/auth/src/AuthProvider.tsx#AuthProvider on every sign-out path)",
36503652
"evidence": "the two key lists before and after, with the value of every key outside the kept set"
36513653
},
3654+
{
3655+
"clause": "the list layout stays for the same person across a sign-out and goes for the next person",
3656+
"oracle": "dom",
3657+
"verify": "after the admin signs back in, the list shows the dragged width and the picked row height and the related tab its dragged width, as before the sign-out; a list-layout:* or grid-columns-* value holding anything but view ids, field names, widths and a row height (a filter, a search term, record data) is a FAIL, named by key. After the org member signs in, no list-layout:<admin id>:* key and no grid-columns-* key the admin's session wrote remains, and the list opens at its view's own widths and row height (ui/packages/auth/src/ActiveOrganizationStorage.ts#purgeSignedOutUserClientState keeps them; #purgePreviousUserClientState, run by SessionUserScope.adopt on a change of user, does not; maintainer ruling on #35955, point 1)",
3658+
"evidence": "the layout keys with their values before sign-out, after sign-out and after the member's sign-in, and the widths and row height read on the list"
3659+
},
36523660
{
36533661
"clause": "an explicit sign-out carries no return link, so the next person lands on their own home",
36543662
"oracle": "dom",
@@ -3664,7 +3672,8 @@
36643672
],
36653673
"negative": [
36663674
"a 401 taken as the verdict, signing the tab out while get-session still answers the session, is a FAIL: one endpoint may refuse for its own reasons (session-end-events.ts); this item cannot provoke such a 401 on stock, so score it from the pins",
3667-
"after sign-out, any key the signed-out user's session wrote that survives outside the kept set is a FAIL, named by key"
3675+
"after sign-out, any key the signed-out user's session wrote that survives outside the kept set and the kept list layout is a FAIL, named by key",
3676+
"after a different person signs in on that browser, any list-layout:* or grid-columns-* key the previous person's session wrote is a FAIL, named by key"
36683677
],
36693678
"traps": [
36703679
"stale-console-bundle",
@@ -3673,15 +3682,15 @@
36733682
],
36743683
"automated": {
36753684
"kind": "unit",
3676-
"ref": "ui/packages/auth/src/__tests__/signOut-client-cache-purge-5198.test.tsx, ui/packages/auth/src/__tests__/sessionUserChangePurge-5664.test.tsx, ui/packages/auth/src/__tests__/AuthProvider.test.tsx, ui/packages/auth/src/__tests__/createAuthenticatedFetch.test.tsx and ui/apps/console/src/components/ProtectedRoute.signOutListState-29174.test.tsx; no live spec signs out and revokes"
3685+
"ref": "ui/packages/auth/src/__tests__/signOut-client-cache-purge-5198.test.tsx, ui/packages/auth/src/__tests__/sessionUserChangePurge-5664.test.tsx, ui/packages/app-shell/src/context/__tests__/signOutPurge.test.tsx (the list layout kept for the same person and cleared for the next), ui/packages/auth/src/__tests__/AuthProvider.test.tsx, ui/packages/auth/src/__tests__/createAuthenticatedFetch.test.tsx and ui/apps/console/src/components/ProtectedRoute.signOutListState-29174.test.tsx; no live spec signs out and revokes"
36773686
},
36783687
"source": [
36793688
"ui/packages/auth/src/ActiveOrganizationStorage.ts#purgeSignedOutUserClientState",
36803689
"ui/packages/auth/src/AuthProvider.tsx#AuthProvider (the sign-out purge, the session-end re-check)",
36813690
"ui/packages/auth/src/session-end-events.ts#sessionEndEvents and ui/packages/auth/src/createAuthenticatedFetch.ts#createAuthenticatedFetch",
36823691
"ui/apps/console/src/components/ProtectedRoute.tsx#LoginRedirect",
36833692
"ui/packages/auth/src/beforeSignOut.ts#runBeforeSignOut (steps that run under the ending session)",
3684-
"#30490 (no return link after sign-out), #32048 (every sign-out clears the user's browser storage), #32207 (a session ended on the server returns to sign-in)"
3693+
"#30490 (no return link after sign-out), #32048 (every sign-out clears the user's browser storage), #32207 (a session ended on the server returns to sign-in), #36110 (sign-out keeps the list layout for the same person)"
36853694
],
36863695
"history": [
36873696
{
@@ -3701,6 +3710,12 @@
37013710
"date": "2026-11-15",
37023711
"change": "acceptance[0].verify re-pointed (stale spec, QA run #33853, card #33859). The verify listed the kept keys as the only keys allowed after sign-out, but the anonymous login page writes its own flow-palette-recents = [] (FlowPaletteRecentsProvider re-hydrates with no user after the purge and saves the unscoped key); a never-signed-in visit writes the same. The verify now judges keys the signed-out user's session wrote, as negative[1] does, names that anonymous-shell key with its value, adds objectui:auth:signed-out-via-provider to the kept list as SIGNED_OUT_KEPT_KEYS has it, and has the runner diff any other unlisted key against a fresh anonymous visit. What the clause tests, no signed-out user's state left behind, is unchanged. Read at base 895783a1",
37033712
"ref": "#33936"
3713+
},
3714+
{
3715+
"revision": 4,
3716+
"date": "2026-11-24",
3717+
"change": "the list layout now survives a sign-out for the same person (#36110, maintainer ruling on #35955 point 1: after #35955 there is no server copy of column widths, row height and tab order). Title, acceptance[0].verify and negative[1] admit the kept layout families (list-layout:*, grid-columns-*) holding layout only; new acceptance[1] and negative[2] check that the same person gets it back and the next person does not; steps add the layout drag, the re-sign-in and the member's key list. Read at base f46ce5b4a",
3718+
"ref": "#36110"
37043719
}
37053720
]
37063721
},

0 commit comments

Comments
 (0)