-
Notifications
You must be signed in to change notification settings - Fork 0
✨ Run builder when source is changed. #4
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
base: base-sha/5895e8ca60b8be2a44e00b156e71a2c0e8763da3
Are you sure you want to change the base?
Conversation
|
This is a benchmark review for experiment This pull request was cloned from Experiment configurationreview_config:
# User configuration for the review
# - benchmark - use the user config from the benchmark reviews
# - <value> - use the value directly
user_config:
enable_ai_review: true
enable_rule_comments: false
enable_complexity_comments: benchmark
enable_docstring_comments: benchmark
enable_security_comments: benchmark
enable_tests_comments: benchmark
enable_comment_suggestions: benchmark
enable_functionality_review: benchmark
enable_approvals: true
ai_review_config:
# The model responses to use for the experiment
# - benchmark - use the model responses from the benchmark reviews
# - llm - call the language model to generate responses
model_responses:
comments_model: benchmark
comment_validation_model: benchmark
comment_suggestion_model: benchmark
complexity_model: benchmark
docstrings_model: benchmark
functionality_model: benchmark
security_model: benchmark
tests_model: benchmark
# The pull request dataset to run the experiment on
pull_request_dataset:
- https://github.com/Bilbottom/sql-problems/pull/1
- https://github.com/Bilbottom/sql-learning-materials/pull/13
- https://github.com/Bilbottom/python-template/pull/3
- https://github.com/Bilbottom/sql-problems/pull/2
- https://github.com/gdsfactory/kfactory/pull/304
- https://github.com/mslepko/wc-daily-logs-emailer/pull/2
- https://github.com/mslepko/wc-daily-logs-emailer/pull/3
- https://github.com/jquagga/ttt/pull/94
- https://github.com/mslepko/wc-daily-logs-emailer/pull/5
- https://github.com/rbanffy/pip-chill/pull/75
- https://github.com/yaitoo/sqle/pull/45
- https://github.com/Catrofe/AvaliationSystemECommerce/pull/5
- https://github.com/Catrofe/AvaliationSystemECommerce/pull/6
- https://github.com/ultralytics/JSON2YOLO/pull/87
- https://github.com/ultralytics/flickr_scraper/pull/24
- https://github.com/nikhilbadyal/docker-py-revanced/pull/512
- https://github.com/MusicalNinjaDad/FizzBuzz/pull/10
- https://github.com/petermcd/monzo-api/pull/71
- https://github.com/christian80gabi/RecycleAI/pull/3
- https://github.com/christian80gabi/RecycleAI/pull/4
- https://github.com/nbhirud/system_update/pull/22
- https://github.com/nbhirud/system_update/pull/23
- https://github.com/agatma/sprint1-http-server/pull/1
- https://github.com/mraniki/cefi/pull/464
- https://github.com/Idrinth/api-bench/pull/915
- https://github.com/Idrinth/api-bench/pull/921
- https://github.com/dashmug/glue-utils/pull/28
- https://github.com/Idrinth/api-bench/pull/917
- https://github.com/sett-and-hive/sarif-to-comment-action/pull/286
- https://github.com/uncscode/particula/pull/445
review_comment_labels:
- label: correct
question: Is this comment correct?
- label: helpful
question: Is this comment helpful?
- label: comment-type
question: Is the comment type correct?
- label: comment-area
question: Is the comment area correct?
- label: llm-test
question: |
What type of LLM test could this comment become?
- 👍 - this comment is really good/important and we should always make it
- 👎 - this comment is really bad and we should never make it
- no reaction - don't turn this comment into an LLM test
# Benchmark reviews generated by running
# python -m scripts.experiment benchmark <experiment_name>
benchmark_reviews: []
|
SourceryAI
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.
Hey @sourcery-ai-experiments-bot - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 4 issues found
- 🟢 Security: all looks good
- 🟡 Testing: 2 issues found
- 🟢 Complexity: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.
| def get_last_version_source(self: Self, app: APP, resource_name: str) -> str: | ||
| """Get last patched version.""" | ||
| if os.getenv("DRY_RUN", default=None): | ||
| with Path(updates_file).open() as url: | ||
| data = json.load(url) | ||
| else: | ||
| with urllib.request.urlopen(self.update_file_url) as url: | ||
| data = json.load(url) | ||
| if data.get(app.app_name): | ||
| return str(data[app.app_name][app_dump_key][resource_name]) |
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.
suggestion (code_refinement): Consider handling exceptions for JSON operations.
Loading JSON data can fail due to malformed data or I/O issues. It's advisable to wrap the json.load calls in a try-except block to handle potential exceptions and maintain robustness.
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.
Is this comment correct?
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.
Is this comment helpful?
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.
Is the comment type correct?
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.
Is the comment area correct?
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.
What type of LLM test could this comment become?
- 👍 - this comment is really good/important and we should always make it
- 👎 - this comment is really bad and we should never make it
- no reaction - don't turn this comment into an LLM test
| def should_trigger_build(self: Self, old_version: str, old_source: str, new_version: str, new_source: str) -> bool: | ||
| """Function to check if we should trigger a build.""" | ||
| if old_source != new_source: | ||
| logger.info(f"Trigger build because old source {old_source}, is different from new source {new_source}") | ||
| return True |
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.
suggestion (code_refinement): Refactor 'should_trigger_build' to reduce complexity.
The method now handles multiple conditions and logging, which increases its complexity. Consider breaking down the functionality into smaller, more manageable methods.
| def should_trigger_build(self: Self, old_version: str, old_source: str, new_version: str, new_source: str) -> bool: | |
| """Function to check if we should trigger a build.""" | |
| if old_source != new_source: | |
| logger.info(f"Trigger build because old source {old_source}, is different from new source {new_source}") | |
| return True | |
| def should_trigger_build(self: Self, old_version: str, old_source: str, new_version: str, new_source: str) -> bool: | |
| """Function to check if we should trigger a build.""" | |
| if self._is_source_changed(old_source, new_source): | |
| return True | |
| def _is_source_changed(self, old_source: str, new_source: str) -> bool: | |
| if old_source != new_source: | |
| logger.info(f"Trigger build because old source {old_source}, is different from new source {new_source}") | |
| return True | |
| return False |
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.
Is this comment correct?
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.
Is this comment helpful?
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.
Is the comment type correct?
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.
Is the comment area correct?
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.
What type of LLM test could this comment become?
- 👍 - this comment is really good/important and we should always make it
- 👎 - this comment is really bad and we should never make it
- no reaction - don't turn this comment into an LLM test
| old_integration_source = GitHubManager(env).get_last_version_source(app_obj, integrations_dl_key) | ||
| old_patches_version = GitHubManager(env).get_last_version(app_obj, patches_version_key) | ||
| old_patches_source = GitHubManager(env).get_last_version_source(app_obj, patches_dl_key) |
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.
suggestion (testing): Missing test cases for new source comparison logic in build triggers.
The changes include new logic to compare sources for integrations and patches to decide on triggering builds. It's crucial to add tests that verify this new functionality works as expected and handles edge cases, such as when sources are identical or when one is null.
| old_integration_source = GitHubManager(env).get_last_version_source(app_obj, integrations_dl_key) | |
| old_patches_version = GitHubManager(env).get_last_version(app_obj, patches_version_key) | |
| old_patches_source = GitHubManager(env).get_last_version_source(app_obj, patches_dl_key) | |
| github_manager = GitHubManager(env) | |
| old_integration_source = github_manager.get_last_version_source(app_obj, integrations_dl_key) | |
| old_patches_version = github_manager.get_last_version(app_obj, patches_version_key) | |
| old_patches_source = github_manager.get_last_version_source(app_obj, patches_dl_key) |
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.
Is this comment correct?
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.
Is this comment helpful?
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.
Is the comment type correct?
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.
Is the comment area correct?
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.
What type of LLM test could this comment become?
- 👍 - this comment is really good/important and we should always make it
- 👎 - this comment is really bad and we should never make it
- no reaction - don't turn this comment into an LLM test
| def should_trigger_build(self: Self, old_version: str, old_source: str, new_version: str, new_source: str) -> bool: | ||
| """Function to check if we should trigger a build.""" | ||
| if old_source != new_source: | ||
| logger.info(f"Trigger build because old source {old_source}, is different from new source {new_source}") | ||
| return True |
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.
suggestion (testing): Consider adding tests for the updated should_trigger_build method.
This method now includes additional parameters and logic for source comparison. Ensure there are tests that cover various scenarios, including cases where versions are the same but sources differ, and vice versa.
| def should_trigger_build(self: Self, old_version: str, old_source: str, new_version: str, new_source: str) -> bool: | |
| """Function to check if we should trigger a build.""" | |
| if old_source != new_source: | |
| logger.info(f"Trigger build because old source {old_source}, is different from new source {new_source}") | |
| return True | |
| def should_trigger_build(self: Self, old_version: str, old_source: str, new_version: str, new_source: str) -> bool: | |
| """Function to check if we should trigger a build.""" | |
| if old_source != new_source: | |
| logger.info(f"Trigger build because old source {old_source} is different from new source {new_source}") | |
| return True |
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.
Is this comment correct?
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.
Is this comment helpful?
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.
Is the comment type correct?
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.
Is the comment area correct?
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.
What type of LLM test could this comment become?
- 👍 - this comment is really good/important and we should always make it
- 👎 - this comment is really bad and we should never make it
- no reaction - don't turn this comment into an LLM test
Type
enhancement
Description
GitHubManagerto fetch the last version source, supporting the new build trigger checks.should_trigger_buildmethod inReleaseManagerto consider source changes, improving the accuracy of build triggers.Changes walkthrough
check_resource_updates.py
Enhance build trigger checks with source versioningcheck_resource_updates.py
github.py
Add GitHub source version fetching methodsrc/manager/github.py
release_manager.py
Update build trigger logic to include source comparisonsrc/manager/release_manager.py
utils.py
Introduce new utility keys for resource managementsrc/utils.py