[PULSE-50] Organizations rename, remove Tools page, post-login profile fetch, welcome page UX #18
Reference in New Issue
Block a user
No description provided.
Delete Branch "staging"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Work Item
PULSE-50
Summary
• Renamed user-facing "workspaces" to "organizations" across Pulse (header, welcome, org settings) and aligned with ciphera-ui 0.0.49 / OrganizationSwitcher.
• Removed the Tools page and its header entry.
• Fetched full profile after login so the header shows display name without refresh.
• Improved loading state and organization selection UI on the welcome page.
Changes
• Organizations rename: Header dropdown section set to "Organizations"; welcome/onboarding copy updated to "Choose your organization", "Organization name", "Create a new organization"; organization settings message updated to "personal context". ciphera-ui bumped to 0.0.49; Pulse frontend updated to use OrganizationSwitcher with new props and copy.
• Tools page: Removed Tools page route/component and removed Tools from the application header navigation.
• Post-login profile: After login, full user profile is fetched so the header display name is correct without a page reload.
• Welcome page: Enhanced loading state and organization selection UI (visual feedback and layout/UX improvements).
Test Plan
Greptile Overview
Greptile Summary
This PR updates Pulse’s post-login and onboarding UX while aligning terminology from “workspaces” to “organizations”. It removes the standalone Tools page/nav link, adds multiple integration guide pages, updates the header org switcher wiring to the newer ciphera-ui
Headerprops, and fetches the full user profile after login/context switches so the display name shows correctly without a refresh.Key correctness issues found:
/auth/callbackretry UX is effectively broken for common failures becauseprocessedRefprevents re-running the code exchange and retry does not triggerrunCodeExchangeagain.Confidence Score: 3/5
Important Files Changed
processedRefis set.Sequence Diagram
9 files reviewed, 2 comments
Edit Code Review Agent Settings | Greptile
Additional Comments (2)
app/welcome/page.tsxOrganization rename inconsistent
Step 1/2 UI was updated to “organization”, but the blocking loading overlay still says
"Switching workspace..."(shown wheneverswitchingOrgIdis set). This will regress the user-facing rename and is visible during org switching on the welcome page.Prompt To Fix With AI
app/auth/callback/page.tsxRetry is blocked
handleRetry()only setsisRetrying=true, butrunCodeExchange()is only invoked on the auth-code path afterprocessedRef.current = true(line 101). If the first attempt fails after settingprocessedRef.current(e.g., network error fromexchangeAuthCode), retry won’t re-run because the effect returns early when!code || !state(lines 83-86), soprocessedRef.currentnever gets reset and nothing triggersrunCodeExchange()again. This makes the “Try again” button a no-op in common failure cases.Prompt To Fix With AI
Greptile Overview
Greptile Summary
This PR updates user-facing terminology from “workspaces” to “organizations”, removes the
/toolspage and header nav entry, adds framework-specific integration guide pages, and improves post-login UX by fetching the full user profile so the header can showdisplay_namewithout a manual refresh.Key runtime changes are concentrated in the auth callback, auth context, and welcome/onboarding flow where session establishment is followed by a
/auth/user/mefetch and a merged user object is stored in auth state/localStorage.Confidence Score: 3/5
Important Files Changed
returnToquery param.Sequence Diagram
9 files reviewed, 3 comments
Edit Code Review Agent Settings | Greptile
Additional Comments (3)
app/welcome/page.tsxRename missed in defaults
DEFAULT_ORG_NAMEis set to'My workspace'andslugFromName()falls back to'my-workspace', which contradicts the PR’s "workspaces → organizations" rename and will surface in the default org name/slug on first load. This looks like a regression from the pre-PR defaults and should be updated to the organization terminology for consistency.Prompt To Fix With AI
lib/auth/context.tsxStale profile after auto-switch
In the auto-switch path,
setUser(result.user)writes the session user directly and callsrouter.refresh(), but unlike other login/switch flows in this PR it does not fetch/auth/user/meto populatedisplay_name. If the cookie session user lacksdisplay_name, the header can still show the email until a later refresh. Consider reusing the same "fetch full profile + merge org_id/role" approach here.Also appears in:
lib/auth/context.tsx:169-177(same block).Prompt To Fix With AI
app/auth/callback/page.tsxOpen redirect via returnTo
returnTois taken from the URL query string and passed directly torouter.push(returnTo). If an attacker can get a user to hit/auth/callback?...&returnTo=https://evil.example, this can navigate them off-site after login. This should be restricted to same-origin relative paths (e.g., require it to start with/and reject//orhttp(s):).Prompt To Fix With AI
Greptile Overview
Greptile Summary
This PR updates user-facing terminology from “workspaces” to “organizations”, removes the Tools page/entry point, improves the welcome page loading/organization selection UX, and fetches the full user profile after login so the header can show the correct display name without a refresh.
Key integration points are the auth callback +
AuthContext(session establishment and post-login profile hydration), andlayout-contentwhere the header/org-switcher wiring lives. The main items to double-check before merge are consistency between the installed@ciphera-net/uiversion and the Header/Button props used, and aligning post-login navigation (returnTo) across auth flows.Confidence Score: 3/5
@ciphera-net/uiversion and the Header/Button props used (could silently break org switching or loading indicators), and (2) inconsistent handling ofreturnTobetween direct-token vs OAuth code-exchange paths, which will misroute users after login in OAuth scenarios.Important Files Changed
returnTofor direct-token auth and resets processing state on retry; OAuth code path still redirects to/(ignoresreturnTo).isLoadingsupport) and that state transitions don't block creation flow.Sequence Diagram
9 files reviewed, 3 comments
Edit Code Review Agent Settings | Greptile
Additional Comments (3)
app/layout-content.tsxUI package/prop mismatch
This file is passing org-switching props into the
Headerfrom@ciphera-net/ui. In this PR series there’s evidence of a@ciphera-net/uiversion mismatch vs the prop names being used (e.g., using newerOrganizationSwitcher/org props whilepackage.jsonstill pins an older ui version). If the installed UI package doesn’t support these props, the org switcher will silently not render/switch. Please ensure the dependency version matches the Header API you’re using, or update the props to the version actually installed.Prompt To Fix With AI
app/welcome/page.tsxUnsupported Button prop
This uses
isLoading={...}onButton. If@ciphera-net/ui’sButtondoesn’t support anisLoadingprop in the version pinned for this PR, this will be ignored (no spinner/disabled state) or could trigger runtime warnings depending on implementation. Either switch to the supported loading pattern for your UI version (commonlydisabled+ local spinner) or bump the UI dependency to the version that definesisLoading.Prompt To Fix With AI
app/auth/callback/page.tsxOAuth flow ignores returnTo
The
returnToparameter is validated and used in the direct-token path, but the OAuth code-exchange path always redirects to/after success. This creates inconsistent post-login navigation (users coming back via OAuth won’t land on the intended in-app destination even whenreturnTois present). Thread the same validatedreturnTologic through the OAuth flow as well (after exchange succeeds).Prompt To Fix With AI
Greptile Overview
Greptile Summary
This PR updates user-facing terminology from “workspace” to “organization”, removes the Tools page and header entry, improves welcome/onboarding UI, and adds logic to fetch a fuller user profile after login so the header can show the display name immediately.
Key areas touched:
/auth/user/mefetches and merges profile fields into the stored user state.Issues to address before merge:
login()), causing redundant requests and potentially inconsistent user state depending on response timing.returnTohandling differs between direct-token vs auth-code flows in the callback; if deep-link redirects are expected in the standard code flow, they will be broken/inconsistent.Confidence Score: 3/5
Important Files Changed
returnTofor the direct-token flow; note inconsistentreturnTohandling between auth-code vs direct-token branches.Sequence Diagram
9 files reviewed, 4 comments
Edit Code Review Agent Settings | Greptile
Additional Comments (4)
app/welcome/page.tsxUser-facing copy mismatch
This step-2 card still says “Name your workspace” even though step 1 and other updated strings say “organization”. This will ship inconsistent onboarding copy for any user creating a new org (step 2). Update the heading/labels/help text here to match the new “organization” terminology.
Prompt To Fix With AI
app/auth/callback/page.tsxUnsafe returnTo handling
returnTois validated/sanitized in the direct-token flow (lines ~72-75), but the authorization-code flow alwaysrouter.push('/')after login. If the product expectsreturnToto work for the normal auth-code callback too, that behavior is now inconsistent and will break deep-linking (e.g., login redirects back to a protected page). Consider applying the samereturnTologic for the code flow as well.Prompt To Fix With AI
lib/auth/context.tsxDuplicate profile fetches
login()now triggers an async/auth/user/mefetch (lines ~56-69), but several call sites in this PR already fetch/auth/user/meand then calllogin(merged)(e.g., welcome page and auth callback). That results in two back-to-back profile requests on a successful login/switch, which is wasted load and can cause user state to "flip" depending on response timing. Either remove the extra fetch fromlogin()or ensure call sites pass a minimal user object and rely onlogin()to fetch once.Prompt To Fix With AI
app/layout-content.tsxStale org list after switch
The header org list is fetched only when
auth.userchanges (useEffect deps).handleSwitchWorkspacedoes a hard reload, so it will refresh, but if the UI library ever switches org without reload (or reload is removed later),orgswill be stale andactiveOrgIdwon’t be reflected correctly. Since this PR is explicitly moving toward “no refresh needed” for profile, consider ensuring orgs refresh on org context change (e.g., whenauth.user?.org_idchanges) so the header stays consistent.Prompt To Fix With AI
Greptile Overview
Greptile Summary
This PR completes a user-facing terminology shift from “workspaces” to “organizations”, updates the header org switcher wiring to match
@ciphera-net/ui0.0.49, removes the/toolsroute and header entry, and improves the welcome/onboarding UX (loading and org selection cards).It also changes the post-auth flows to fetch
/auth/user/meafter setting the session so the in-app header can displaydisplay_nameimmediately (Auth callback, welcome org selection, and AuthContext login/init/auto-switch).Confidence Score: 4/5
Important Files Changed
returnTohandling, retry reset, and fetches full profile via/auth/user/mebefore callingloginso display_name is available immediately.Sequence Diagram
11 files reviewed, 2 comments
Edit Code Review Agent Settings | Greptile
Additional Comments (2)
app/welcome/page.tsxOrganization rename incomplete
Step 2 still renders workspace terminology (
"Name your workspace","Workspace name", and"Used in your workspace URL."), which contradicts the PR’s org rename and the Step 1 copy. This will ship mixed terminology in the onboarding flow.Prompt To Fix With AI
app/layout-content.tsxIncorrect error message label
handleSwitchOrganizationlogsFailed to switch workspaceon error, but this handler is now org-based. This makes prod logs misleading when debugging org switching issues.Prompt To Fix With AI
Greptile Overview
Greptile Summary
This PR updates user-facing terminology from “workspace” to “organization” across the header and welcome flow, upgrades
@ciphera-net/uito0.0.49to use the updatedOrganizationSwitcherAPI, and removes the/toolsroute and header nav entry.It also changes the auth flow so a full
/auth/user/meprofile is fetched after login (and after org switching/creation) to ensure the header can showdisplay_namewithout requiring a manual refresh. The welcome page gets UX improvements around loading and organization selection.Confidence Score: 3/5
/auth/user/medoesn’t reflect the new org immediately. Fixing those will reduce noisy failed requests and prevent loops.Important Files Changed
Sequence Diagram
11 files reviewed, 2 comments
Edit Code Review Agent Settings | Greptile
Additional Comments (2)
lib/auth/context.tsxUnauthenticated profile fetch
login()now callsapiRequest('/auth/user/me')immediately aftersetUser(userData)(lib/auth/context.tsx:51-69). In the auth callback you already fetch/auth/user/mebefore callinglogin, butlogin()will fetch it again, and (more importantly) any call site that invokeslogin(userData)before the session cookie is set will reliably trigger a failing/auth/user/merequest and log an error. Consider removing the fetch fromlogin()(or gating it behind a known-authenticated signal) and keeping the “fetch full profile” only in places where the session has definitely been established (e.g., aftersetSessionAction).Prompt To Fix With AI
lib/auth/context.tsxRepeated auto-switch loop
In the org-wall effect, when
!user.org_idyou switch context and then setuserto amergedprofile (lib/auth/context.tsx:159-163), but the merge prefersfullProfile.org_idoverresult.user.org_id. If/auth/user/medoesn’t reflect the newly-selected org immediately (common if it’s derived from cookie/session propagation),user.org_idcan remain falsy and this effect will run again, repeatedly attemptingswitchContexton every render. Usingorg_id: result.user.org_id ?? fullProfile.org_id(and similarly forrole) avoids re-triggering the auto-switch when the switch call succeeded.Prompt To Fix With AI
Greptile Overview
Greptile Summary
I couldn’t perform the requested PR review because the PR diff/content isn’t available in this environment yet. I need the actual code changes (via
git diffoutput or by providing the file contents) to identify concrete, non-speculative issues and to produce the required line-numbered review comments, file analyses, and sequence diagram.Confidence Score: 0/5
Important Files Changed
Sequence Diagram