Skip to content

Conversation

@ghosind
Copy link
Member

@ghosind ghosind commented Nov 10, 2025

What type of PR is this?

/kind bug

What this PR does / why we need it:

This PR is for fixing the bugs from the OSPP projects and removing duplicate code.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:


@kubeedge-bot kubeedge-bot added kind/bug Categorizes issue or PR as related to a bug. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Nov 10, 2025
@kubeedge-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign vincentgoat after the PR has been reviewed.
You can assign the PR to them by writing /assign @vincentgoat in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@gemini-code-assist
Copy link

Summary of Changes

Hello @ghosind, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses several identified bugs from OSPP projects, focusing on improving the overall user experience and system robustness. It streamlines user authentication-related flows, particularly around logout and user identification, and enhances the internationalization setup to better manage language preferences.

Highlights

  • Enhanced User Logout and Display: The logout process has been improved to ensure proper clearing of user tokens and cookies, and the displayed username now dynamically reflects the logged-in user from a cookie, defaulting to 'admin'.
  • Refined Service Account Name Extraction: The logic for extracting the service account name from JWTs has been made more robust, checking multiple potential fields in the token payload to ensure accurate user identification.
  • Improved Internationalization (i18n) Detection: The i18n system now prioritizes language detection from cookies, enhancing persistence and consistency of language preferences across user sessions.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@kubeedge-bot kubeedge-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 10, 2025
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request aims to fix bugs and improve the application's robustness. The changes to enhance user name extraction from JWTs and to make language settings more persistent using cookies are well-implemented. However, the logout functionality in UserMenu.tsx uses localStorage.clear(), which is overly aggressive and can lead to unintended side effects. I've provided a specific comment with a code suggestion to refine the logout process, making it safer and more precise.

Comment on lines 18 to +26
localStorage.clear();
setStoredToken('');
setCookie('');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Using localStorage.clear() is overly broad and can lead to unintended side effects, like clearing user preferences. It's better to specifically clear the data related to the user session. Additionally, setCookie('') doesn't delete the cookie; it only empties its value.

A better approach is to set the token and cookie values to null. This will be handled by your custom hooks to properly clear the session data. Note that a type cast is needed for setCookie due to its current restrictive type signature.

Suggested change
localStorage.clear();
setStoredToken('');
setCookie('');
setStoredToken(null);
(setCookie as any)(null);

@kubeedge-bot kubeedge-bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/bug Categorizes issue or PR as related to a bug. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants