-
Notifications
You must be signed in to change notification settings - Fork 7
Update comment even if all approved #55
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
🎉 Snyk checks have passed. No issues have been found so far.✅ security/snyk check is complete. No issues have been found. (View Details) ✅ license/snyk check is complete. No issues have been found. (View Details) |
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.
Summary of Changes
Hello @BakerNet, 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 refines the behavior of the review status comment system. The primary goal is to ensure that the comment accurately reflects the current review status, including when all required approvals have been met, by allowing existing comments to be updated. Concurrently, it prevents the creation of new, redundant comments when a pull request already satisfies all review requirements and no prior comment exists.
Highlights
- Review Comment Updates: The logic within
addReviewStatusCommenthas been adjusted to ensure that the review status comment is updated even when all required code owner reviews have been satisfied. Previously, the function would skip processing if no unapproved owners remained, preventing updates to an 'all approved' state. - Preventing Redundant New Comments: A new condition was added to prevent the creation of a new review status comment if all required code owner reviews are already satisfied and no existing comment is found. This avoids unnecessary 'all approved' comments from being posted when they are not needed.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| 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 issue 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 is currently in preview and 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 to provide feedback.
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
-
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. ↩
|
Codeowners approval required for this PR: |
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.
Code Review
The code changes aim to update the review comment even when all PRs are satisfied. However, there are potential correctness issues where the updated comment content is incorrect when all approvals are met, and a misleading debug log message. Also, the logic to add a comment when all approvals are met and no existing comment is found is missing.
| if a.config.Quiet { | ||
| a.printDebug("Skipping review status comment (disabled or no unapproved owners).\n") | ||
| return nil | ||
| } |
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 removal of the len(allRequiredOwners) == 0 check means this function now executes even when all required reviewers have approved. However, the subsequent logic for generating the comment does not handle this case correctly, potentially leading to misleading comments. The debug message is also misleading now, as the function no longer skips if there are no unapproved owners.
| return fmt.Errorf("UpdateComment Error: %v", err) | ||
| } | ||
| } else { | ||
| } else if len(allRequiredOwners) > 0 { |
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 condition len(allRequiredOwners) > 0 is now checked in an else if block. This means that if existingFound is false (i.e., no existing comment was found) and len(allRequiredOwners) is also 0 (i.e., all required owners have approved), no comment will be added. This contradicts the PR description, which states that the review comment should be updated even when all PRs are satisfied.
|
|
||
| if a.config.Quiet || len(allRequiredOwners) == 0 { | ||
| if a.config.Quiet { | ||
| a.printDebug("Skipping review status comment (disabled or no unapproved owners).\n") |
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 log message is now misleading after the logic change. The function no longer skips if there are no unapproved owners. The message should be updated to reflect that it only skips when quiet mode is enabled.
| a.printDebug("Skipping review status comment (disabled or no unapproved owners).\n") | |
| a.printDebug("Skipping review status comment (disabled).\n") |
Summary / Background
The review comment isn't being updated when all PRs are satisfied, but it ought to. To avoid extra noise, if there is no existing comment, still skip.