| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Summary of ChangesHello, 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 a critical bug in the handling of HTTP functions with CORS enabled. Previously, functions decorated with @core.init would not have their initialization logic executed when served with CORS, leading to unexpected behavior. The fix ensures that the _with_init wrapper is consistently applied, guaranteeing that all necessary setup code runs regardless of CORS configuration. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
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.
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
|
Sorry, something went wrong.
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Sorry, something went wrong.
There was a problem hiding this comment.
This pull request correctly fixes a bug where the init function was not called for on_request handlers when CORS is enabled. The fix ensures the _with_init wrapper is applied consistently. The addition of a dedicated test case is a great way to verify the fix and prevent regressions. I've included one suggestion for a minor refactoring to improve code clarity and reduce duplication.
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM!
Thank you for contributing.
Sorry, something went wrong.
No worries! Do you know how I go about getting this merged? Do I need another approver? |
Sorry, something went wrong.
|
Hi @Bradley-McCallion. Sorry for the late response! I'll bring this up in the next meeting. Hopefully we can get this merged. |
Sorry, something went wrong.
There was a problem hiding this comment.
I'm not too familiar with this codebase so leaning heavily on AI to help do a good review. Let me know if I didn't sufficiently check it's results and sorry if that's the case (I did try hard to convince myself and verify).
Sorry, something went wrong.
| methods=options.cors.cors_methods, | ||
| origins=options.cors.cors_origins, | ||
| )(func)(request) | ||
| )(_core._with_init(func))(request) |
There was a problem hiding this comment.
I think (with the help of AI) this works, but has high overhead as we don't need to call _with_init or _cross_origin on every request.
Do you think this would work and be more efficient?
def on_request_inner_decorator(func: _C1):
func_with_init = _core._with_init(func)
if options.cors is not None:
wrapped_func = _cross_origin(
methods=options.cors.cors_methods,
origins=options.cors.cors_origins,
)(func_with_init)
else:
wrapped_func = func_with_init
@_functools.wraps(func)
def on_request_wrapped(request: Request) -> Response:
return wrapped_func(request)
_util.set_func_endpoint_attr(
on_request_wrapped,
options._endpoint(func_name=func.__name__),
)
return on_request_wrapped
I think this is consistent with oncall below? What do you think?
Sorry, something went wrong.
There was a problem hiding this comment.
Great spot @ajperel (and AI)! Pushed that change!
Sorry, something went wrong.
Previously we were doing redundant work on each call when this could be fixed a decoration time with no functional difference
There was a problem hiding this comment.
Looks great. Thank you!
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Fixes #251
In the code path for when CORs is enabled we simply seem to be missing the _with_init wrapper that is present on the path for when CORs is not enabled. It is assumed this is simply a mistake.