Repository navigation
feat(auth,web): auto-seed founderInboxOwner from authenticated session founder - #232
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
|
Independent full review (Claude family; author was Gemini) of #232 at Server propagation is correct: {
"reviewed_base": "b1827643e0301a6da4178d2dcd14afca1990927f",
"reviewed_head": "53d307165483ab8e0bf997e858c4ae810dc2a2ca",
"reviewer": "Claude Sonnet 5.5, Claude Code",
"author_session": "t3-thread:6a6b870263499e5c3c4ceec5efb20d31b46884a74e0c45beedb1a4cddb9ac991",
"reviewer_session": "claude-sonnet-5-5-review-pr232-20261126-a",
"fresh_context": true,
"review_kind": "full",
"round_id": "claude-sonnet-5-5-review-pr232-20261126-a",
"intent": [
"GET /api/auth/session returns founder for existing sessions and freshly auto-minted Cloudflare Access sessions, omitted when unauthenticated or non-founder",
"AutoSeedFounderInboxOwner seeds founderInboxOwner only when unset and never overwrites an explicit choice",
"No render loop; vp lint clean; compatible with the My Bots / Others / Closura grouping (#231)"
],
"prior_findings": [],
"findings": [
{
"id": "F1",
"severity": "important",
"summary": "The seed effect does not wait for client settings hydration, so it can overwrite a persisted explicit founderInboxOwner.",
"outcome": "open",
"file": "apps/web/src/state/founderSessionSeed.tsx",
"line": 33,
"check": "Read useSettings.ts: before hydration getClientSettingsSnapshot() is DEFAULT_CLIENT_SETTINGS, so founderInboxOwner reads undefined. If the session state resolves before hydrateClientSettings() finishes, updateClientSettings -> persistClientSettingsPatch defers the patch, and after hydration applies {...persisted, ...patch} unconditionally, replacing the saved choice. Sibling code (knownEnvironments.tsx:107, ChatView.tsx:657) gates on useClientSettingsHydrated(). Fix: return early unless useClientSettingsHydrated() is true and add it to the effect deps."
},
{
"id": "F2",
"severity": "nit",
"summary": "No tests cover the new server propagation or the seeding behavior.",
"outcome": "open",
"file": "apps/server/src/auth/CloudflareAccessAuth.ts",
"line": 201,
"check": "The PR touches no test files. AGENTS.md asks backend behavior changes to ship with focused tests; CloudflareAccessAuth.test.ts could assert minted.founder, and EnvironmentAuth/http tests could assert founder in getSessionState."
},
{
"id": "F3",
"severity": "nit",
"summary": "The seed takes the first authenticated environment's founder in list order, not the primary environment's.",
"outcome": "open",
"file": "apps/web/src/state/founderSessionSeed.tsx",
"line": 24,
"check": "The loop over environmentSessionStatesAtom breaks on the first session with a founder. A linked remote environment paired under a different founder could seed this device. Prefer the primary environment's session, or document that any connected environment is acceptable."
}
]
} |
…, prefer primary env, assert founder in auth test
|
Focused re-check (Claude family; author was Gemini) of #232 at
F1 is confirmed fixed. F2 (tests) is fixed. F3 (prefer the primary environment) is not effectively fixed. The new check Options for F3: (a) drop the dead branch and document that any authenticated environment may seed, or (b) identify the primary environment through a real signal, such as the primary connection target or catalog entry kind, instead of comparing to {
"reviewed_base": "b1827643e0301a6da4178d2dcd14afca1990927f",
"reviewed_head": "e6c38ca8449dd09a2b76ec8b6504a50536f9e1b9",
"reviewer": "Claude Sonnet 5.5, Claude Code",
"author_session": "t3-thread:6a6b870263499e5c3c4ceec5efb20d31b46884a74e0c45beedb1a4cddb9ac991",
"reviewer_session": "claude-sonnet-5-5-recheck-pr232-20261126-b7f3",
"fresh_context": true,
"review_kind": "focused_recheck",
"round_id": "claude-sonnet-5-5-review-pr232-20261126-a",
"intent": [
"Auto-seed founderInboxOwner after settings hydration preferring primary environment + CF Access founder test coverage"
],
"prior_findings": ["F1", "F2", "F3"],
"findings": [
{
"id": "F1",
"severity": "important",
"summary": "The seed effect now waits for client settings hydration, so a persisted explicit founderInboxOwner is not overwritten.",
"outcome": "confirmed",
"rechecked_head": "e6c38ca8449dd09a2b76ec8b6504a50536f9e1b9",
"file": "apps/web/src/state/founderSessionSeed.tsx",
"line": 41,
"check": "useClientSettingsHydrated() (status === 'ready') is read at line 21; the effect returns early on !hydrated and lists hydrated in deps, so it re-runs after hydration."
},
{
"id": "F2",
"severity": "nit",
"summary": "CloudflareAccessAuth.test.ts now asserts founder === 'kameron' on both the initial CF Access auto-mint and the cookie-authenticated GET /api/auth/session.",
"outcome": "fixed",
"rechecked_head": "e6c38ca8449dd09a2b76ec8b6504a50536f9e1b9",
"file": "apps/server/src/auth/CloudflareAccessAuth.test.ts",
"line": 288,
"check": "Assertions at lines 288 and 317; vp test run src/auth/CloudflareAccessAuth.test.ts passes 5/5."
},
{
"id": "F3",
"severity": "nit",
"summary": "The primary-environment preference never takes effect: identities' environmentId is the server's UUID descriptor id, never the literal 'primary', so selection still falls back to first authenticated environment in list order.",
"outcome": "open",
"rechecked_head": "e6c38ca8449dd09a2b76ec8b6504a50536f9e1b9",
"file": "apps/web/src/state/founderSessionSeed.tsx",
"line": 33,
"check": "PRIMARY_LOCAL_ENVIRONMENT_ID === 'primary' (contracts/ipc.ts:383) is the registration cache key and desktop bootstrap id; identitiesAtom (client-runtime presentation.ts:251) maps catalog keys, and the primary entry's environmentId is descriptor.environmentId (platform.ts:464), a UUIDv4 from ServerEnvironment. The comparison cannot match; either remove the dead branch and document any-authenticated-env semantics, or detect the primary environment via a real signal."
}
]
} |
Summary
Follow-up to
#231so fresh mobile browsers authenticated via Cloudflare Access (or any founder-bound session) immediately get the rightMy Bots/Others/Closurasidebar split on first load without opening Settings.Changes
packages/contracts/src/auth.ts: adds optionalfounder: Schema.optionalKey(Founder)toAuthSessionState.apps/server/src/auth/SessionStore.ts,EnvironmentAuth.ts,CloudflareAccessAuth.ts,http.ts:row.value.founderontoVerifiedSession→AuthenticatedSession→AuthSessionStateonGET /api/auth/session(both existing sessions and freshly auto-minted Cloudflare Access sessions).apps/web/src/state/founderSessionSeed.tsx+apps/web/src/routes/__root.tsx:<AutoSeedFounderInboxOwner />: whenclientSettings.founderInboxOwner === undefinedand an authenticated environment session carriesfounder, callsupdateClientSettings({ founderInboxOwner: sessionFounder })once.founderInboxOwner.Verification
pnpm exec vp fmton all edited files: passpnpm exec effect-tsgo tsrs -p apps/server/tsconfig.json --noEmit: 0 errorspnpm exec effect-tsgo tsrs -p apps/web/tsconfig.json --noEmit: 0 errors in touched filespnpm --dir apps/server exec vp test run src/auth/CloudflareAccessAuth.test.ts: 5/5 passedDeploy: fleet