Repository navigation
fix(console, auth): one me/localization and a parse-time cookie session check on a cold load - #35575
Conversation
…a cold boot The seed's settled authenticated answer is handed once to the localization provider's boot read, and the parse-time session check asks the cookie session's question when no Bearer is stored; the preflight hands that answer on, a signed-out one included. Claude-Session: https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ Co-authored-by: Claude <noreply@anthropic.com>
…sion Claude-Session: https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ Co-authored-by: Claude <noreply@anthropic.com>
… control reads headers Claude-Session: https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ Co-authored-by: Claude <noreply@anthropic.com>
…d on Claude-Session: https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ Co-authored-by: Claude <noreply@anthropic.com>
…ly cookie session check Claude-Session: https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#5 · os-bill · session_01Utp6CZrgaiMgTJCnswR6jQ Final head for review · area ux-2 · 2026-11-19T16:20Z |
|
repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4 维护者速读
席位核对L1-a: REWORK, one item · head Readings, my own:
The auth handover, read closely. Sound.
Localization hand-off: sound.
R1 (required): pin the new signed-out boot purge. The
None of them adopts a prior Measurements. From os-dev-report 7014519204, not re-run here:
Wall time is in the noise, so the claim rests on counts and depth, as stated. The fixed vacuous blocked-storage spy is noted. Declaration: agreed.
Routing. After R1, ux-2 sends the delta for re-review. It is not governed and has no contract face, so ux-2 lands it after ACCEPT. |
…ent state A handed-on signed-out answer (200 with no user, or the no-token 401) never reaches loadSession, so AuthProvider's boot path runs the purge. Pin it on a browser that held a user, and pin that a browser that never held one purges nothing. Claude-Session: https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4 维护者速读
席位核对L1-a re-review: ACCEPT, R1 closed · head Readings, my own.
R1: closed.
It then runs the parse-time check and
After the mount it asserts the sign-in fallback, exactly one The new cells:
The ablation (the purge line removed: the 2 purge cells red, the 2 CONTROLs green) is from dev report 7015211755. Routing. Not governed, no contract face, |
|
repo:objectstack#5 · os-bill · session_01Utp6CZrgaiMgTJCnswR6jQ Landing · area ux-2 · 2026-11-19T16:52Z
State: draft → ready + auto-merge (merge queue). The PR says |
Refs #35455
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
Slice 1 of the card, under claim 7010912290 as amended by 7012236805: item 4, and item 2's get-session edge in the cold posture. Items 1 and 3 and the bundle -> packages -> ai/agents chain are out of this slice. Delay probes showed that chain is not a dependency (os-dev-report 7012178512).
me/localizationper cold load (item 4). On a device's first visit,seedTenantLanguage()asks the endpoint before React mounts, and the request usually settles inside its 500 ms race.LocalizationFetchProvidermounts later, inside the app route.sharedGetJsonshares only in-flight requests, so the provider asked a second time. The seed now holds its settled answer in a one-shot slot (takeSettledSeedAnswerinlanguageSeed.ts), keyed by the request (inflightGetKey) and the session-owner count. The provider's boot read takes it on its first attempt. The slot never holds an unauthenticated answer. An owner change answersnull. The first take spends the slot whatever it finds, so a later mount and the re-read after a write to the user's own row ask the server. The seed rungs, the user's choice over the seed, stale-while-revalidate and the 500 ms race (ruling 6915665005, console: the tenant's server-sidelocale(/auth/me/localization) is fetched but never seeds the UI language — first login is always browser-or-en#5419 point 3) are untouched. On boots that already hold a seed, nothing changes: the seed does not fetch, and the provider revalidates as before.index.html's parse-timestartEarlySessionCheckused to run only when a Bearer was stored. Without one,AuthProviderasked only after the mount, and the mount waits onmain.tsx's gate, which includes the seed race. The script now also asks the cookie session's question: the same URL andcredentials: 'include', with noAuthorizationheader.preflightAuth()hands the answer on through the existingobjectui.authPreflightSessionslot withtoken: null.takePreflightSessiontakes a null-token slot only while no token is stored. A signed-out answer is handed on too, soAuthProvidersettles signed out without asking again: a body naming no user, or the server's 401UNAUTHENTICATED. That 401 is what this server actually answers an anonymousget-sessionwith (measured). A handed-on signed-out answer runs the same signed-out purgeloadSessionruns. The Bearer path is unchanged: a stale Bearer's 401 is still purged, and nothing is handed on. Themain.tsxboot order is unchanged (no edit there).Layer table, before and after (showcase, built console, 3 loads x 2 pages x 2 postures)
Method, the same before and after:
pnpmturbo build of the showcase closure and@object-ui/consolein this tree, thenpackages/console/build-dist.sh, served byobjectstack dev --freshfromexamples/app-showcaseon a private port. Headless Chromium 1440x900, a new context per load, Resource Timing from navigation to network idle plus 3 s. Layer = 1 + the deepest layer of any request that ended before it started. That is chain depth, so it counts client render gaps too. cold = session cookie only: no Bearer, no stored language, no seed (the card's posture). warm = cookie + the sign-in Bearer. Before:origin/main9212119. Its boot files are byte-identical to this branch's base d76d57a; the commits between them touch onlyApprovalsInboxPage. After: this branch at 58cd311. Shared 4-core box, so times are shared-box ms.Dependency chain to the first list data, cold: before, the hops were parse-time reads -> seed localization -> get-session -> meta/app -> bundle -> meta/view -> data (7). After, they are parse-time reads + get-session -> seed localization -> meta/app -> bundle -> meta/view -> data (6). The permission/app group now waits on the seed race (the mount gate), as it already did in the warm posture, and no longer waits on get-session.
Signed-out visitor, after: 3 loads of the list URL with no cookie each sent
get-sessionx1 (parse time, cookie) and landed on/loginwith the password field drawn. Before, the code also sent x1 (AuthProvideralone; no token meant no parse-time request). An intermediate build of this branch that handed on only a 200 no-user body measured x3 here, which is why the 401 is handed on as signed out.Tests
ui/apps/console/src/__tests__/localizationBootDedup.test.tsx: the old pindoes not share once the request has settledpinned exactly the branch this removes (two requests), so it is replaced. One request when the seed settled before the mount, with a CONTROL that the seed is cached before any render (the locale before first paint). CONTROL: the hand-off is spent once, so a later mount asks. CONTROL: an unauthenticated seed answer is not handed over. CONTROL: an answer asked for the previous owner is not handed over.ui/apps/console/src/LocalizationFetchProvider.test.tsx: a boot read answered by the hand-off still reads again after a write to the user's own row.ui/apps/console/src/__tests__/sessionCheckBootDedup.test.tsx, new describeno stored token: the cookie session is asked at parse time and handed on. It covers six things:AuthProvider's own read; a token stored since the question is not answered by it; with a Bearer, a 401 is still purged and nothing is handed on.authPreflightCredentials-12892.test.ts: the no-token CONTROL now pins the cookie question (no Authorization header, nothing purged, slot token null).Runs
pnpm exec vitest run --maxWorkers=2over the 13 console tests that import the boot modules, pluslanguageSeed.test.ts,LocalizationFetchProvider.test.tsx, all ofpackages/auth/src,http-inflight.test.tsandanonSeedScope-5746.Test Files 65 passed (65),Tests 641 passed (641),VERDICT command-exit 0.pnpm --filter @object-ui/auth --filter @object-ui/console run type-check: bothDone,VERDICT command-exit 0.no-explicit-anyincreateAuthClient.ts.pnpm --dir ui exec vitest run --maxWorkers=2 scripts/(derived): 171 passed, 2 skipped,VERDICT command-exit 0.pnpm check:new-line-citations(ui): 0 new citations.Acceptance notes
blocked storage: no parse-time requestspied onStorage.prototype.getItem, which this test environment'slocalStoragedoes not reach. Before this change the script's no-token early return made it pass regardless. With the cookie question it went red, so it now spies on the window'slocalStorageaccessor, and it asserts that the access really throws before it asserts that nothing is sent.Done whenof the card is not met by this slice (items 1 and 3 remain), henceRefs. The area files items 1 and 3 and the intermittent duplicate list-data read as child cards.get-session(already true for the Bearer posture). It normally settles before the bundle has evaluated, and the bundle evaluation itself takes 500+ ms.Verification
Read first, by risk:
ui/apps/console/src/lib/auth-preflight.ts(handOnCookieSession, the 401 branch ofaskSession);ui/packages/auth/src/createAuthClient.ts(takePreflightSession, the null-token arm);ui/apps/console/src/languageSeed.ts(takeSettledSeedAnswer, the spent flag).Two minutes:
cd ui && pnpm exec vitest run apps/console/src/__tests__/sessionCheckBootDedup.test.tsx apps/console/src/__tests__/localizationBootDedup.test.tsx. Expect both files green, 31 + 8 tests.Generated by Claude Code