Address PR344 follow-up review comments - #2
Conversation
* Fix account switch session validation during refresh * Fail switch-account refresh when user identity cannot be verified * Update opennow-stable/src/main/gfn/auth.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: PriyanshAg-1 <204138848+PriyanshAg-1@users.noreply.github.com> Co-authored-by: priyanshrv1-oss <priyanshrv1@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
| className="navbar-user navbar-user--clickable" | ||
| onClick={() => setAccountDropdownOpen((previous) => !previous)} | ||
| aria-expanded={accountDropdownOpen} | ||
| aria-label="Account options" |
There was a problem hiding this comment.
[🟡 Medium] [🔵 Bug]
In @opennow-stable/src/renderer/src/components/Navbar.tsx the new trigger button hard-codes a generic aria-label, which overrides the visible username/tier text when the button’s accessible name is computed: ```tsx
// opennow-stable/src/renderer/src/components/Navbar.tsx
<button
type="button"
className="navbar-user navbar-user--clickable"
onClick={() => setAccountDropdownOpen((previous) => !previous)}
aria-expanded={accountDropdownOpen}
aria-label="Account options"
```suggestion
aria-label={`${user.displayName} account options`}
| const refreshFailed = | ||
| result.refresh.outcome === "failed" || result.refresh.outcome === "missing_refresh_token"; | ||
| const switchedUserMismatch = result.session?.user.userId !== userId; | ||
| if (!result.session || refreshFailed || switchedUserMismatch) { |
There was a problem hiding this comment.
[🟡 Medium] [🔵 Bug]
// opennow-stable/src/main/gfn/auth.ts
const refreshFailed =
result.refresh.outcome === "failed" || result.refresh.outcome === "missing_refresh_token";
const switchedUserMismatch = result.session?.user.userId !== userId;
if (!result.session || refreshFailed || switchedUserMismatch) {
await this.removeAccount(userId);
}ensureValidSessionWithStatus() explicitly returns outcome: "failed" with "Token refresh failed. Using saved session token." and outcome: "missing_refresh_token" with "No refresh token available. Using saved session token." when the access token is still valid. Treating both outcomes as fatal here means a transient refresh/userinfo failure during account switch will delete the saved account and force a relogin even though the session can still be used, which breaks the PR’s reliability goal under failures. Only evict the account when no session remains, the token is actually expired/invalid, or the refreshed identity mismatches the requested user; otherwise keep the saved account and continue with the returned session or a non-destructive warning.
Addresses the remaining follow-up review comments from upstream PR #344.
Changes:
Scoped to the review follow-up only, based on latest main.