Skip to content
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

Implementing Thresholds for Incremental PR Reviews #423

Merged

Conversation

zmeir
Copy link
Contributor

@zmeir zmeir commented Nov 2, 2023

PR Type:

Enhancement


PR Description:

This PR introduces new configurations to manage the frequency of automatic incremental reviews triggered by a push event. The main changes include:

  • Added properties first_new_commit_sha and last_seen_commit_sha in the IncrementalPR class in git_provider.py.
  • Modified get_commit_range method in github_provider.py to assign commit objects instead of commit SHA to first_new_commit and last_seen_commit.
  • Updated run method in pr_reviewer.py to check for the number of new commits and their recency before starting the review.
  • Added new configurations in configuration.toml to specify the minimum number of commits and minimum time elapsed for an incremental review.

PR Main Files Walkthrough:

files:

pr_agent/git_providers/git_provider.py: Introduced properties first_new_commit_sha and last_seen_commit_sha in the IncrementalPR class.
pr_agent/git_providers/github_provider.py: Updated get_commit_range method to assign commit objects instead of commit SHA to first_new_commit and last_seen_commit.
pr_agent/tools/pr_reviewer.py: Modified run method to check for the number of new commits and their recency before starting the review.
pr_agent/settings/configuration.toml: Added new configurations to specify the minimum number of commits and minimum time elapsed for an incremental review.


User Description:

These new configurations allow limiting the rate of automatic incremental reviews when triggered by a push event to reduce the noise it may generate in the PR

@zmeir
Copy link
Contributor Author

zmeir commented Nov 2, 2023

/describe --pr_description.add_original_user_description=true

@github-actions github-actions bot changed the title Added new configurations to prevent too frequent incremental commits on push trigger Implementing Thresholds for Incremental PR Reviews Nov 2, 2023
@github-actions github-actions bot added the enhancement New feature or request label Nov 2, 2023
if self.is_auto and self.incremental.is_incremental and not self.incremental.first_new_commit_sha:
get_logger().info(f"Incremental review is enabled for {self.pr_url} but there are no new commits")
return None
if self.incremental.is_incremental:
Copy link
Collaborator

Choose a reason for hiding this comment

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

@zmeir please move all of this to a dedicated, self-contained function.

this is too much content to appear directly

@@ -25,6 +25,9 @@ inline_code_comments = false
ask_and_reflect=false
automatic_review=true
remove_previous_review_comment=false
require_all_thresholds_for_incremental_review=false
Copy link
Collaborator

@mrT23 mrT23 Nov 6, 2023

Choose a reason for hiding this comment

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

can you stack all the 'incremental' parameters ?
i don't want the config to be just a long incoherent list

something like

/# incremental parameters:
minimal_commits_for_incremental_review=0
minimal_minutes_for_incremental_review=0
...

@mrT23
Copy link
Collaborator

mrT23 commented Nov 6, 2023

@zmeir i gave some comments.

in addition, this is a complicated ability.
Even after reviewing the code, I didn't fully understand what each parameter meant.
please add 3-4 lines of documentation the help make this ability accessible.

@zmeir
Copy link
Contributor Author

zmeir commented Nov 6, 2023

@okotek @mrT23 Thanks for the review - I've implemented all of your suggestions, please let me know if anything else is missing, or if you have any further questions.

@mrT23 mrT23 merged commit 4c484f8 into Codium-ai:main Nov 6, 2023
1 check passed
@zmeir zmeir deleted the zmeir-external-incremental_review_thresholds branch November 6, 2023 09:13
@hussam789
Copy link
Collaborator

@zmeir Thanks for adding this configuration / criteria!

yochail pushed a commit to yochail/pr-agent that referenced this pull request Feb 11, 2024
…l_review_thresholds

Implementing Thresholds for Incremental PR Reviews
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants