-
Notifications
You must be signed in to change notification settings - Fork 6.6k
debug: recreate change in 12544 #13000
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
ghost
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi team,
Gemini is currently reviewing this pull request and will provide a full review shortly. In the meantime, here's a quick summary to get everyone up to speed:
This PR, "debug: recreate change in 12544", aims to recreate a fix from PR #12544 and resolve some CI issues. The changes are focused on appengine/standard/iap/js/poll.js:
- Copyright Update (lines 1-11): The copyright notice has been updated to reflect Google LLC.
- Session Refresh Enhancement (lines 54-74): The
checkSessionRefreshfunction has been modified. Thefetchcall now includes additional headers (method,credentials,X-Requested-With) to ensure proper session handling and identification of AJAX requests. Comments have been added to clarify the purpose of these changes. This is likely to improve the reliability of session refresh mechanisms.
Overall, this PR appears to be a straightforward fix addressing a previous issue and improving the robustness of the session management. Let me know if you have any questions.
And now, a little haiku to brighten your day:
Code flows like a stream,
Bugs are caught, the fix is in,
Software gleams anew.
ghost
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pull request recreates a change from a previous pull request (#12544) to debug CI issues. It updates the copyright information and modifies the checkSessionRefresh function to include additional headers in the fetch request. The added headers are meant to improve the server's ability to handle sessions, specifically for AJAX requests. The changes look correct, but there are opportunities to improve clarity and style.
| @@ -1,11 +1,11 @@ | |||
| // Copyright Google Inc. | |||
| // | |||
| // Copyright 2017 Google LLC | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's standard practice to omit the year in copyright notices unless the copyright has changed hands or there's a specific legal reason to include it. Consider simplifying to // Copyright Google LLC to adhere to common conventions.
| // Copyright 2017 Google LLC | |
| // Copyright Google LLC |
| // XMLHttpRequests is used by the server to identify AJAX requests | ||
| fetch('/favicon.ico', { | ||
| method: "GET", | ||
| credentials: 'include', | ||
| headers: { | ||
| 'X-Requested-With': 'XMLHttpRequest' | ||
| } | ||
| }).then(function(response) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While the added headers are helpful, the code lacks clarity on why they are necessary for AJAX request identification. Explain the purpose of X-Requested-With and how the server uses it. Mentioning the specific server-side framework or library that relies on this header would be very helpful. This adds valuable context for future maintainers and improves the overall understanding of the code.
| // No new session detected. Try to get a session again | ||
| window.setTimeout(checkSessionRefresh, 500); | ||
| } else { | ||
| // Session retrieved. | ||
| iapSessionRefreshWindow.close(); | ||
| iapSessionRefreshWindow = null; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comments // Checking if browser has a session... and // Session retrieved could be more descriptive. Instead of simply stating what the code does, explain the significance of the check and the retrieval. For example, what does a 401 status indicate in this context? What happens after the session is retrieved? This will make the code easier to understand and maintain.
Description
Re-creation of fix in #12544, debugging CI issues.
Note: Before submitting a pull request, please open an issue for discussion if you are not associated with Google.