diff --git a/conftest.py b/conftest.py index af35bd463..1ef777a55 100644 --- a/conftest.py +++ b/conftest.py @@ -157,8 +157,10 @@ def mock_configuration(mocker): def codecov_vcr(request): current_path = Path(request.node.fspath) current_path_name = current_path.name.replace(".py", "") - cls_name = request.node.cls.__name__ - cassete_path = current_path.parent / "cassetes" / current_path_name / cls_name + cassete_path = current_path.parent / "cassetes" / current_path_name + if request.node.cls: + cls_name = request.node.cls.__name__ + cassete_path = cassete_path / cls_name current_name = request.node.name casset_file_path = str(cassete_path / f"{current_name}.yaml") with vcr.use_cassette( diff --git a/requirements.in b/requirements.in index 25465bcb8..89e4812cb 100644 --- a/requirements.in +++ b/requirements.in @@ -1,4 +1,4 @@ -https://github.com/codecov/shared/archive/729a9321bfa96dd768dbf4bdcaab07e8fd8d82cd.tar.gz#egg=shared +https://github.com/codecov/shared/archive/70039b5b9e5cc1466041da351a07ebf9546fe89a.tar.gz#egg=shared https://github.com/codecov/opentelem-python/archive/refs/tags/v0.0.4a1.tar.gz#egg=codecovopentelem boto3 celery @@ -37,4 +37,5 @@ urllib3>=1.26.18 vcrpy opentelemetry-instrumentation-celery>=0.41b0 opentelemetry-sdk>=1.20.0 -google-cloud-pubsub \ No newline at end of file +google-cloud-pubsub +openai \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 172315b06..99cfbeec5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,8 +10,12 @@ analytics-python==1.3.0b1 # via # -r requirements.in # shared +annotated-types==0.6.0 + # via pydantic anyio==3.6.1 - # via httpcore + # via + # httpcore + # openai async-timeout==4.0.2 # via redis attrs==20.3.0 @@ -80,6 +84,8 @@ deprecated==1.2.12 # via opentelemetry-api distlib==0.3.7 # via virtualenv +distro==1.8.0 + # via openai ecdsa==0.16.1 # via tlslite-ng exceptiongroup==1.1.3 @@ -144,6 +150,7 @@ httplib2==0.19.0 httpx==0.23.1 # via # -r requirements.in + # openai # respx # shared identify==2.5.30 @@ -186,6 +193,8 @@ oauth2==1.9.0.post1 # via shared oauthlib==3.1.0 # via shared +openai==1.2.4 + # via -r requirements.in opentelemetry-api==1.20.0 # via # opentelemetry-instrumentation @@ -236,6 +245,10 @@ pyasn1-modules==0.2.8 # via google-auth pycparser==2.20 # via cffi +pydantic==2.5.0 + # via openai +pydantic-core==2.14.1 + # via pydantic pyjwt==2.4.0 # via # -r requirements.in @@ -305,7 +318,7 @@ s3transfer==0.3.4 # via boto3 sentry-sdk==1.19.1 # via -r requirements.in -shared @ https://github.com/codecov/shared/archive/729a9321bfa96dd768dbf4bdcaab07e8fd8d82cd.tar.gz +shared @ https://github.com/codecov/shared/archive/70039b5b9e5cc1466041da351a07ebf9546fe89a.tar.gz # via -r requirements.in six==1.15.0 # via @@ -344,11 +357,16 @@ tlslite-ng==0.8.0a39 # via shared tomli==2.0.1 # via pytest +tqdm==4.66.1 + # via openai typing==3.7.4.3 # via shared typing-extensions==4.6.3 # via + # openai # opentelemetry-sdk + # pydantic + # pydantic-core # shared urllib3==1.26.18 # via diff --git a/services/ai_pr_review.py b/services/ai_pr_review.py new file mode 100644 index 000000000..2ad6d44c4 --- /dev/null +++ b/services/ai_pr_review.py @@ -0,0 +1,378 @@ +import json +import logging +import re +from dataclasses import dataclass +from functools import cached_property +from typing import Dict, List, Optional + +from openai import AsyncOpenAI +from shared.config import get_config +from shared.storage.exceptions import FileNotInStorageError +from shared.torngit.base import TokenType, TorngitBaseAdapter + +from database.models.core import Repository +from helpers.metrics import metrics +from services.archive import ArchiveService +from services.repository import get_repo_provider_service + +log = logging.getLogger(__name__) + +FILE_REGEX = re.compile(r"diff --git a/(.+) b/(.+)") + + +def build_prompt(diff_text: str) -> str: + return f""" + Your purpose is to act as a highly experienced software engineer and provide a thorough + review of code changes and suggest improvements. Do not comment on minor style issues, + missing comments or documentation. Identify and resolve significant concerns to improve + overall code quality. + + You will receive a Git diff where each line has been prefixed with a unique identifer in + square brackets. When referencing lines in this diff use that identifier. + + Format your output as JSON such that there is 1 top-level comment that summarizes your review + and multiple additional comments addressing specific lines in the code with the changes you + deem appropriate. + + The output should have this JSON form: + + {{ + "body": "This is the summary comment", + "comments": [ + {{ + "line_id": 123, + "body": "This is a comment about the code with line ID 123", + }} + ] + }} + + Limit the number of comments to 10 at most. + + Here is the Git diff on which you should base your review: + + {diff_text} + """ + + +async def fetch_openai_completion(prompt: str): + client = AsyncOpenAI(api_key=get_config("services", "openai", "api_key")) + completion = await client.chat.completions.create( + messages=[ + { + "role": "user", + "content": prompt, + } + ], + model="gpt-4", + ) + + output = completion.choices[0].message.content + return output + + +@dataclass(frozen=True) +class LineInfo: + file_path: str + position: int + + +class Diff: + def __init__(self, diff): + self._diff = diff + self._index = {} + self._build_index() + + @cached_property + def preprocessed(self) -> str: + """ + This returns the full diff but with each line prefixed by: + [line_id] (where line_id is just a unique integer) + """ + return "\n".join( + [f"[{i+1}] {line}" for i, line in enumerate(self._diff.split("\n"))] + ) + + def line_info(self, line_id: int) -> LineInfo: + return self._index[line_id] + + def _build_index(self): + file_path = None + position = None + + for idx, line in enumerate(self._diff.split("\n")): + line_id = idx + 1 + match = FILE_REGEX.match(line) + if match: + # start of a new file, extract the name and reset the position + file_path = match.groups()[-1] + position = None + elif line.startswith("@@"): + # start of new hunk + if position is None: + # 1st hunk of file, start tracking position + position = 0 + else: + # new hunk same file, just ignore but keep tracking position + pass + elif position is not None: + # code line, increment position and keep track of it in the index + position += 1 + self._index[line_id] = LineInfo(file_path=file_path, position=position) + + +@dataclass +class Comment: + body: str + comment_id: Optional[int] = None + + +@dataclass +class ReviewComments: + # top-level comment + body: str + + # line-based code comments + comments: Dict[LineInfo, Comment] + + +class PullWrapper: + def __init__(self, torngit: TorngitBaseAdapter, pullid: int): + self.torngit = torngit + self.pullid = pullid + self._head_sha = None + + @property + def token(self): + return self.torngit.get_token_by_type_if_none(None, TokenType.read) + + async def fetch_diff(self) -> str: + async with self.torngit.get_client() as client: + diff = await self.torngit.api( + client, + "get", + f"/repos/{self.torngit.slug}/pulls/{self.pullid}", + token=self.token, + headers={"Accept": "application/vnd.github.v3.diff"}, + ) + return diff + + async def fetch_head_sha(self) -> str: + if self._head_sha is not None: + return self._head_sha + + async with self.torngit.get_client() as client: + res = await self.torngit.api( + client, + "get", + f"/repos/{self.torngit.slug}/pulls/{self.pullid}", + token=self.token, + ) + self._head_sha = res["head"]["sha"] + return self._head_sha + + async def fetch_review_comments(self): + async with self.torngit.get_client() as client: + page = 1 + while True: + res = await self.torngit.api( + client, + "get", + f"/repos/{self.torngit.slug}/pulls/{self.pullid}/comments?per_page=100&page={page}", + token=self.token, + ) + if len(res) == 0: + break + for item in res: + yield item + page += 1 + + async def create_review(self, commit_sha: str, review_comments: ReviewComments): + body = dict( + commit_id=commit_sha, + body=review_comments.body, + event="COMMENT", + comments=[ + { + "path": line_info.file_path, + "position": line_info.position, + "body": comment.body, + } + for line_info, comment in review_comments.comments.items() + ], + ) + log.info( + "Creating AI PR review", + extra=body, + ) + + async with self.torngit.get_client() as client: + res = await self.torngit.api( + client, + "post", + f"/repos/{self.torngit.slug}/pulls/{self.pullid}/reviews", + token=self.token, + body=body, + ) + return res + + async def update_comment(self, comment: Comment): + log.info( + "Updating comment", + extra=dict( + comment_id=comment.comment_id, + body=comment.body, + ), + ) + async with self.torngit.get_client() as client: + await self.torngit.api( + client, + "patch", + f"/repos/{self.torngit.slug}/pulls/comments/{comment.comment_id}", + token=self.token, + body=dict(body=comment.body), + ) + + +class Review: + def __init__( + self, pull_wrapper: PullWrapper, review_ids: Optional[List[int]] = None + ): + self.pull_wrapper = pull_wrapper + self.review_ids = review_ids or [] + self.diff = None + + async def perform(self) -> Optional[int]: + raw_diff = await self.pull_wrapper.fetch_diff() + self.diff = Diff(raw_diff) + + prompt = build_prompt(self.diff.preprocessed) + log.debug( + "OpenAI prompt", + extra=dict( + prompt=prompt, + ), + ) + + res = await fetch_openai_completion(prompt) + log.debug( + "OpenAI response", + extra=dict( + res=res, + ), + ) + + try: + data = json.loads(res) + except json.decoder.JSONDecodeError: + metrics.incr("ai_pr_review.non_json_completion") + log.error( + "OpenAI completion was expected to be JSON but wasn't", + extra=dict(res=res), + exc_info=True, + ) + return + + try: + review_comments = ReviewComments( + body=data["body"], + comments={ + self.diff.line_info(comment["line_id"]): Comment( + body=comment["body"] + ) + for comment in data["comments"] + }, + ) + except KeyError: + metrics.incr("ai_pr_review.malformed_completion") + log.error( + "OpenAI completion JSON was not formed as expected", + extra=dict(data=data), + exc_info=True, + ) + return + + if len(self.review_ids) > 0: + comments_to_update = [] + async for comment in self.pull_wrapper.fetch_review_comments(): + if not (comment["pull_request_review_id"] in self.review_ids): + continue + + line_info = LineInfo( + file_path=comment["path"], + position=comment["position"], + ) + if line_info in review_comments.comments: + # we have an existing comment on this line that we'll need + # to update instead of create + line_comment = review_comments.comments[line_info] + + # we'll update this existing comment + line_comment.comment_id = comment["id"] + comments_to_update.append(line_comment) + + # remove it from the current review comments since those will + # be posted as new comments + del review_comments.comments[line_info] + + for comment in comments_to_update: + await self.pull_wrapper.update_comment(comment) + + if len(review_comments.comments) > 0: + head_commit_sha = await self.pull_wrapper.fetch_head_sha() + if len(self.review_ids) > 0: + # we already made a top-level comment w/ summary of suggestions, + # this is more of a placeholder since we're obligated to pass a top-level + # comment when creating a new review + review_comments.body = ( + f"CodecovAI submitted a new review for {head_commit_sha}" + ) + res = await self.pull_wrapper.create_review( + head_commit_sha, review_comments + ) + return res["id"], head_commit_sha + + +async def perform_review(repository: Repository, pullid: int): + repository_service = get_repo_provider_service(repository) + pull_wrapper = PullWrapper(repository_service, pullid) + + archive = ArchiveService(repository) + archive_path = f"ai_pr_review/{archive.storage_hash}/pull_{pullid}.json" + + archive_data = None + try: + archive_data = archive.read_file(archive_path) + archive_data = json.loads(archive_data) + except FileNotInStorageError: + pass + + commit_sha = None + review_ids = [] + if archive_data is not None: + commit_sha = archive_data.get("commit_sha") + review_ids = archive_data.get("review_ids", []) + + head_sha = await pull_wrapper.fetch_head_sha() + if head_sha == commit_sha: + log.info( + "Review already performed on SHA", + extra=dict(sha=head_sha), + ) + return + + review = Review(pull_wrapper, review_ids=review_ids) + res = await review.perform() + if res is not None: + # we created a new review + review_id, commit_sha = res + review_ids.append(review_id) + + archive.write_file( + archive_path, + json.dumps( + { + "commit_sha": commit_sha, + "review_ids": review_ids, + } + ), + ) diff --git a/services/tests/cassetes/test_ai_pr_review/test_perform_duplicate_review.yaml b/services/tests/cassetes/test_ai_pr_review/test_perform_duplicate_review.yaml new file mode 100644 index 000000000..1663c434c --- /dev/null +++ b/services/tests/cassetes/test_ai_pr_review/test_perform_duplicate_review.yaml @@ -0,0 +1,85 @@ +interactions: +- request: + body: '' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + connection: + - keep-alive + host: + - api.github.com + user-agent: + - Default + method: GET + uri: https://api.github.com/repos/scott-codecov/codecov-test/pulls/40 + response: + content: '{"url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40","id":1609199716,"node_id":"PR_kwDOHO5Jtc5f6nBk","html_url":"https://github.com/scott-codecov/codecov-test/pull/40","diff_url":"https://github.com/scott-codecov/codecov-test/pull/40.diff","patch_url":"https://github.com/scott-codecov/codecov-test/pull/40.patch","issue_url":"https://api.github.com/repos/scott-codecov/codecov-test/issues/40","number":40,"state":"open","locked":false,"title":"Test + AI PR review","user":{"login":"scott-codecov","id":103445133,"node_id":"U_kgDOBipyjQ","avatar_url":"https://avatars.githubusercontent.com/u/103445133?v=4","gravatar_id":"","url":"https://api.github.com/users/scott-codecov","html_url":"https://github.com/scott-codecov","followers_url":"https://api.github.com/users/scott-codecov/followers","following_url":"https://api.github.com/users/scott-codecov/following{/other_user}","gists_url":"https://api.github.com/users/scott-codecov/gists{/gist_id}","starred_url":"https://api.github.com/users/scott-codecov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scott-codecov/subscriptions","organizations_url":"https://api.github.com/users/scott-codecov/orgs","repos_url":"https://api.github.com/users/scott-codecov/repos","events_url":"https://api.github.com/users/scott-codecov/events{/privacy}","received_events_url":"https://api.github.com/users/scott-codecov/received_events","type":"User","site_admin":false},"body":null,"created_at":"2023-11-20T14:17:17Z","updated_at":"2023-11-20T14:53:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"388cc84b5f6a167db13df1f139f4305e32f9f1eb","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"draft":false,"commits_url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40/commits","review_comments_url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40/comments","review_comment_url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scott-codecov/codecov-test/issues/40/comments","statuses_url":"https://api.github.com/repos/scott-codecov/codecov-test/statuses/b607bb0e17e1b8d8699272a26e32986a933f9946","head":{"label":"scott-codecov:scott-codecov-patch-3","ref":"scott-codecov-patch-3","sha":"b607bb0e17e1b8d8699272a26e32986a933f9946","user":{"login":"scott-codecov","id":103445133,"node_id":"U_kgDOBipyjQ","avatar_url":"https://avatars.githubusercontent.com/u/103445133?v=4","gravatar_id":"","url":"https://api.github.com/users/scott-codecov","html_url":"https://github.com/scott-codecov","followers_url":"https://api.github.com/users/scott-codecov/followers","following_url":"https://api.github.com/users/scott-codecov/following{/other_user}","gists_url":"https://api.github.com/users/scott-codecov/gists{/gist_id}","starred_url":"https://api.github.com/users/scott-codecov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scott-codecov/subscriptions","organizations_url":"https://api.github.com/users/scott-codecov/orgs","repos_url":"https://api.github.com/users/scott-codecov/repos","events_url":"https://api.github.com/users/scott-codecov/events{/privacy}","received_events_url":"https://api.github.com/users/scott-codecov/received_events","type":"User","site_admin":false},"repo":{"id":485378485,"node_id":"R_kgDOHO5JtQ","name":"codecov-test","full_name":"scott-codecov/codecov-test","private":true,"owner":{"login":"scott-codecov","id":103445133,"node_id":"U_kgDOBipyjQ","avatar_url":"https://avatars.githubusercontent.com/u/103445133?v=4","gravatar_id":"","url":"https://api.github.com/users/scott-codecov","html_url":"https://github.com/scott-codecov","followers_url":"https://api.github.com/users/scott-codecov/followers","following_url":"https://api.github.com/users/scott-codecov/following{/other_user}","gists_url":"https://api.github.com/users/scott-codecov/gists{/gist_id}","starred_url":"https://api.github.com/users/scott-codecov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scott-codecov/subscriptions","organizations_url":"https://api.github.com/users/scott-codecov/orgs","repos_url":"https://api.github.com/users/scott-codecov/repos","events_url":"https://api.github.com/users/scott-codecov/events{/privacy}","received_events_url":"https://api.github.com/users/scott-codecov/received_events","type":"User","site_admin":false},"html_url":"https://github.com/scott-codecov/codecov-test","description":null,"fork":false,"url":"https://api.github.com/repos/scott-codecov/codecov-test","forks_url":"https://api.github.com/repos/scott-codecov/codecov-test/forks","keys_url":"https://api.github.com/repos/scott-codecov/codecov-test/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scott-codecov/codecov-test/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scott-codecov/codecov-test/teams","hooks_url":"https://api.github.com/repos/scott-codecov/codecov-test/hooks","issue_events_url":"https://api.github.com/repos/scott-codecov/codecov-test/issues/events{/number}","events_url":"https://api.github.com/repos/scott-codecov/codecov-test/events","assignees_url":"https://api.github.com/repos/scott-codecov/codecov-test/assignees{/user}","branches_url":"https://api.github.com/repos/scott-codecov/codecov-test/branches{/branch}","tags_url":"https://api.github.com/repos/scott-codecov/codecov-test/tags","blobs_url":"https://api.github.com/repos/scott-codecov/codecov-test/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scott-codecov/codecov-test/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scott-codecov/codecov-test/git/refs{/sha}","trees_url":"https://api.github.com/repos/scott-codecov/codecov-test/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scott-codecov/codecov-test/statuses/{sha}","languages_url":"https://api.github.com/repos/scott-codecov/codecov-test/languages","stargazers_url":"https://api.github.com/repos/scott-codecov/codecov-test/stargazers","contributors_url":"https://api.github.com/repos/scott-codecov/codecov-test/contributors","subscribers_url":"https://api.github.com/repos/scott-codecov/codecov-test/subscribers","subscription_url":"https://api.github.com/repos/scott-codecov/codecov-test/subscription","commits_url":"https://api.github.com/repos/scott-codecov/codecov-test/commits{/sha}","git_commits_url":"https://api.github.com/repos/scott-codecov/codecov-test/git/commits{/sha}","comments_url":"https://api.github.com/repos/scott-codecov/codecov-test/comments{/number}","issue_comment_url":"https://api.github.com/repos/scott-codecov/codecov-test/issues/comments{/number}","contents_url":"https://api.github.com/repos/scott-codecov/codecov-test/contents/{+path}","compare_url":"https://api.github.com/repos/scott-codecov/codecov-test/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scott-codecov/codecov-test/merges","archive_url":"https://api.github.com/repos/scott-codecov/codecov-test/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scott-codecov/codecov-test/downloads","issues_url":"https://api.github.com/repos/scott-codecov/codecov-test/issues{/number}","pulls_url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls{/number}","milestones_url":"https://api.github.com/repos/scott-codecov/codecov-test/milestones{/number}","notifications_url":"https://api.github.com/repos/scott-codecov/codecov-test/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scott-codecov/codecov-test/labels{/name}","releases_url":"https://api.github.com/repos/scott-codecov/codecov-test/releases{/id}","deployments_url":"https://api.github.com/repos/scott-codecov/codecov-test/deployments","created_at":"2022-04-25T13:15:44Z","updated_at":"2022-04-29T10:48:46Z","pushed_at":"2023-11-20T14:17:18Z","git_url":"git://github.com/scott-codecov/codecov-test.git","ssh_url":"git@github.com:scott-codecov/codecov-test.git","clone_url":"https://github.com/scott-codecov/codecov-test.git","svn_url":"https://github.com/scott-codecov/codecov-test","homepage":null,"size":239,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"has_discussions":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":14,"license":null,"allow_forking":true,"is_template":false,"web_commit_signoff_required":false,"topics":[],"visibility":"private","forks":0,"open_issues":14,"watchers":0,"default_branch":"master"}},"base":{"label":"scott-codecov:master","ref":"master","sha":"ece177a1e98a568a5428751b21e9c2530ab16927","user":{"login":"scott-codecov","id":103445133,"node_id":"U_kgDOBipyjQ","avatar_url":"https://avatars.githubusercontent.com/u/103445133?v=4","gravatar_id":"","url":"https://api.github.com/users/scott-codecov","html_url":"https://github.com/scott-codecov","followers_url":"https://api.github.com/users/scott-codecov/followers","following_url":"https://api.github.com/users/scott-codecov/following{/other_user}","gists_url":"https://api.github.com/users/scott-codecov/gists{/gist_id}","starred_url":"https://api.github.com/users/scott-codecov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scott-codecov/subscriptions","organizations_url":"https://api.github.com/users/scott-codecov/orgs","repos_url":"https://api.github.com/users/scott-codecov/repos","events_url":"https://api.github.com/users/scott-codecov/events{/privacy}","received_events_url":"https://api.github.com/users/scott-codecov/received_events","type":"User","site_admin":false},"repo":{"id":485378485,"node_id":"R_kgDOHO5JtQ","name":"codecov-test","full_name":"scott-codecov/codecov-test","private":true,"owner":{"login":"scott-codecov","id":103445133,"node_id":"U_kgDOBipyjQ","avatar_url":"https://avatars.githubusercontent.com/u/103445133?v=4","gravatar_id":"","url":"https://api.github.com/users/scott-codecov","html_url":"https://github.com/scott-codecov","followers_url":"https://api.github.com/users/scott-codecov/followers","following_url":"https://api.github.com/users/scott-codecov/following{/other_user}","gists_url":"https://api.github.com/users/scott-codecov/gists{/gist_id}","starred_url":"https://api.github.com/users/scott-codecov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scott-codecov/subscriptions","organizations_url":"https://api.github.com/users/scott-codecov/orgs","repos_url":"https://api.github.com/users/scott-codecov/repos","events_url":"https://api.github.com/users/scott-codecov/events{/privacy}","received_events_url":"https://api.github.com/users/scott-codecov/received_events","type":"User","site_admin":false},"html_url":"https://github.com/scott-codecov/codecov-test","description":null,"fork":false,"url":"https://api.github.com/repos/scott-codecov/codecov-test","forks_url":"https://api.github.com/repos/scott-codecov/codecov-test/forks","keys_url":"https://api.github.com/repos/scott-codecov/codecov-test/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scott-codecov/codecov-test/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scott-codecov/codecov-test/teams","hooks_url":"https://api.github.com/repos/scott-codecov/codecov-test/hooks","issue_events_url":"https://api.github.com/repos/scott-codecov/codecov-test/issues/events{/number}","events_url":"https://api.github.com/repos/scott-codecov/codecov-test/events","assignees_url":"https://api.github.com/repos/scott-codecov/codecov-test/assignees{/user}","branches_url":"https://api.github.com/repos/scott-codecov/codecov-test/branches{/branch}","tags_url":"https://api.github.com/repos/scott-codecov/codecov-test/tags","blobs_url":"https://api.github.com/repos/scott-codecov/codecov-test/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scott-codecov/codecov-test/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scott-codecov/codecov-test/git/refs{/sha}","trees_url":"https://api.github.com/repos/scott-codecov/codecov-test/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scott-codecov/codecov-test/statuses/{sha}","languages_url":"https://api.github.com/repos/scott-codecov/codecov-test/languages","stargazers_url":"https://api.github.com/repos/scott-codecov/codecov-test/stargazers","contributors_url":"https://api.github.com/repos/scott-codecov/codecov-test/contributors","subscribers_url":"https://api.github.com/repos/scott-codecov/codecov-test/subscribers","subscription_url":"https://api.github.com/repos/scott-codecov/codecov-test/subscription","commits_url":"https://api.github.com/repos/scott-codecov/codecov-test/commits{/sha}","git_commits_url":"https://api.github.com/repos/scott-codecov/codecov-test/git/commits{/sha}","comments_url":"https://api.github.com/repos/scott-codecov/codecov-test/comments{/number}","issue_comment_url":"https://api.github.com/repos/scott-codecov/codecov-test/issues/comments{/number}","contents_url":"https://api.github.com/repos/scott-codecov/codecov-test/contents/{+path}","compare_url":"https://api.github.com/repos/scott-codecov/codecov-test/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scott-codecov/codecov-test/merges","archive_url":"https://api.github.com/repos/scott-codecov/codecov-test/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scott-codecov/codecov-test/downloads","issues_url":"https://api.github.com/repos/scott-codecov/codecov-test/issues{/number}","pulls_url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls{/number}","milestones_url":"https://api.github.com/repos/scott-codecov/codecov-test/milestones{/number}","notifications_url":"https://api.github.com/repos/scott-codecov/codecov-test/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scott-codecov/codecov-test/labels{/name}","releases_url":"https://api.github.com/repos/scott-codecov/codecov-test/releases{/id}","deployments_url":"https://api.github.com/repos/scott-codecov/codecov-test/deployments","created_at":"2022-04-25T13:15:44Z","updated_at":"2022-04-29T10:48:46Z","pushed_at":"2023-11-20T14:17:18Z","git_url":"git://github.com/scott-codecov/codecov-test.git","ssh_url":"git@github.com:scott-codecov/codecov-test.git","clone_url":"https://github.com/scott-codecov/codecov-test.git","svn_url":"https://github.com/scott-codecov/codecov-test","homepage":null,"size":239,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"has_discussions":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":14,"license":null,"allow_forking":true,"is_template":false,"web_commit_signoff_required":false,"topics":[],"visibility":"private","forks":0,"open_issues":14,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40"},"html":{"href":"https://github.com/scott-codecov/codecov-test/pull/40"},"issue":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/issues/40"},"comments":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/issues/40/comments"},"review_comments":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40/comments"},"review_comment":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40/commits"},"statuses":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/statuses/b607bb0e17e1b8d8699272a26e32986a933f9946"}},"author_association":"OWNER","auto_merge":null,"active_lock_reason":null,"merged":false,"mergeable":true,"rebaseable":true,"mergeable_state":"unstable","merged_by":null,"comments":0,"review_comments":16,"maintainer_can_modify":false,"commits":1,"additions":2,"deletions":11,"changed_files":1}' + headers: + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, + X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, + X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, + X-GitHub-Request-Id, Deprecation, Sunset + Cache-Control: + - private, max-age=60, s-maxage=60 + Content-Encoding: + - gzip + Content-Security-Policy: + - default-src 'none' + Content-Type: + - application/json; charset=utf-8 + Date: + - Mon, 20 Nov 2023 14:53:56 GMT + ETag: + - W/"e23f5a9033ae5e1901f888c916718b425573074a64aebd9178c14b0f2f106cc4" + Last-Modified: + - Mon, 20 Nov 2023 14:53:55 GMT + Referrer-Policy: + - origin-when-cross-origin, strict-origin-when-cross-origin + Server: + - GitHub.com + Strict-Transport-Security: + - max-age=31536000; includeSubdomains; preload + Transfer-Encoding: + - chunked + Vary: + - Accept, Authorization, Cookie, X-GitHub-OTP + - Accept-Encoding, Accept, X-Requested-With + X-Accepted-OAuth-Scopes: + - '' + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + X-GitHub-Media-Type: + - github.v3 + X-GitHub-Request-Id: + - FA13:7260:467D957:9373AB6:655B7304 + X-OAuth-Scopes: + - '' + X-RateLimit-Limit: + - '5000' + X-RateLimit-Remaining: + - '4988' + X-RateLimit-Reset: + - '1700494278' + X-RateLimit-Resource: + - core + X-RateLimit-Used: + - '12' + X-XSS-Protection: + - '0' + x-accepted-github-permissions: + - pull_requests=read; contents=read + x-github-api-version-selected: + - '2022-11-28' + x-oauth-client-id: + - Iv1.88e0c58abd4e2e45 + http_version: HTTP/1.1 + status_code: 200 +version: 1 diff --git a/services/tests/cassetes/test_ai_pr_review/test_perform_initial_review.yaml b/services/tests/cassetes/test_ai_pr_review/test_perform_initial_review.yaml new file mode 100644 index 000000000..b7b618a19 --- /dev/null +++ b/services/tests/cassetes/test_ai_pr_review/test_perform_initial_review.yaml @@ -0,0 +1,423 @@ +interactions: +- request: + body: '' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + connection: + - keep-alive + host: + - api.github.com + user-agent: + - Default + method: GET + uri: https://api.github.com/repos/scott-codecov/codecov-test/pulls/40 + response: + content: '{"url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40","id":1609199716,"node_id":"PR_kwDOHO5Jtc5f6nBk","html_url":"https://github.com/scott-codecov/codecov-test/pull/40","diff_url":"https://github.com/scott-codecov/codecov-test/pull/40.diff","patch_url":"https://github.com/scott-codecov/codecov-test/pull/40.patch","issue_url":"https://api.github.com/repos/scott-codecov/codecov-test/issues/40","number":40,"state":"open","locked":false,"title":"Test + AI PR review","user":{"login":"scott-codecov","id":103445133,"node_id":"U_kgDOBipyjQ","avatar_url":"https://avatars.githubusercontent.com/u/103445133?v=4","gravatar_id":"","url":"https://api.github.com/users/scott-codecov","html_url":"https://github.com/scott-codecov","followers_url":"https://api.github.com/users/scott-codecov/followers","following_url":"https://api.github.com/users/scott-codecov/following{/other_user}","gists_url":"https://api.github.com/users/scott-codecov/gists{/gist_id}","starred_url":"https://api.github.com/users/scott-codecov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scott-codecov/subscriptions","organizations_url":"https://api.github.com/users/scott-codecov/orgs","repos_url":"https://api.github.com/users/scott-codecov/repos","events_url":"https://api.github.com/users/scott-codecov/events{/privacy}","received_events_url":"https://api.github.com/users/scott-codecov/received_events","type":"User","site_admin":false},"body":null,"created_at":"2023-11-20T14:17:17Z","updated_at":"2023-11-20T14:53:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"388cc84b5f6a167db13df1f139f4305e32f9f1eb","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"draft":false,"commits_url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40/commits","review_comments_url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40/comments","review_comment_url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scott-codecov/codecov-test/issues/40/comments","statuses_url":"https://api.github.com/repos/scott-codecov/codecov-test/statuses/b607bb0e17e1b8d8699272a26e32986a933f9946","head":{"label":"scott-codecov:scott-codecov-patch-3","ref":"scott-codecov-patch-3","sha":"b607bb0e17e1b8d8699272a26e32986a933f9946","user":{"login":"scott-codecov","id":103445133,"node_id":"U_kgDOBipyjQ","avatar_url":"https://avatars.githubusercontent.com/u/103445133?v=4","gravatar_id":"","url":"https://api.github.com/users/scott-codecov","html_url":"https://github.com/scott-codecov","followers_url":"https://api.github.com/users/scott-codecov/followers","following_url":"https://api.github.com/users/scott-codecov/following{/other_user}","gists_url":"https://api.github.com/users/scott-codecov/gists{/gist_id}","starred_url":"https://api.github.com/users/scott-codecov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scott-codecov/subscriptions","organizations_url":"https://api.github.com/users/scott-codecov/orgs","repos_url":"https://api.github.com/users/scott-codecov/repos","events_url":"https://api.github.com/users/scott-codecov/events{/privacy}","received_events_url":"https://api.github.com/users/scott-codecov/received_events","type":"User","site_admin":false},"repo":{"id":485378485,"node_id":"R_kgDOHO5JtQ","name":"codecov-test","full_name":"scott-codecov/codecov-test","private":true,"owner":{"login":"scott-codecov","id":103445133,"node_id":"U_kgDOBipyjQ","avatar_url":"https://avatars.githubusercontent.com/u/103445133?v=4","gravatar_id":"","url":"https://api.github.com/users/scott-codecov","html_url":"https://github.com/scott-codecov","followers_url":"https://api.github.com/users/scott-codecov/followers","following_url":"https://api.github.com/users/scott-codecov/following{/other_user}","gists_url":"https://api.github.com/users/scott-codecov/gists{/gist_id}","starred_url":"https://api.github.com/users/scott-codecov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scott-codecov/subscriptions","organizations_url":"https://api.github.com/users/scott-codecov/orgs","repos_url":"https://api.github.com/users/scott-codecov/repos","events_url":"https://api.github.com/users/scott-codecov/events{/privacy}","received_events_url":"https://api.github.com/users/scott-codecov/received_events","type":"User","site_admin":false},"html_url":"https://github.com/scott-codecov/codecov-test","description":null,"fork":false,"url":"https://api.github.com/repos/scott-codecov/codecov-test","forks_url":"https://api.github.com/repos/scott-codecov/codecov-test/forks","keys_url":"https://api.github.com/repos/scott-codecov/codecov-test/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scott-codecov/codecov-test/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scott-codecov/codecov-test/teams","hooks_url":"https://api.github.com/repos/scott-codecov/codecov-test/hooks","issue_events_url":"https://api.github.com/repos/scott-codecov/codecov-test/issues/events{/number}","events_url":"https://api.github.com/repos/scott-codecov/codecov-test/events","assignees_url":"https://api.github.com/repos/scott-codecov/codecov-test/assignees{/user}","branches_url":"https://api.github.com/repos/scott-codecov/codecov-test/branches{/branch}","tags_url":"https://api.github.com/repos/scott-codecov/codecov-test/tags","blobs_url":"https://api.github.com/repos/scott-codecov/codecov-test/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scott-codecov/codecov-test/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scott-codecov/codecov-test/git/refs{/sha}","trees_url":"https://api.github.com/repos/scott-codecov/codecov-test/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scott-codecov/codecov-test/statuses/{sha}","languages_url":"https://api.github.com/repos/scott-codecov/codecov-test/languages","stargazers_url":"https://api.github.com/repos/scott-codecov/codecov-test/stargazers","contributors_url":"https://api.github.com/repos/scott-codecov/codecov-test/contributors","subscribers_url":"https://api.github.com/repos/scott-codecov/codecov-test/subscribers","subscription_url":"https://api.github.com/repos/scott-codecov/codecov-test/subscription","commits_url":"https://api.github.com/repos/scott-codecov/codecov-test/commits{/sha}","git_commits_url":"https://api.github.com/repos/scott-codecov/codecov-test/git/commits{/sha}","comments_url":"https://api.github.com/repos/scott-codecov/codecov-test/comments{/number}","issue_comment_url":"https://api.github.com/repos/scott-codecov/codecov-test/issues/comments{/number}","contents_url":"https://api.github.com/repos/scott-codecov/codecov-test/contents/{+path}","compare_url":"https://api.github.com/repos/scott-codecov/codecov-test/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scott-codecov/codecov-test/merges","archive_url":"https://api.github.com/repos/scott-codecov/codecov-test/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scott-codecov/codecov-test/downloads","issues_url":"https://api.github.com/repos/scott-codecov/codecov-test/issues{/number}","pulls_url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls{/number}","milestones_url":"https://api.github.com/repos/scott-codecov/codecov-test/milestones{/number}","notifications_url":"https://api.github.com/repos/scott-codecov/codecov-test/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scott-codecov/codecov-test/labels{/name}","releases_url":"https://api.github.com/repos/scott-codecov/codecov-test/releases{/id}","deployments_url":"https://api.github.com/repos/scott-codecov/codecov-test/deployments","created_at":"2022-04-25T13:15:44Z","updated_at":"2022-04-29T10:48:46Z","pushed_at":"2023-11-20T14:17:18Z","git_url":"git://github.com/scott-codecov/codecov-test.git","ssh_url":"git@github.com:scott-codecov/codecov-test.git","clone_url":"https://github.com/scott-codecov/codecov-test.git","svn_url":"https://github.com/scott-codecov/codecov-test","homepage":null,"size":239,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"has_discussions":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":14,"license":null,"allow_forking":true,"is_template":false,"web_commit_signoff_required":false,"topics":[],"visibility":"private","forks":0,"open_issues":14,"watchers":0,"default_branch":"master"}},"base":{"label":"scott-codecov:master","ref":"master","sha":"ece177a1e98a568a5428751b21e9c2530ab16927","user":{"login":"scott-codecov","id":103445133,"node_id":"U_kgDOBipyjQ","avatar_url":"https://avatars.githubusercontent.com/u/103445133?v=4","gravatar_id":"","url":"https://api.github.com/users/scott-codecov","html_url":"https://github.com/scott-codecov","followers_url":"https://api.github.com/users/scott-codecov/followers","following_url":"https://api.github.com/users/scott-codecov/following{/other_user}","gists_url":"https://api.github.com/users/scott-codecov/gists{/gist_id}","starred_url":"https://api.github.com/users/scott-codecov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scott-codecov/subscriptions","organizations_url":"https://api.github.com/users/scott-codecov/orgs","repos_url":"https://api.github.com/users/scott-codecov/repos","events_url":"https://api.github.com/users/scott-codecov/events{/privacy}","received_events_url":"https://api.github.com/users/scott-codecov/received_events","type":"User","site_admin":false},"repo":{"id":485378485,"node_id":"R_kgDOHO5JtQ","name":"codecov-test","full_name":"scott-codecov/codecov-test","private":true,"owner":{"login":"scott-codecov","id":103445133,"node_id":"U_kgDOBipyjQ","avatar_url":"https://avatars.githubusercontent.com/u/103445133?v=4","gravatar_id":"","url":"https://api.github.com/users/scott-codecov","html_url":"https://github.com/scott-codecov","followers_url":"https://api.github.com/users/scott-codecov/followers","following_url":"https://api.github.com/users/scott-codecov/following{/other_user}","gists_url":"https://api.github.com/users/scott-codecov/gists{/gist_id}","starred_url":"https://api.github.com/users/scott-codecov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scott-codecov/subscriptions","organizations_url":"https://api.github.com/users/scott-codecov/orgs","repos_url":"https://api.github.com/users/scott-codecov/repos","events_url":"https://api.github.com/users/scott-codecov/events{/privacy}","received_events_url":"https://api.github.com/users/scott-codecov/received_events","type":"User","site_admin":false},"html_url":"https://github.com/scott-codecov/codecov-test","description":null,"fork":false,"url":"https://api.github.com/repos/scott-codecov/codecov-test","forks_url":"https://api.github.com/repos/scott-codecov/codecov-test/forks","keys_url":"https://api.github.com/repos/scott-codecov/codecov-test/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scott-codecov/codecov-test/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scott-codecov/codecov-test/teams","hooks_url":"https://api.github.com/repos/scott-codecov/codecov-test/hooks","issue_events_url":"https://api.github.com/repos/scott-codecov/codecov-test/issues/events{/number}","events_url":"https://api.github.com/repos/scott-codecov/codecov-test/events","assignees_url":"https://api.github.com/repos/scott-codecov/codecov-test/assignees{/user}","branches_url":"https://api.github.com/repos/scott-codecov/codecov-test/branches{/branch}","tags_url":"https://api.github.com/repos/scott-codecov/codecov-test/tags","blobs_url":"https://api.github.com/repos/scott-codecov/codecov-test/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scott-codecov/codecov-test/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scott-codecov/codecov-test/git/refs{/sha}","trees_url":"https://api.github.com/repos/scott-codecov/codecov-test/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scott-codecov/codecov-test/statuses/{sha}","languages_url":"https://api.github.com/repos/scott-codecov/codecov-test/languages","stargazers_url":"https://api.github.com/repos/scott-codecov/codecov-test/stargazers","contributors_url":"https://api.github.com/repos/scott-codecov/codecov-test/contributors","subscribers_url":"https://api.github.com/repos/scott-codecov/codecov-test/subscribers","subscription_url":"https://api.github.com/repos/scott-codecov/codecov-test/subscription","commits_url":"https://api.github.com/repos/scott-codecov/codecov-test/commits{/sha}","git_commits_url":"https://api.github.com/repos/scott-codecov/codecov-test/git/commits{/sha}","comments_url":"https://api.github.com/repos/scott-codecov/codecov-test/comments{/number}","issue_comment_url":"https://api.github.com/repos/scott-codecov/codecov-test/issues/comments{/number}","contents_url":"https://api.github.com/repos/scott-codecov/codecov-test/contents/{+path}","compare_url":"https://api.github.com/repos/scott-codecov/codecov-test/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scott-codecov/codecov-test/merges","archive_url":"https://api.github.com/repos/scott-codecov/codecov-test/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scott-codecov/codecov-test/downloads","issues_url":"https://api.github.com/repos/scott-codecov/codecov-test/issues{/number}","pulls_url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls{/number}","milestones_url":"https://api.github.com/repos/scott-codecov/codecov-test/milestones{/number}","notifications_url":"https://api.github.com/repos/scott-codecov/codecov-test/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scott-codecov/codecov-test/labels{/name}","releases_url":"https://api.github.com/repos/scott-codecov/codecov-test/releases{/id}","deployments_url":"https://api.github.com/repos/scott-codecov/codecov-test/deployments","created_at":"2022-04-25T13:15:44Z","updated_at":"2022-04-29T10:48:46Z","pushed_at":"2023-11-20T14:17:18Z","git_url":"git://github.com/scott-codecov/codecov-test.git","ssh_url":"git@github.com:scott-codecov/codecov-test.git","clone_url":"https://github.com/scott-codecov/codecov-test.git","svn_url":"https://github.com/scott-codecov/codecov-test","homepage":null,"size":239,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"has_discussions":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":14,"license":null,"allow_forking":true,"is_template":false,"web_commit_signoff_required":false,"topics":[],"visibility":"private","forks":0,"open_issues":14,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40"},"html":{"href":"https://github.com/scott-codecov/codecov-test/pull/40"},"issue":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/issues/40"},"comments":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/issues/40/comments"},"review_comments":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40/comments"},"review_comment":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40/commits"},"statuses":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/statuses/b607bb0e17e1b8d8699272a26e32986a933f9946"}},"author_association":"OWNER","auto_merge":null,"active_lock_reason":null,"merged":false,"mergeable":true,"rebaseable":true,"mergeable_state":"unstable","merged_by":null,"comments":0,"review_comments":11,"maintainer_can_modify":false,"commits":1,"additions":2,"deletions":11,"changed_files":1}' + headers: + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, + X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, + X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, + X-GitHub-Request-Id, Deprecation, Sunset + Cache-Control: + - private, max-age=60, s-maxage=60 + Content-Encoding: + - gzip + Content-Security-Policy: + - default-src 'none' + Content-Type: + - application/json; charset=utf-8 + Date: + - Mon, 20 Nov 2023 14:53:24 GMT + ETag: + - W/"74fefe96f3867526ebe69e6a7c81a7fb7a083dffa1d84305d52b6d847c07f9ae" + Last-Modified: + - Mon, 20 Nov 2023 14:53:19 GMT + Referrer-Policy: + - origin-when-cross-origin, strict-origin-when-cross-origin + Server: + - GitHub.com + Strict-Transport-Security: + - max-age=31536000; includeSubdomains; preload + Transfer-Encoding: + - chunked + Vary: + - Accept, Authorization, Cookie, X-GitHub-OTP + - Accept-Encoding, Accept, X-Requested-With + X-Accepted-OAuth-Scopes: + - '' + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + X-GitHub-Media-Type: + - github.v3 + X-GitHub-Request-Id: + - FA0B:6556:2F15AFC:62B3653:655B72E4 + X-OAuth-Scopes: + - '' + X-RateLimit-Limit: + - '5000' + X-RateLimit-Remaining: + - '4991' + X-RateLimit-Reset: + - '1700494278' + X-RateLimit-Resource: + - core + X-RateLimit-Used: + - '9' + X-XSS-Protection: + - '0' + x-accepted-github-permissions: + - pull_requests=read; contents=read + x-github-api-version-selected: + - '2022-11-28' + x-oauth-client-id: + - Iv1.88e0c58abd4e2e45 + http_version: HTTP/1.1 + status_code: 200 +- request: + body: '' + headers: + accept: + - application/vnd.github.v3.diff + accept-encoding: + - gzip, deflate + connection: + - keep-alive + host: + - api.github.com + user-agent: + - Default + method: GET + uri: https://api.github.com/repos/scott-codecov/codecov-test/pulls/40 + response: + content: "diff --git a/main/foo.py b/main/foo.py\nindex 9d285a4..41d8fd2 100644\n--- + a/main/foo.py\n+++ b/main/foo.py\n@@ -54,14 +54,5 @@ def mul4(x, y):\n def div4(x, + y):\n return x / y\n \n-def add5(x, y):\n- return x + y\n-\n-def sub5(x, + y):\n- return x - y\n-\n-def mul5(x, y):\n- return x * y\n-\n-def div5(x, + y):\n- return x / y\n+def testing(x, y):\n+ return x % y\n" + headers: + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, + X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, + X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, + X-GitHub-Request-Id, Deprecation, Sunset + Cache-Control: + - private, max-age=60, s-maxage=60 + Content-Length: + - '361' + Content-Security-Policy: + - default-src 'none' + Content-Type: + - application/vnd.github.v3.diff; charset=utf-8 + Date: + - Mon, 20 Nov 2023 14:53:24 GMT + ETag: + - '"668db0d87533fcf3c5093eb6ece232b132b2186efa5bb068a5b1616c422cd009"' + Last-Modified: + - Mon, 20 Nov 2023 14:53:19 GMT + Referrer-Policy: + - origin-when-cross-origin, strict-origin-when-cross-origin + Server: + - GitHub.com + Strict-Transport-Security: + - max-age=31536000; includeSubdomains; preload + Vary: + - Accept, Authorization, Cookie, X-GitHub-OTP + - Accept-Encoding, Accept, X-Requested-With + X-Accepted-OAuth-Scopes: + - '' + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + X-GitHub-Media-Type: + - github.v3; param=diff + X-GitHub-Request-Id: + - FA0C:1ABD:41426D6:88D917B:655B72E4 + X-OAuth-Scopes: + - '' + X-RateLimit-Limit: + - '5000' + X-RateLimit-Remaining: + - '4990' + X-RateLimit-Reset: + - '1700494278' + X-RateLimit-Resource: + - core + X-RateLimit-Used: + - '10' + X-XSS-Protection: + - '0' + x-accepted-github-permissions: + - pull_requests=read; contents=read + x-github-api-version-selected: + - '2022-11-28' + x-oauth-client-id: + - Iv1.88e0c58abd4e2e45 + http_version: HTTP/1.1 + status_code: 200 +- request: + body: '{"messages": [{"role": "user", "content": "\n Your purpose is to + act as a highly experienced software engineer and provide a thorough\n review + of code changes and suggest improvements. Do not comment on minor style issues,\n missing + comments or documentation. Identify and resolve significant concerns to improve\n overall + code quality.\n\n You will receive a Git diff where each line has been + prefixed with a unique identifer in\n square brackets. When referencing + lines in this diff use that identifier.\n\n Format your output as JSON + such that there is 1 top-level comment that summarizes your review\n and + multiple additional comments addressing specific lines in the code with the + changes you\n deem appropriate.\n\n The output should have this + JSON form:\n\n {\n \"body\": \"This is the summary comment\",\n \"comments\": + [\n {\n \"line_id\": 123,\n \"body\": + \"This is a comment about the code with line ID 123\",\n }\n ]\n }\n\n Limit + the number of comments to 10 at most.\n\n Here is the Git diff on which + you should base your review:\n\n [1] diff --git a/main/foo.py b/main/foo.py\n[2] + index 9d285a4..41d8fd2 100644\n[3] --- a/main/foo.py\n[4] +++ b/main/foo.py\n[5] + @@ -54,14 +54,5 @@ def mul4(x, y):\n[6] def div4(x, y):\n[7] return x + / y\n[8] \n[9] -def add5(x, y):\n[10] - return x + y\n[11] -\n[12] -def + sub5(x, y):\n[13] - return x - y\n[14] -\n[15] -def mul5(x, y):\n[16] - return + x * y\n[17] -\n[18] -def div5(x, y):\n[19] - return x / y\n[20] +def testing(x, + y):\n[21] + return x % y\n[22] \n "}], "model": "gpt-4"}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '1768' + content-type: + - application/json + host: + - api.openai.com + user-agent: + - AsyncOpenAI/Python 1.2.4 + x-stainless-arch: + - arm64 + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.2.4 + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.10.8 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + content: "{\n \"id\": \"chatcmpl-8MzwL6ONjJUzs3j8bTnWnwrwSsIze\",\n \"object\": + \"chat.completion\",\n \"created\": 1700492005,\n \"model\": \"gpt-4-0613\",\n + \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": + \"assistant\",\n \"content\": \"{\\n \\\"body\\\": \\\"The code quality + seems decent overall, but there are some significant concerns. Specifically, + the removal of the add5, sub5, mul5 and div5 functions and replacing them with + a testing function. Unless there is a specific reason for removing these functions + they should be kept as they may be used elsewhere in the codebase which would + lead to a lack of functionality and potential runtime exceptions. Also, the + 'testing' function is not appropriately named for what it does, it seems to + return the modulus of two numbers which isn't related to testing.\\\",\\n \\\"comments\\\": + [\\n {\\n \\\"line_id\\\": 9,\\n \\\"body\\\": + \\\"It looks like you've removed the add5 method. If this is being used elsewhere + in the codebase then its removal could cause issues. Please ensure that this + method isn't being used elsewhere before removal.\\\"\\n },\\n {\\n + \ \\\"line_id\\\": 12,\\n \\\"body\\\": \\\"You've removed + the sub5 method. Like with the add5 method, make sure that it's not being used + in other places in the codebase which could cause runtime issues.\\\"\\n },\\n + \ {\\n \\\"line_id\\\": 15,\\n \\\"body\\\": \\\"The + mul5 method has been removed. If it is used elsewhere, this could cause potential + problems. Validate it before deleting.\\\"\\n },\\n {\\n \\\"line_id\\\": + 18,\\n \\\"body\\\": \\\"You've also removed div5, again ensure it's + not being used anywhere else to prevent bugs and exceptions.\\\"\\n },\\n + \ {\\n \\\"line_id\\\": 20,\\n \\\"body\\\": \\\"This + new 'testing' function's name is not descriptive of its functionality. It looks + like it's performing a modulus operation, not testing. You should name this + function appropriately.\\\"\\n }\\n ]\\n}\"\n },\n \"finish_reason\": + \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 444,\n \"completion_tokens\": + 367,\n \"total_tokens\": 811\n }\n}\n" + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 829185b7fb102a90-ORD + Cache-Control: + - no-cache, must-revalidate + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Mon, 20 Nov 2023 14:53:53 GMT + Server: + - cloudflare + Set-Cookie: + - __cf_bm=p_3yp63VzSuwNk5.CA3kl8plTqNo8Hsb5QI1YsAr49w-1700492033-0-Ad4nyXhgxgh+XWx3krcrQYQDz60XLTGB/pE0rpbMGIfUx6RqaXdois1+sqtQE3hId9RlIm5JbkS6pRJvSBgzNzg=; + path=/; expires=Mon, 20-Nov-23 15:23:53 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=W0ReQkot08PZyftr5njoOXMmrUcFDwE6ERJG0iJwwjk-1700492033848-0-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Transfer-Encoding: + - chunked + access-control-allow-origin: + - '*' + alt-svc: + - h3=":443"; ma=86400 + openai-model: + - gpt-4-0613 + openai-organization: + - functional-software + openai-processing-ms: + - '28368' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=15724800; includeSubDomains + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '300000' + x-ratelimit-limit-tokens_usage_based: + - '300000' + x-ratelimit-remaining-requests: + - '9999' + x-ratelimit-remaining-tokens: + - '299573' + x-ratelimit-remaining-tokens_usage_based: + - '299573' + x-ratelimit-reset-requests: + - 6ms + x-ratelimit-reset-tokens: + - 85ms + x-ratelimit-reset-tokens_usage_based: + - 85ms + x-request-id: + - b4e74fa8a6f29812879968b0cc0b693a + http_version: HTTP/1.1 + status_code: 200 +- request: + body: '{"commit_id": "b607bb0e17e1b8d8699272a26e32986a933f9946", "body": "The + code quality seems decent overall, but there are some significant concerns. + Specifically, the removal of the add5, sub5, mul5 and div5 functions and replacing + them with a testing function. Unless there is a specific reason for removing + these functions they should be kept as they may be used elsewhere in the codebase + which would lead to a lack of functionality and potential runtime exceptions. + Also, the ''testing'' function is not appropriately named for what it does, + it seems to return the modulus of two numbers which isn''t related to testing.", + "event": "COMMENT", "comments": [{"path": "main/foo.py", "position": 4, "body": + "It looks like you''ve removed the add5 method. If this is being used elsewhere + in the codebase then its removal could cause issues. Please ensure that this + method isn''t being used elsewhere before removal."}, {"path": "main/foo.py", + "position": 7, "body": "You''ve removed the sub5 method. Like with the add5 + method, make sure that it''s not being used in other places in the codebase + which could cause runtime issues."}, {"path": "main/foo.py", "position": 10, + "body": "The mul5 method has been removed. If it is used elsewhere, this could + cause potential problems. Validate it before deleting."}, {"path": "main/foo.py", + "position": 13, "body": "You''ve also removed div5, again ensure it''s not being + used anywhere else to prevent bugs and exceptions."}, {"path": "main/foo.py", + "position": 15, "body": "This new ''testing'' function''s name is not descriptive + of its functionality. It looks like it''s performing a modulus operation, not + testing. You should name this function appropriately."}]}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '1692' + content-type: + - application/json + host: + - api.github.com + user-agent: + - Default + method: POST + uri: https://api.github.com/repos/scott-codecov/codecov-test/pulls/40/reviews + response: + content: '{"id":1740008775,"node_id":"PRR_kwDOHO5Jtc5ntm1H","user":{"login":"scott-codecov","id":103445133,"node_id":"U_kgDOBipyjQ","avatar_url":"https://avatars.githubusercontent.com/u/103445133?u=1ea5f79283a26325f56e7cfa9eaca5cff3d538a4&v=4","gravatar_id":"","url":"https://api.github.com/users/scott-codecov","html_url":"https://github.com/scott-codecov","followers_url":"https://api.github.com/users/scott-codecov/followers","following_url":"https://api.github.com/users/scott-codecov/following{/other_user}","gists_url":"https://api.github.com/users/scott-codecov/gists{/gist_id}","starred_url":"https://api.github.com/users/scott-codecov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scott-codecov/subscriptions","organizations_url":"https://api.github.com/users/scott-codecov/orgs","repos_url":"https://api.github.com/users/scott-codecov/repos","events_url":"https://api.github.com/users/scott-codecov/events{/privacy}","received_events_url":"https://api.github.com/users/scott-codecov/received_events","type":"User","site_admin":false},"body":"The + code quality seems decent overall, but there are some significant concerns. + Specifically, the removal of the add5, sub5, mul5 and div5 functions and replacing + them with a testing function. Unless there is a specific reason for removing + these functions they should be kept as they may be used elsewhere in the codebase + which would lead to a lack of functionality and potential runtime exceptions. + Also, the ''testing'' function is not appropriately named for what it does, + it seems to return the modulus of two numbers which isn''t related to testing.","state":"COMMENTED","html_url":"https://github.com/scott-codecov/codecov-test/pull/40#pullrequestreview-1740008775","pull_request_url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40","author_association":"OWNER","_links":{"html":{"href":"https://github.com/scott-codecov/codecov-test/pull/40#pullrequestreview-1740008775"},"pull_request":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40"}},"submitted_at":"2023-11-20T14:53:55Z","commit_id":"b607bb0e17e1b8d8699272a26e32986a933f9946"}' + headers: + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, + X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, + X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, + X-GitHub-Request-Id, Deprecation, Sunset + Cache-Control: + - private, max-age=60, s-maxage=60 + Content-Encoding: + - gzip + Content-Security-Policy: + - default-src 'none' + Content-Type: + - application/json; charset=utf-8 + Date: + - Mon, 20 Nov 2023 14:53:55 GMT + ETag: + - W/"5397475b11e593c33b946a2bf17635c49034f50df65f994892c841de275b3381" + Referrer-Policy: + - origin-when-cross-origin, strict-origin-when-cross-origin + Server: + - GitHub.com + Strict-Transport-Security: + - max-age=31536000; includeSubdomains; preload + Transfer-Encoding: + - chunked + Vary: + - Accept, Authorization, Cookie, X-GitHub-OTP + - Accept-Encoding, Accept, X-Requested-With + X-Accepted-OAuth-Scopes: + - '' + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + X-GitHub-Media-Type: + - github.v3 + X-GitHub-Request-Id: + - FA12:0A0F:26C7F07:517E47E:655B7302 + X-OAuth-Scopes: + - '' + X-RateLimit-Limit: + - '5000' + X-RateLimit-Remaining: + - '4989' + X-RateLimit-Reset: + - '1700494278' + X-RateLimit-Resource: + - core + X-RateLimit-Used: + - '11' + X-XSS-Protection: + - '0' + x-accepted-github-permissions: + - pull_requests=write + x-github-api-version-selected: + - '2022-11-28' + x-oauth-client-id: + - Iv1.88e0c58abd4e2e45 + http_version: HTTP/1.1 + status_code: 200 +version: 1 diff --git a/services/tests/cassetes/test_ai_pr_review/test_perform_new_commit.yaml b/services/tests/cassetes/test_ai_pr_review/test_perform_new_commit.yaml new file mode 100644 index 000000000..8c3a7aef0 --- /dev/null +++ b/services/tests/cassetes/test_ai_pr_review/test_perform_new_commit.yaml @@ -0,0 +1,835 @@ +interactions: +- request: + body: '' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + connection: + - keep-alive + host: + - api.github.com + user-agent: + - Default + method: GET + uri: https://api.github.com/repos/scott-codecov/codecov-test/pulls/40 + response: + content: '{"url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40","id":1609199716,"node_id":"PR_kwDOHO5Jtc5f6nBk","html_url":"https://github.com/scott-codecov/codecov-test/pull/40","diff_url":"https://github.com/scott-codecov/codecov-test/pull/40.diff","patch_url":"https://github.com/scott-codecov/codecov-test/pull/40.patch","issue_url":"https://api.github.com/repos/scott-codecov/codecov-test/issues/40","number":40,"state":"open","locked":false,"title":"Test + AI PR review","user":{"login":"scott-codecov","id":103445133,"node_id":"U_kgDOBipyjQ","avatar_url":"https://avatars.githubusercontent.com/u/103445133?v=4","gravatar_id":"","url":"https://api.github.com/users/scott-codecov","html_url":"https://github.com/scott-codecov","followers_url":"https://api.github.com/users/scott-codecov/followers","following_url":"https://api.github.com/users/scott-codecov/following{/other_user}","gists_url":"https://api.github.com/users/scott-codecov/gists{/gist_id}","starred_url":"https://api.github.com/users/scott-codecov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scott-codecov/subscriptions","organizations_url":"https://api.github.com/users/scott-codecov/orgs","repos_url":"https://api.github.com/users/scott-codecov/repos","events_url":"https://api.github.com/users/scott-codecov/events{/privacy}","received_events_url":"https://api.github.com/users/scott-codecov/received_events","type":"User","site_admin":false},"body":null,"created_at":"2023-11-20T14:17:17Z","updated_at":"2023-11-20T14:56:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"30103e093dfe0875dcad2b93eb2f2488ece393ea","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"draft":false,"commits_url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40/commits","review_comments_url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40/comments","review_comment_url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scott-codecov/codecov-test/issues/40/comments","statuses_url":"https://api.github.com/repos/scott-codecov/codecov-test/statuses/5c64a5143951193dde7b14c14611eebe1025f862","head":{"label":"scott-codecov:scott-codecov-patch-3","ref":"scott-codecov-patch-3","sha":"5c64a5143951193dde7b14c14611eebe1025f862","user":{"login":"scott-codecov","id":103445133,"node_id":"U_kgDOBipyjQ","avatar_url":"https://avatars.githubusercontent.com/u/103445133?v=4","gravatar_id":"","url":"https://api.github.com/users/scott-codecov","html_url":"https://github.com/scott-codecov","followers_url":"https://api.github.com/users/scott-codecov/followers","following_url":"https://api.github.com/users/scott-codecov/following{/other_user}","gists_url":"https://api.github.com/users/scott-codecov/gists{/gist_id}","starred_url":"https://api.github.com/users/scott-codecov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scott-codecov/subscriptions","organizations_url":"https://api.github.com/users/scott-codecov/orgs","repos_url":"https://api.github.com/users/scott-codecov/repos","events_url":"https://api.github.com/users/scott-codecov/events{/privacy}","received_events_url":"https://api.github.com/users/scott-codecov/received_events","type":"User","site_admin":false},"repo":{"id":485378485,"node_id":"R_kgDOHO5JtQ","name":"codecov-test","full_name":"scott-codecov/codecov-test","private":true,"owner":{"login":"scott-codecov","id":103445133,"node_id":"U_kgDOBipyjQ","avatar_url":"https://avatars.githubusercontent.com/u/103445133?v=4","gravatar_id":"","url":"https://api.github.com/users/scott-codecov","html_url":"https://github.com/scott-codecov","followers_url":"https://api.github.com/users/scott-codecov/followers","following_url":"https://api.github.com/users/scott-codecov/following{/other_user}","gists_url":"https://api.github.com/users/scott-codecov/gists{/gist_id}","starred_url":"https://api.github.com/users/scott-codecov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scott-codecov/subscriptions","organizations_url":"https://api.github.com/users/scott-codecov/orgs","repos_url":"https://api.github.com/users/scott-codecov/repos","events_url":"https://api.github.com/users/scott-codecov/events{/privacy}","received_events_url":"https://api.github.com/users/scott-codecov/received_events","type":"User","site_admin":false},"html_url":"https://github.com/scott-codecov/codecov-test","description":null,"fork":false,"url":"https://api.github.com/repos/scott-codecov/codecov-test","forks_url":"https://api.github.com/repos/scott-codecov/codecov-test/forks","keys_url":"https://api.github.com/repos/scott-codecov/codecov-test/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scott-codecov/codecov-test/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scott-codecov/codecov-test/teams","hooks_url":"https://api.github.com/repos/scott-codecov/codecov-test/hooks","issue_events_url":"https://api.github.com/repos/scott-codecov/codecov-test/issues/events{/number}","events_url":"https://api.github.com/repos/scott-codecov/codecov-test/events","assignees_url":"https://api.github.com/repos/scott-codecov/codecov-test/assignees{/user}","branches_url":"https://api.github.com/repos/scott-codecov/codecov-test/branches{/branch}","tags_url":"https://api.github.com/repos/scott-codecov/codecov-test/tags","blobs_url":"https://api.github.com/repos/scott-codecov/codecov-test/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scott-codecov/codecov-test/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scott-codecov/codecov-test/git/refs{/sha}","trees_url":"https://api.github.com/repos/scott-codecov/codecov-test/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scott-codecov/codecov-test/statuses/{sha}","languages_url":"https://api.github.com/repos/scott-codecov/codecov-test/languages","stargazers_url":"https://api.github.com/repos/scott-codecov/codecov-test/stargazers","contributors_url":"https://api.github.com/repos/scott-codecov/codecov-test/contributors","subscribers_url":"https://api.github.com/repos/scott-codecov/codecov-test/subscribers","subscription_url":"https://api.github.com/repos/scott-codecov/codecov-test/subscription","commits_url":"https://api.github.com/repos/scott-codecov/codecov-test/commits{/sha}","git_commits_url":"https://api.github.com/repos/scott-codecov/codecov-test/git/commits{/sha}","comments_url":"https://api.github.com/repos/scott-codecov/codecov-test/comments{/number}","issue_comment_url":"https://api.github.com/repos/scott-codecov/codecov-test/issues/comments{/number}","contents_url":"https://api.github.com/repos/scott-codecov/codecov-test/contents/{+path}","compare_url":"https://api.github.com/repos/scott-codecov/codecov-test/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scott-codecov/codecov-test/merges","archive_url":"https://api.github.com/repos/scott-codecov/codecov-test/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scott-codecov/codecov-test/downloads","issues_url":"https://api.github.com/repos/scott-codecov/codecov-test/issues{/number}","pulls_url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls{/number}","milestones_url":"https://api.github.com/repos/scott-codecov/codecov-test/milestones{/number}","notifications_url":"https://api.github.com/repos/scott-codecov/codecov-test/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scott-codecov/codecov-test/labels{/name}","releases_url":"https://api.github.com/repos/scott-codecov/codecov-test/releases{/id}","deployments_url":"https://api.github.com/repos/scott-codecov/codecov-test/deployments","created_at":"2022-04-25T13:15:44Z","updated_at":"2022-04-29T10:48:46Z","pushed_at":"2023-11-20T14:56:17Z","git_url":"git://github.com/scott-codecov/codecov-test.git","ssh_url":"git@github.com:scott-codecov/codecov-test.git","clone_url":"https://github.com/scott-codecov/codecov-test.git","svn_url":"https://github.com/scott-codecov/codecov-test","homepage":null,"size":239,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"has_discussions":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":14,"license":null,"allow_forking":true,"is_template":false,"web_commit_signoff_required":false,"topics":[],"visibility":"private","forks":0,"open_issues":14,"watchers":0,"default_branch":"master"}},"base":{"label":"scott-codecov:master","ref":"master","sha":"ece177a1e98a568a5428751b21e9c2530ab16927","user":{"login":"scott-codecov","id":103445133,"node_id":"U_kgDOBipyjQ","avatar_url":"https://avatars.githubusercontent.com/u/103445133?v=4","gravatar_id":"","url":"https://api.github.com/users/scott-codecov","html_url":"https://github.com/scott-codecov","followers_url":"https://api.github.com/users/scott-codecov/followers","following_url":"https://api.github.com/users/scott-codecov/following{/other_user}","gists_url":"https://api.github.com/users/scott-codecov/gists{/gist_id}","starred_url":"https://api.github.com/users/scott-codecov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scott-codecov/subscriptions","organizations_url":"https://api.github.com/users/scott-codecov/orgs","repos_url":"https://api.github.com/users/scott-codecov/repos","events_url":"https://api.github.com/users/scott-codecov/events{/privacy}","received_events_url":"https://api.github.com/users/scott-codecov/received_events","type":"User","site_admin":false},"repo":{"id":485378485,"node_id":"R_kgDOHO5JtQ","name":"codecov-test","full_name":"scott-codecov/codecov-test","private":true,"owner":{"login":"scott-codecov","id":103445133,"node_id":"U_kgDOBipyjQ","avatar_url":"https://avatars.githubusercontent.com/u/103445133?v=4","gravatar_id":"","url":"https://api.github.com/users/scott-codecov","html_url":"https://github.com/scott-codecov","followers_url":"https://api.github.com/users/scott-codecov/followers","following_url":"https://api.github.com/users/scott-codecov/following{/other_user}","gists_url":"https://api.github.com/users/scott-codecov/gists{/gist_id}","starred_url":"https://api.github.com/users/scott-codecov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scott-codecov/subscriptions","organizations_url":"https://api.github.com/users/scott-codecov/orgs","repos_url":"https://api.github.com/users/scott-codecov/repos","events_url":"https://api.github.com/users/scott-codecov/events{/privacy}","received_events_url":"https://api.github.com/users/scott-codecov/received_events","type":"User","site_admin":false},"html_url":"https://github.com/scott-codecov/codecov-test","description":null,"fork":false,"url":"https://api.github.com/repos/scott-codecov/codecov-test","forks_url":"https://api.github.com/repos/scott-codecov/codecov-test/forks","keys_url":"https://api.github.com/repos/scott-codecov/codecov-test/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scott-codecov/codecov-test/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scott-codecov/codecov-test/teams","hooks_url":"https://api.github.com/repos/scott-codecov/codecov-test/hooks","issue_events_url":"https://api.github.com/repos/scott-codecov/codecov-test/issues/events{/number}","events_url":"https://api.github.com/repos/scott-codecov/codecov-test/events","assignees_url":"https://api.github.com/repos/scott-codecov/codecov-test/assignees{/user}","branches_url":"https://api.github.com/repos/scott-codecov/codecov-test/branches{/branch}","tags_url":"https://api.github.com/repos/scott-codecov/codecov-test/tags","blobs_url":"https://api.github.com/repos/scott-codecov/codecov-test/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scott-codecov/codecov-test/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scott-codecov/codecov-test/git/refs{/sha}","trees_url":"https://api.github.com/repos/scott-codecov/codecov-test/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scott-codecov/codecov-test/statuses/{sha}","languages_url":"https://api.github.com/repos/scott-codecov/codecov-test/languages","stargazers_url":"https://api.github.com/repos/scott-codecov/codecov-test/stargazers","contributors_url":"https://api.github.com/repos/scott-codecov/codecov-test/contributors","subscribers_url":"https://api.github.com/repos/scott-codecov/codecov-test/subscribers","subscription_url":"https://api.github.com/repos/scott-codecov/codecov-test/subscription","commits_url":"https://api.github.com/repos/scott-codecov/codecov-test/commits{/sha}","git_commits_url":"https://api.github.com/repos/scott-codecov/codecov-test/git/commits{/sha}","comments_url":"https://api.github.com/repos/scott-codecov/codecov-test/comments{/number}","issue_comment_url":"https://api.github.com/repos/scott-codecov/codecov-test/issues/comments{/number}","contents_url":"https://api.github.com/repos/scott-codecov/codecov-test/contents/{+path}","compare_url":"https://api.github.com/repos/scott-codecov/codecov-test/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scott-codecov/codecov-test/merges","archive_url":"https://api.github.com/repos/scott-codecov/codecov-test/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scott-codecov/codecov-test/downloads","issues_url":"https://api.github.com/repos/scott-codecov/codecov-test/issues{/number}","pulls_url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls{/number}","milestones_url":"https://api.github.com/repos/scott-codecov/codecov-test/milestones{/number}","notifications_url":"https://api.github.com/repos/scott-codecov/codecov-test/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scott-codecov/codecov-test/labels{/name}","releases_url":"https://api.github.com/repos/scott-codecov/codecov-test/releases{/id}","deployments_url":"https://api.github.com/repos/scott-codecov/codecov-test/deployments","created_at":"2022-04-25T13:15:44Z","updated_at":"2022-04-29T10:48:46Z","pushed_at":"2023-11-20T14:56:17Z","git_url":"git://github.com/scott-codecov/codecov-test.git","ssh_url":"git@github.com:scott-codecov/codecov-test.git","clone_url":"https://github.com/scott-codecov/codecov-test.git","svn_url":"https://github.com/scott-codecov/codecov-test","homepage":null,"size":239,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"has_discussions":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":14,"license":null,"allow_forking":true,"is_template":false,"web_commit_signoff_required":false,"topics":[],"visibility":"private","forks":0,"open_issues":14,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40"},"html":{"href":"https://github.com/scott-codecov/codecov-test/pull/40"},"issue":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/issues/40"},"comments":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/issues/40/comments"},"review_comments":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40/comments"},"review_comment":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40/commits"},"statuses":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/statuses/5c64a5143951193dde7b14c14611eebe1025f862"}},"author_association":"OWNER","auto_merge":null,"active_lock_reason":null,"merged":false,"mergeable":true,"rebaseable":true,"mergeable_state":"unstable","merged_by":null,"comments":0,"review_comments":16,"maintainer_can_modify":false,"commits":2,"additions":6,"deletions":12,"changed_files":2}' + headers: + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, + X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, + X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, + X-GitHub-Request-Id, Deprecation, Sunset + Cache-Control: + - private, max-age=60, s-maxage=60 + Content-Encoding: + - gzip + Content-Security-Policy: + - default-src 'none' + Content-Type: + - application/json; charset=utf-8 + Date: + - Mon, 20 Nov 2023 14:56:58 GMT + ETag: + - W/"296b07aa4eea57ba4a7acd389a2bfada2e39b4cc4030cbb54c9a64dacf5ad366" + Last-Modified: + - Mon, 20 Nov 2023 14:56:16 GMT + Referrer-Policy: + - origin-when-cross-origin, strict-origin-when-cross-origin + Server: + - GitHub.com + Strict-Transport-Security: + - max-age=31536000; includeSubdomains; preload + Transfer-Encoding: + - chunked + Vary: + - Accept, Authorization, Cookie, X-GitHub-OTP + - Accept-Encoding, Accept, X-Requested-With + X-Accepted-OAuth-Scopes: + - '' + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + X-GitHub-Media-Type: + - github.v3 + X-GitHub-Request-Id: + - FA69:9369:200C52D:432C6D9:655B73BA + X-OAuth-Scopes: + - '' + X-RateLimit-Limit: + - '5000' + X-RateLimit-Remaining: + - '4987' + X-RateLimit-Reset: + - '1700494278' + X-RateLimit-Resource: + - core + X-RateLimit-Used: + - '13' + X-XSS-Protection: + - '0' + x-accepted-github-permissions: + - pull_requests=read; contents=read + x-github-api-version-selected: + - '2022-11-28' + x-oauth-client-id: + - Iv1.88e0c58abd4e2e45 + http_version: HTTP/1.1 + status_code: 200 +- request: + body: '' + headers: + accept: + - application/vnd.github.v3.diff + accept-encoding: + - gzip, deflate + connection: + - keep-alive + host: + - api.github.com + user-agent: + - Default + method: GET + uri: https://api.github.com/repos/scott-codecov/codecov-test/pulls/40 + response: + content: "diff --git a/main/bar.py b/main/bar.py\nindex 066a224..5991ec6 100644\n--- + a/main/bar.py\n+++ b/main/bar.py\n@@ -62,4 +62,7 @@ def add6(x, y):\n return + x + y\n \n def sub6(x, y):\n- return x - y\n\\ No newline at end of file\n+ + \ return x - y\n+\n+def add7(x, y):\n+ return x + y\n\\ No newline at end + of file\ndiff --git a/main/foo.py b/main/foo.py\nindex 9d285a4..41d8fd2 100644\n--- + a/main/foo.py\n+++ b/main/foo.py\n@@ -54,14 +54,5 @@ def mul4(x, y):\n def div4(x, + y):\n return x / y\n \n-def add5(x, y):\n- return x + y\n-\n-def sub5(x, + y):\n- return x - y\n-\n-def mul5(x, y):\n- return x * y\n-\n-def div5(x, + y):\n- return x / y\n+def testing(x, y):\n+ return x % y\n" + headers: + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, + X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, + X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, + X-GitHub-Request-Id, Deprecation, Sunset + Cache-Control: + - private, max-age=60, s-maxage=60 + Content-Length: + - '666' + Content-Security-Policy: + - default-src 'none' + Content-Type: + - application/vnd.github.v3.diff; charset=utf-8 + Date: + - Mon, 20 Nov 2023 14:56:59 GMT + ETag: + - '"cc2f80a6dfa37a49996d0a1ac913a4b5c35981e3cd3f50fcfde4eb5b197a4f55"' + Last-Modified: + - Mon, 20 Nov 2023 14:56:16 GMT + Referrer-Policy: + - origin-when-cross-origin, strict-origin-when-cross-origin + Server: + - GitHub.com + Strict-Transport-Security: + - max-age=31536000; includeSubdomains; preload + Vary: + - Accept, Authorization, Cookie, X-GitHub-OTP + - Accept-Encoding, Accept, X-Requested-With + X-Accepted-OAuth-Scopes: + - '' + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + X-GitHub-Media-Type: + - github.v3; param=diff + X-GitHub-Request-Id: + - FA6A:1AA9:8EA6FF:127DB9A:655B73BB + X-OAuth-Scopes: + - '' + X-RateLimit-Limit: + - '5000' + X-RateLimit-Remaining: + - '4986' + X-RateLimit-Reset: + - '1700494278' + X-RateLimit-Resource: + - core + X-RateLimit-Used: + - '14' + X-XSS-Protection: + - '0' + x-accepted-github-permissions: + - pull_requests=read; contents=read + x-github-api-version-selected: + - '2022-11-28' + x-oauth-client-id: + - Iv1.88e0c58abd4e2e45 + http_version: HTTP/1.1 + status_code: 200 +- request: + body: '{"messages": [{"role": "user", "content": "\n Your purpose is to + act as a highly experienced software engineer and provide a thorough\n review + of code changes and suggest improvements. Do not comment on minor style issues,\n missing + comments or documentation. Identify and resolve significant concerns to improve\n overall + code quality.\n\n You will receive a Git diff where each line has been + prefixed with a unique identifer in\n square brackets. When referencing + lines in this diff use that identifier.\n\n Format your output as JSON + such that there is 1 top-level comment that summarizes your review\n and + multiple additional comments addressing specific lines in the code with the + changes you\n deem appropriate.\n\n The output should have this + JSON form:\n\n {\n \"body\": \"This is the summary comment\",\n \"comments\": + [\n {\n \"line_id\": 123,\n \"body\": + \"This is a comment about the code with line ID 123\",\n }\n ]\n }\n\n Limit + the number of comments to 10 at most.\n\n Here is the Git diff on which + you should base your review:\n\n [1] diff --git a/main/bar.py b/main/bar.py\n[2] + index 066a224..5991ec6 100644\n[3] --- a/main/bar.py\n[4] +++ b/main/bar.py\n[5] + @@ -62,4 +62,7 @@ def add6(x, y):\n[6] return x + y\n[7] \n[8] def sub6(x, + y):\n[9] - return x - y\n[10] \\ No newline at end of file\n[11] + return + x - y\n[12] +\n[13] +def add7(x, y):\n[14] + return x + y\n[15] \\ No newline + at end of file\n[16] diff --git a/main/foo.py b/main/foo.py\n[17] index 9d285a4..41d8fd2 + 100644\n[18] --- a/main/foo.py\n[19] +++ b/main/foo.py\n[20] @@ -54,14 +54,5 + @@ def mul4(x, y):\n[21] def div4(x, y):\n[22] return x / y\n[23] \n[24] + -def add5(x, y):\n[25] - return x + y\n[26] -\n[27] -def sub5(x, y):\n[28] + - return x - y\n[29] -\n[30] -def mul5(x, y):\n[31] - return x * y\n[32] + -\n[33] -def div5(x, y):\n[34] - return x / y\n[35] +def testing(x, y):\n[36] + + return x % y\n[37] \n "}], "model": "gpt-4"}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '2165' + content-type: + - application/json + host: + - api.openai.com + user-agent: + - AsyncOpenAI/Python 1.2.4 + x-stainless-arch: + - arm64 + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.2.4 + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.10.8 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + content: "{\n \"id\": \"chatcmpl-8MzznvBLFYL4gS9jmfv1PAqsYge8n\",\n \"object\": + \"chat.completion\",\n \"created\": 1700492219,\n \"model\": \"gpt-4-0613\",\n + \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": + \"assistant\",\n \"content\": \"{\\n \\\"body\\\": \\\"The code changes + reflect transfer of add5, sub5, mul5, div5 functions from main/foo.py to main/bar.py + and they are renamed to add7, sub7, mul7, div7, respectively. There\u2019s + also a new testing function added. While these changes do not result in any + syntax errors, they introduce potential redundancy and confusion in naming of + functions.\\\",\\n \\\"comments\\\": [\\n {\\n \\\"line_id\\\": + 14,\\n \\\"body\\\": \\\"add7 function in bar.py is identically implemented + as add6. Consider removing redundant code.\\\"\\n },\\n {\\n \\\"line_id\\\": + 35,\\n \\\"body\\\": \\\"A new function 'testing' has been added + in foo.py file. Please make sure to add a more descriptive name for the function + that reflects what it does.\\\"\\n },\\n {\\n \\\"line_id\\\": + 35,\\n \\\"body\\\": \\\"The new 'testing' function uses the modulus + operation. The name doesn't reflect this, consider renaming it to 'modulus' + or a name that better reflects its functionality.\\\"\\n },\\n {\\n + \ \\\"line_id\\\": 24,\\n \\\"body\\\": \\\"Upon removal + of add5, sub5, mul5, div5 functions from foo.py, remember to update all call + sites that reference these functions.\\\"\\n },\\n {\\n \\\"line_id\\\": + 13,\\n \\\"body\\\": \\\"The new functions you've added named add7, + sub7, mul7, div7 are identical to some existing functions. It is recommended + to avoid duplicate functions, perhaps by creating a utility function if the + implementation across these functions is expected to remain identical.\\\"\\n + \ }\\n ]\\n}\"\n },\n \"finish_reason\": \"stop\"\n }\n + \ ],\n \"usage\": {\n \"prompt_tokens\": 605,\n \"completion_tokens\": + 343,\n \"total_tokens\": 948\n }\n}\n" + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 82918af47f44e20b-ORD + Cache-Control: + - no-cache, must-revalidate + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Mon, 20 Nov 2023 14:57:33 GMT + Server: + - cloudflare + Set-Cookie: + - __cf_bm=IzLHHOSkb3GsbWdl3ba5gtlo01gyLZUsGH0EywjECiI-1700492253-0-AeVW0HsDY7UprERytxSXL4vBLL4IcY0F2HYgOexbuiTq00GMqueTbmQ67ovaywdnb99xkTKnsOLrK4IHTeZuhd8=; + path=/; expires=Mon, 20-Nov-23 15:27:33 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=WSElFoSEEWNWnQwJ.4vWDd2fmWjMrkwEeP2ktZD2EvM-1700492253622-0-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Transfer-Encoding: + - chunked + access-control-allow-origin: + - '*' + alt-svc: + - h3=":443"; ma=86400 + openai-model: + - gpt-4-0613 + openai-organization: + - functional-software + openai-processing-ms: + - '33926' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=15724800; includeSubDomains + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '300000' + x-ratelimit-limit-tokens_usage_based: + - '300000' + x-ratelimit-remaining-requests: + - '9999' + x-ratelimit-remaining-tokens: + - '299478' + x-ratelimit-remaining-tokens_usage_based: + - '299478' + x-ratelimit-reset-requests: + - 6ms + x-ratelimit-reset-tokens: + - 104ms + x-ratelimit-reset-tokens_usage_based: + - 104ms + x-request-id: + - aad5ef2ac250b9a3b7774bd5cc43e1b1 + http_version: HTTP/1.1 + status_code: 200 +- request: + body: '' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + connection: + - keep-alive + host: + - api.github.com + user-agent: + - Default + method: GET + uri: https://api.github.com/repos/scott-codecov/codecov-test/pulls/40/comments?per_page=100&page=1 + response: + content: '[{"url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399299190","pull_request_review_id":1739975935,"id":1399299190,"node_id":"PRRC_kwDOHO5Jtc5TZ5x2","diff_hunk":"@@ + -54,14 +54,5 @@ def mul4(x, y):\n def div4(x, y):\n return x / y\n \n-def + add5(x, y):","path":"main/foo.py","commit_id":"5c64a5143951193dde7b14c14611eebe1025f862","original_commit_id":"b607bb0e17e1b8d8699272a26e32986a933f9946","user":{"login":"scott-codecov","id":103445133,"node_id":"U_kgDOBipyjQ","avatar_url":"https://avatars.githubusercontent.com/u/103445133?v=4","gravatar_id":"","url":"https://api.github.com/users/scott-codecov","html_url":"https://github.com/scott-codecov","followers_url":"https://api.github.com/users/scott-codecov/followers","following_url":"https://api.github.com/users/scott-codecov/following{/other_user}","gists_url":"https://api.github.com/users/scott-codecov/gists{/gist_id}","starred_url":"https://api.github.com/users/scott-codecov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scott-codecov/subscriptions","organizations_url":"https://api.github.com/users/scott-codecov/orgs","repos_url":"https://api.github.com/users/scott-codecov/repos","events_url":"https://api.github.com/users/scott-codecov/events{/privacy}","received_events_url":"https://api.github.com/users/scott-codecov/received_events","type":"User","site_admin":false},"body":"The + function `add5` has been removed. If there are any dependencies on this function + elsewhere in the codebase, they''ll need to be updated or this can potentially + break your code. Please ensure this function is not needed elsewhere or replaced + by a similar functionality.","created_at":"2023-11-20T14:39:23Z","updated_at":"2023-11-20T14:39:24Z","html_url":"https://github.com/scott-codecov/codecov-test/pull/40#discussion_r1399299190","pull_request_url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399299190"},"html":{"href":"https://github.com/scott-codecov/codecov-test/pull/40#discussion_r1399299190"},"pull_request":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40"}},"reactions":{"url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399299190/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0},"start_line":null,"original_start_line":null,"start_side":null,"line":57,"original_line":57,"side":"LEFT","original_position":4,"position":4,"subject_type":"line"},{"url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399299193","pull_request_review_id":1739975935,"id":1399299193,"node_id":"PRRC_kwDOHO5Jtc5TZ5x5","diff_hunk":"@@ + -54,14 +54,5 @@\n def div4(x, y):\n return x / y\n \n-def add5(x, y):\n- return + x + y\n-\n-def sub5(x, y):","path":"main/foo.py","commit_id":"5c64a5143951193dde7b14c14611eebe1025f862","original_commit_id":"b607bb0e17e1b8d8699272a26e32986a933f9946","user":{"login":"scott-codecov","id":103445133,"node_id":"U_kgDOBipyjQ","avatar_url":"https://avatars.githubusercontent.com/u/103445133?v=4","gravatar_id":"","url":"https://api.github.com/users/scott-codecov","html_url":"https://github.com/scott-codecov","followers_url":"https://api.github.com/users/scott-codecov/followers","following_url":"https://api.github.com/users/scott-codecov/following{/other_user}","gists_url":"https://api.github.com/users/scott-codecov/gists{/gist_id}","starred_url":"https://api.github.com/users/scott-codecov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scott-codecov/subscriptions","organizations_url":"https://api.github.com/users/scott-codecov/orgs","repos_url":"https://api.github.com/users/scott-codecov/repos","events_url":"https://api.github.com/users/scott-codecov/events{/privacy}","received_events_url":"https://api.github.com/users/scott-codecov/received_events","type":"User","site_admin":false},"body":"The + function `sub5` has been removed. Please ensure this function is not needed + elsewhere or replaced by a similar functionality.","created_at":"2023-11-20T14:39:23Z","updated_at":"2023-11-20T14:39:24Z","html_url":"https://github.com/scott-codecov/codecov-test/pull/40#discussion_r1399299193","pull_request_url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399299193"},"html":{"href":"https://github.com/scott-codecov/codecov-test/pull/40#discussion_r1399299193"},"pull_request":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40"}},"reactions":{"url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399299193/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0},"start_line":null,"original_start_line":null,"start_side":null,"line":60,"original_line":60,"side":"LEFT","original_position":7,"position":7,"subject_type":"line"},{"url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399299195","pull_request_review_id":1739975935,"id":1399299195,"node_id":"PRRC_kwDOHO5Jtc5TZ5x7","diff_hunk":"@@ + -54,14 +54,5 @@\n def div4(x, y):\n return x / y\n \n-def add5(x, y):\n- return + x + y\n-\n-def sub5(x, y):\n- return x - y\n-\n-def mul5(x, y):","path":"main/foo.py","commit_id":"5c64a5143951193dde7b14c14611eebe1025f862","original_commit_id":"b607bb0e17e1b8d8699272a26e32986a933f9946","user":{"login":"scott-codecov","id":103445133,"node_id":"U_kgDOBipyjQ","avatar_url":"https://avatars.githubusercontent.com/u/103445133?v=4","gravatar_id":"","url":"https://api.github.com/users/scott-codecov","html_url":"https://github.com/scott-codecov","followers_url":"https://api.github.com/users/scott-codecov/followers","following_url":"https://api.github.com/users/scott-codecov/following{/other_user}","gists_url":"https://api.github.com/users/scott-codecov/gists{/gist_id}","starred_url":"https://api.github.com/users/scott-codecov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scott-codecov/subscriptions","organizations_url":"https://api.github.com/users/scott-codecov/orgs","repos_url":"https://api.github.com/users/scott-codecov/repos","events_url":"https://api.github.com/users/scott-codecov/events{/privacy}","received_events_url":"https://api.github.com/users/scott-codecov/received_events","type":"User","site_admin":false},"body":"The + function `mul5` has been removed. Please ensure this function is not needed + elsewhere or replaced by a similar functionality.","created_at":"2023-11-20T14:39:24Z","updated_at":"2023-11-20T14:39:24Z","html_url":"https://github.com/scott-codecov/codecov-test/pull/40#discussion_r1399299195","pull_request_url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399299195"},"html":{"href":"https://github.com/scott-codecov/codecov-test/pull/40#discussion_r1399299195"},"pull_request":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40"}},"reactions":{"url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399299195/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0},"start_line":null,"original_start_line":null,"start_side":null,"line":63,"original_line":63,"side":"LEFT","original_position":10,"position":10,"subject_type":"line"},{"url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399299201","pull_request_review_id":1739975935,"id":1399299201,"node_id":"PRRC_kwDOHO5Jtc5TZ5yB","diff_hunk":"@@ + -54,14 +54,5 @@\n def div4(x, y):\n return x / y\n \n-def add5(x, y):\n- return + x + y\n-\n-def sub5(x, y):\n- return x - y\n-\n-def mul5(x, y):\n- return + x * y\n-\n-def div5(x, y):","path":"main/foo.py","commit_id":"5c64a5143951193dde7b14c14611eebe1025f862","original_commit_id":"b607bb0e17e1b8d8699272a26e32986a933f9946","user":{"login":"scott-codecov","id":103445133,"node_id":"U_kgDOBipyjQ","avatar_url":"https://avatars.githubusercontent.com/u/103445133?v=4","gravatar_id":"","url":"https://api.github.com/users/scott-codecov","html_url":"https://github.com/scott-codecov","followers_url":"https://api.github.com/users/scott-codecov/followers","following_url":"https://api.github.com/users/scott-codecov/following{/other_user}","gists_url":"https://api.github.com/users/scott-codecov/gists{/gist_id}","starred_url":"https://api.github.com/users/scott-codecov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scott-codecov/subscriptions","organizations_url":"https://api.github.com/users/scott-codecov/orgs","repos_url":"https://api.github.com/users/scott-codecov/repos","events_url":"https://api.github.com/users/scott-codecov/events{/privacy}","received_events_url":"https://api.github.com/users/scott-codecov/received_events","type":"User","site_admin":false},"body":"The + function `div5` has been removed. Please ensure this function is not needed + elsewhere or replaced by a similar functionality.","created_at":"2023-11-20T14:39:24Z","updated_at":"2023-11-20T14:39:24Z","html_url":"https://github.com/scott-codecov/codecov-test/pull/40#discussion_r1399299201","pull_request_url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399299201"},"html":{"href":"https://github.com/scott-codecov/codecov-test/pull/40#discussion_r1399299201"},"pull_request":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40"}},"reactions":{"url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399299201/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0},"start_line":null,"original_start_line":null,"start_side":null,"line":66,"original_line":66,"side":"LEFT","original_position":13,"position":13,"subject_type":"line"},{"url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399299203","pull_request_review_id":1739975935,"id":1399299203,"node_id":"PRRC_kwDOHO5Jtc5TZ5yD","diff_hunk":"@@ + -54,14 +54,5 @@\n def div4(x, y):\n return x / y\n \n-def add5(x, y):\n- return + x + y\n-\n-def sub5(x, y):\n- return x - y\n-\n-def mul5(x, y):\n- return + x * y\n-\n-def div5(x, y):\n- return x / y\n+def testing(x, y):","path":"main/foo.py","commit_id":"5c64a5143951193dde7b14c14611eebe1025f862","original_commit_id":"b607bb0e17e1b8d8699272a26e32986a933f9946","user":{"login":"scott-codecov","id":103445133,"node_id":"U_kgDOBipyjQ","avatar_url":"https://avatars.githubusercontent.com/u/103445133?v=4","gravatar_id":"","url":"https://api.github.com/users/scott-codecov","html_url":"https://github.com/scott-codecov","followers_url":"https://api.github.com/users/scott-codecov/followers","following_url":"https://api.github.com/users/scott-codecov/following{/other_user}","gists_url":"https://api.github.com/users/scott-codecov/gists{/gist_id}","starred_url":"https://api.github.com/users/scott-codecov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scott-codecov/subscriptions","organizations_url":"https://api.github.com/users/scott-codecov/orgs","repos_url":"https://api.github.com/users/scott-codecov/repos","events_url":"https://api.github.com/users/scott-codecov/events{/privacy}","received_events_url":"https://api.github.com/users/scott-codecov/received_events","type":"User","site_admin":false},"body":"The + new `testing` function introduced gives the modulus of x and y. Make sure to + handle the scenario of a divide by zero error when y equals to zero.","created_at":"2023-11-20T14:39:24Z","updated_at":"2023-11-20T14:39:24Z","html_url":"https://github.com/scott-codecov/codecov-test/pull/40#discussion_r1399299203","pull_request_url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399299203"},"html":{"href":"https://github.com/scott-codecov/codecov-test/pull/40#discussion_r1399299203"},"pull_request":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40"}},"reactions":{"url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399299203/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0},"start_line":null,"original_start_line":null,"start_side":null,"line":57,"original_line":57,"side":"RIGHT","original_position":15,"position":15,"subject_type":"line"},{"url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399299206","pull_request_review_id":1739975935,"id":1399299206,"node_id":"PRRC_kwDOHO5Jtc5TZ5yG","diff_hunk":"@@ + -54,14 +54,5 @@\n def div4(x, y):\n return x / y\n \n-def add5(x, y):\n- return + x + y\n-\n-def sub5(x, y):\n- return x - y\n-\n-def mul5(x, y):\n- return + x * y\n-\n-def div5(x, y):\n- return x / y\n+def testing(x, y):\n+ return + x % y","path":"main/foo.py","commit_id":"5c64a5143951193dde7b14c14611eebe1025f862","original_commit_id":"b607bb0e17e1b8d8699272a26e32986a933f9946","user":{"login":"scott-codecov","id":103445133,"node_id":"U_kgDOBipyjQ","avatar_url":"https://avatars.githubusercontent.com/u/103445133?v=4","gravatar_id":"","url":"https://api.github.com/users/scott-codecov","html_url":"https://github.com/scott-codecov","followers_url":"https://api.github.com/users/scott-codecov/followers","following_url":"https://api.github.com/users/scott-codecov/following{/other_user}","gists_url":"https://api.github.com/users/scott-codecov/gists{/gist_id}","starred_url":"https://api.github.com/users/scott-codecov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scott-codecov/subscriptions","organizations_url":"https://api.github.com/users/scott-codecov/orgs","repos_url":"https://api.github.com/users/scott-codecov/repos","events_url":"https://api.github.com/users/scott-codecov/events{/privacy}","received_events_url":"https://api.github.com/users/scott-codecov/received_events","type":"User","site_admin":false},"body":"The + new `testing` function does not handle floating point numbers as expected. The + modulus operator returns a floating-point result instead of rounding down to + the nearest whole number. Make sure to handle this as per the requirements.","created_at":"2023-11-20T14:39:24Z","updated_at":"2023-11-20T14:39:24Z","html_url":"https://github.com/scott-codecov/codecov-test/pull/40#discussion_r1399299206","pull_request_url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399299206"},"html":{"href":"https://github.com/scott-codecov/codecov-test/pull/40#discussion_r1399299206"},"pull_request":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40"}},"reactions":{"url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399299206/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0},"start_line":null,"original_start_line":null,"start_side":null,"line":58,"original_line":58,"side":"RIGHT","original_position":16,"position":16,"subject_type":"line"},{"url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399316016","pull_request_review_id":1740003613,"id":1399316016,"node_id":"PRRC_kwDOHO5Jtc5TZ94w","diff_hunk":"@@ + -54,14 +54,5 @@ def mul4(x, y):\n def div4(x, y):\n return x / y\n \n-def + add5(x, y):","path":"main/foo.py","commit_id":"5c64a5143951193dde7b14c14611eebe1025f862","original_commit_id":"b607bb0e17e1b8d8699272a26e32986a933f9946","user":{"login":"scott-codecov","id":103445133,"node_id":"U_kgDOBipyjQ","avatar_url":"https://avatars.githubusercontent.com/u/103445133?v=4","gravatar_id":"","url":"https://api.github.com/users/scott-codecov","html_url":"https://github.com/scott-codecov","followers_url":"https://api.github.com/users/scott-codecov/followers","following_url":"https://api.github.com/users/scott-codecov/following{/other_user}","gists_url":"https://api.github.com/users/scott-codecov/gists{/gist_id}","starred_url":"https://api.github.com/users/scott-codecov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scott-codecov/subscriptions","organizations_url":"https://api.github.com/users/scott-codecov/orgs","repos_url":"https://api.github.com/users/scott-codecov/repos","events_url":"https://api.github.com/users/scott-codecov/events{/privacy}","received_events_url":"https://api.github.com/users/scott-codecov/received_events","type":"User","site_admin":false},"body":"Check + if there is any code that is calling the add5 function before removing it. If + there is, make sure those instances are handled appropriately.","created_at":"2023-11-20T14:51:31Z","updated_at":"2023-11-20T14:51:32Z","html_url":"https://github.com/scott-codecov/codecov-test/pull/40#discussion_r1399316016","pull_request_url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399316016"},"html":{"href":"https://github.com/scott-codecov/codecov-test/pull/40#discussion_r1399316016"},"pull_request":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40"}},"reactions":{"url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399316016/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0},"start_line":null,"original_start_line":null,"start_side":null,"line":57,"original_line":57,"side":"LEFT","original_position":4,"position":4,"subject_type":"line"},{"url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399316021","pull_request_review_id":1740003613,"id":1399316021,"node_id":"PRRC_kwDOHO5Jtc5TZ941","diff_hunk":"@@ + -54,14 +54,5 @@\n def div4(x, y):\n return x / y\n \n-def add5(x, y):\n- return + x + y\n-\n-def sub5(x, y):","path":"main/foo.py","commit_id":"5c64a5143951193dde7b14c14611eebe1025f862","original_commit_id":"b607bb0e17e1b8d8699272a26e32986a933f9946","user":{"login":"scott-codecov","id":103445133,"node_id":"U_kgDOBipyjQ","avatar_url":"https://avatars.githubusercontent.com/u/103445133?v=4","gravatar_id":"","url":"https://api.github.com/users/scott-codecov","html_url":"https://github.com/scott-codecov","followers_url":"https://api.github.com/users/scott-codecov/followers","following_url":"https://api.github.com/users/scott-codecov/following{/other_user}","gists_url":"https://api.github.com/users/scott-codecov/gists{/gist_id}","starred_url":"https://api.github.com/users/scott-codecov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scott-codecov/subscriptions","organizations_url":"https://api.github.com/users/scott-codecov/orgs","repos_url":"https://api.github.com/users/scott-codecov/repos","events_url":"https://api.github.com/users/scott-codecov/events{/privacy}","received_events_url":"https://api.github.com/users/scott-codecov/received_events","type":"User","site_admin":false},"body":"Ensure + that there are no dependencies on the sub5 function before deleting it. Analyze + the impact of this deletion before proceeding.","created_at":"2023-11-20T14:51:31Z","updated_at":"2023-11-20T14:51:32Z","html_url":"https://github.com/scott-codecov/codecov-test/pull/40#discussion_r1399316021","pull_request_url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399316021"},"html":{"href":"https://github.com/scott-codecov/codecov-test/pull/40#discussion_r1399316021"},"pull_request":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40"}},"reactions":{"url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399316021/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0},"start_line":null,"original_start_line":null,"start_side":null,"line":60,"original_line":60,"side":"LEFT","original_position":7,"position":7,"subject_type":"line"},{"url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399316023","pull_request_review_id":1740003613,"id":1399316023,"node_id":"PRRC_kwDOHO5Jtc5TZ943","diff_hunk":"@@ + -54,14 +54,5 @@\n def div4(x, y):\n return x / y\n \n-def add5(x, y):\n- return + x + y\n-\n-def sub5(x, y):\n- return x - y\n-\n-def mul5(x, y):","path":"main/foo.py","commit_id":"5c64a5143951193dde7b14c14611eebe1025f862","original_commit_id":"b607bb0e17e1b8d8699272a26e32986a933f9946","user":{"login":"scott-codecov","id":103445133,"node_id":"U_kgDOBipyjQ","avatar_url":"https://avatars.githubusercontent.com/u/103445133?v=4","gravatar_id":"","url":"https://api.github.com/users/scott-codecov","html_url":"https://github.com/scott-codecov","followers_url":"https://api.github.com/users/scott-codecov/followers","following_url":"https://api.github.com/users/scott-codecov/following{/other_user}","gists_url":"https://api.github.com/users/scott-codecov/gists{/gist_id}","starred_url":"https://api.github.com/users/scott-codecov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scott-codecov/subscriptions","organizations_url":"https://api.github.com/users/scott-codecov/orgs","repos_url":"https://api.github.com/users/scott-codecov/repos","events_url":"https://api.github.com/users/scott-codecov/events{/privacy}","received_events_url":"https://api.github.com/users/scott-codecov/received_events","type":"User","site_admin":false},"body":"Removal + of the mul5 function might impact existing functionality. If there are dependencies, + ensure that they are properly handled.","created_at":"2023-11-20T14:51:31Z","updated_at":"2023-11-20T14:51:32Z","html_url":"https://github.com/scott-codecov/codecov-test/pull/40#discussion_r1399316023","pull_request_url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399316023"},"html":{"href":"https://github.com/scott-codecov/codecov-test/pull/40#discussion_r1399316023"},"pull_request":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40"}},"reactions":{"url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399316023/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0},"start_line":null,"original_start_line":null,"start_side":null,"line":63,"original_line":63,"side":"LEFT","original_position":10,"position":10,"subject_type":"line"},{"url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399316026","pull_request_review_id":1740003613,"id":1399316026,"node_id":"PRRC_kwDOHO5Jtc5TZ946","diff_hunk":"@@ + -54,14 +54,5 @@\n def div4(x, y):\n return x / y\n \n-def add5(x, y):\n- return + x + y\n-\n-def sub5(x, y):\n- return x - y\n-\n-def mul5(x, y):\n- return + x * y\n-\n-def div5(x, y):","path":"main/foo.py","commit_id":"5c64a5143951193dde7b14c14611eebe1025f862","original_commit_id":"b607bb0e17e1b8d8699272a26e32986a933f9946","user":{"login":"scott-codecov","id":103445133,"node_id":"U_kgDOBipyjQ","avatar_url":"https://avatars.githubusercontent.com/u/103445133?v=4","gravatar_id":"","url":"https://api.github.com/users/scott-codecov","html_url":"https://github.com/scott-codecov","followers_url":"https://api.github.com/users/scott-codecov/followers","following_url":"https://api.github.com/users/scott-codecov/following{/other_user}","gists_url":"https://api.github.com/users/scott-codecov/gists{/gist_id}","starred_url":"https://api.github.com/users/scott-codecov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scott-codecov/subscriptions","organizations_url":"https://api.github.com/users/scott-codecov/orgs","repos_url":"https://api.github.com/users/scott-codecov/repos","events_url":"https://api.github.com/users/scott-codecov/events{/privacy}","received_events_url":"https://api.github.com/users/scott-codecov/received_events","type":"User","site_admin":false},"body":"Removal + of the div5 function could impact parts of your program that rely on it. Re-evaluate + to confirm this is the right course.","created_at":"2023-11-20T14:51:31Z","updated_at":"2023-11-20T14:51:32Z","html_url":"https://github.com/scott-codecov/codecov-test/pull/40#discussion_r1399316026","pull_request_url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399316026"},"html":{"href":"https://github.com/scott-codecov/codecov-test/pull/40#discussion_r1399316026"},"pull_request":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40"}},"reactions":{"url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399316026/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0},"start_line":null,"original_start_line":null,"start_side":null,"line":66,"original_line":66,"side":"LEFT","original_position":13,"position":13,"subject_type":"line"},{"url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399316027","pull_request_review_id":1740003613,"id":1399316027,"node_id":"PRRC_kwDOHO5Jtc5TZ947","diff_hunk":"@@ + -54,14 +54,5 @@\n def div4(x, y):\n return x / y\n \n-def add5(x, y):\n- return + x + y\n-\n-def sub5(x, y):\n- return x - y\n-\n-def mul5(x, y):\n- return + x * y\n-\n-def div5(x, y):\n- return x / y\n+def testing(x, y):","path":"main/foo.py","commit_id":"5c64a5143951193dde7b14c14611eebe1025f862","original_commit_id":"b607bb0e17e1b8d8699272a26e32986a933f9946","user":{"login":"scott-codecov","id":103445133,"node_id":"U_kgDOBipyjQ","avatar_url":"https://avatars.githubusercontent.com/u/103445133?v=4","gravatar_id":"","url":"https://api.github.com/users/scott-codecov","html_url":"https://github.com/scott-codecov","followers_url":"https://api.github.com/users/scott-codecov/followers","following_url":"https://api.github.com/users/scott-codecov/following{/other_user}","gists_url":"https://api.github.com/users/scott-codecov/gists{/gist_id}","starred_url":"https://api.github.com/users/scott-codecov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scott-codecov/subscriptions","organizations_url":"https://api.github.com/users/scott-codecov/orgs","repos_url":"https://api.github.com/users/scott-codecov/repos","events_url":"https://api.github.com/users/scott-codecov/events{/privacy}","received_events_url":"https://api.github.com/users/scott-codecov/received_events","type":"User","site_admin":false},"body":"This + new function called ''testing'' performs a modulo operation. Consider renaming + the function to something more descriptive, e.g., mod or modulo.","created_at":"2023-11-20T14:51:32Z","updated_at":"2023-11-20T14:51:32Z","html_url":"https://github.com/scott-codecov/codecov-test/pull/40#discussion_r1399316027","pull_request_url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399316027"},"html":{"href":"https://github.com/scott-codecov/codecov-test/pull/40#discussion_r1399316027"},"pull_request":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40"}},"reactions":{"url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399316027/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0},"start_line":null,"original_start_line":null,"start_side":null,"line":57,"original_line":57,"side":"RIGHT","original_position":15,"position":15,"subject_type":"line"},{"url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399319213","pull_request_review_id":1740008775,"id":1399319213,"node_id":"PRRC_kwDOHO5Jtc5TZ-qt","diff_hunk":"@@ + -54,14 +54,5 @@ def mul4(x, y):\n def div4(x, y):\n return x / y\n \n-def + add5(x, y):","path":"main/foo.py","commit_id":"5c64a5143951193dde7b14c14611eebe1025f862","original_commit_id":"b607bb0e17e1b8d8699272a26e32986a933f9946","user":{"login":"scott-codecov","id":103445133,"node_id":"U_kgDOBipyjQ","avatar_url":"https://avatars.githubusercontent.com/u/103445133?v=4","gravatar_id":"","url":"https://api.github.com/users/scott-codecov","html_url":"https://github.com/scott-codecov","followers_url":"https://api.github.com/users/scott-codecov/followers","following_url":"https://api.github.com/users/scott-codecov/following{/other_user}","gists_url":"https://api.github.com/users/scott-codecov/gists{/gist_id}","starred_url":"https://api.github.com/users/scott-codecov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scott-codecov/subscriptions","organizations_url":"https://api.github.com/users/scott-codecov/orgs","repos_url":"https://api.github.com/users/scott-codecov/repos","events_url":"https://api.github.com/users/scott-codecov/events{/privacy}","received_events_url":"https://api.github.com/users/scott-codecov/received_events","type":"User","site_admin":false},"body":"It + looks like you''ve removed the add5 method. If this is being used elsewhere + in the codebase then its removal could cause issues. Please ensure that this + method isn''t being used elsewhere before removal.","created_at":"2023-11-20T14:53:54Z","updated_at":"2023-11-20T14:53:55Z","html_url":"https://github.com/scott-codecov/codecov-test/pull/40#discussion_r1399319213","pull_request_url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399319213"},"html":{"href":"https://github.com/scott-codecov/codecov-test/pull/40#discussion_r1399319213"},"pull_request":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40"}},"reactions":{"url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399319213/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0},"start_line":null,"original_start_line":null,"start_side":null,"line":57,"original_line":57,"side":"LEFT","original_position":4,"position":4,"subject_type":"line"},{"url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399319214","pull_request_review_id":1740008775,"id":1399319214,"node_id":"PRRC_kwDOHO5Jtc5TZ-qu","diff_hunk":"@@ + -54,14 +54,5 @@ def mul4(x, y):\n def div4(x, y):\n return x / y\n \n-def + add5(x, y):\n- return x + y\n-\n-def sub5(x, y):","path":"main/foo.py","commit_id":"5c64a5143951193dde7b14c14611eebe1025f862","original_commit_id":"b607bb0e17e1b8d8699272a26e32986a933f9946","user":{"login":"scott-codecov","id":103445133,"node_id":"U_kgDOBipyjQ","avatar_url":"https://avatars.githubusercontent.com/u/103445133?v=4","gravatar_id":"","url":"https://api.github.com/users/scott-codecov","html_url":"https://github.com/scott-codecov","followers_url":"https://api.github.com/users/scott-codecov/followers","following_url":"https://api.github.com/users/scott-codecov/following{/other_user}","gists_url":"https://api.github.com/users/scott-codecov/gists{/gist_id}","starred_url":"https://api.github.com/users/scott-codecov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scott-codecov/subscriptions","organizations_url":"https://api.github.com/users/scott-codecov/orgs","repos_url":"https://api.github.com/users/scott-codecov/repos","events_url":"https://api.github.com/users/scott-codecov/events{/privacy}","received_events_url":"https://api.github.com/users/scott-codecov/received_events","type":"User","site_admin":false},"body":"You''ve + removed the sub5 method. Like with the add5 method, make sure that it''s not + being used in other places in the codebase which could cause runtime issues.","created_at":"2023-11-20T14:53:54Z","updated_at":"2023-11-20T14:53:55Z","html_url":"https://github.com/scott-codecov/codecov-test/pull/40#discussion_r1399319214","pull_request_url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399319214"},"html":{"href":"https://github.com/scott-codecov/codecov-test/pull/40#discussion_r1399319214"},"pull_request":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40"}},"reactions":{"url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399319214/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0},"start_line":null,"original_start_line":null,"start_side":null,"line":60,"original_line":60,"side":"LEFT","original_position":7,"position":7,"subject_type":"line"},{"url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399319215","pull_request_review_id":1740008775,"id":1399319215,"node_id":"PRRC_kwDOHO5Jtc5TZ-qv","diff_hunk":"@@ + -54,14 +54,5 @@ def mul4(x, y):\n def div4(x, y):\n return x / y\n \n-def + add5(x, y):\n- return x + y\n-\n-def sub5(x, y):\n- return x - y\n-\n-def + mul5(x, y):","path":"main/foo.py","commit_id":"5c64a5143951193dde7b14c14611eebe1025f862","original_commit_id":"b607bb0e17e1b8d8699272a26e32986a933f9946","user":{"login":"scott-codecov","id":103445133,"node_id":"U_kgDOBipyjQ","avatar_url":"https://avatars.githubusercontent.com/u/103445133?v=4","gravatar_id":"","url":"https://api.github.com/users/scott-codecov","html_url":"https://github.com/scott-codecov","followers_url":"https://api.github.com/users/scott-codecov/followers","following_url":"https://api.github.com/users/scott-codecov/following{/other_user}","gists_url":"https://api.github.com/users/scott-codecov/gists{/gist_id}","starred_url":"https://api.github.com/users/scott-codecov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scott-codecov/subscriptions","organizations_url":"https://api.github.com/users/scott-codecov/orgs","repos_url":"https://api.github.com/users/scott-codecov/repos","events_url":"https://api.github.com/users/scott-codecov/events{/privacy}","received_events_url":"https://api.github.com/users/scott-codecov/received_events","type":"User","site_admin":false},"body":"The + mul5 method has been removed. If it is used elsewhere, this could cause potential + problems. Validate it before deleting.","created_at":"2023-11-20T14:53:54Z","updated_at":"2023-11-20T14:53:55Z","html_url":"https://github.com/scott-codecov/codecov-test/pull/40#discussion_r1399319215","pull_request_url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399319215"},"html":{"href":"https://github.com/scott-codecov/codecov-test/pull/40#discussion_r1399319215"},"pull_request":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40"}},"reactions":{"url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399319215/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0},"start_line":null,"original_start_line":null,"start_side":null,"line":63,"original_line":63,"side":"LEFT","original_position":10,"position":10,"subject_type":"line"},{"url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399319219","pull_request_review_id":1740008775,"id":1399319219,"node_id":"PRRC_kwDOHO5Jtc5TZ-qz","diff_hunk":"@@ + -54,14 +54,5 @@ def mul4(x, y):\n def div4(x, y):\n return x / y\n \n-def + add5(x, y):\n- return x + y\n-\n-def sub5(x, y):\n- return x - y\n-\n-def + mul5(x, y):\n- return x * y\n-\n-def div5(x, y):","path":"main/foo.py","commit_id":"5c64a5143951193dde7b14c14611eebe1025f862","original_commit_id":"b607bb0e17e1b8d8699272a26e32986a933f9946","user":{"login":"scott-codecov","id":103445133,"node_id":"U_kgDOBipyjQ","avatar_url":"https://avatars.githubusercontent.com/u/103445133?v=4","gravatar_id":"","url":"https://api.github.com/users/scott-codecov","html_url":"https://github.com/scott-codecov","followers_url":"https://api.github.com/users/scott-codecov/followers","following_url":"https://api.github.com/users/scott-codecov/following{/other_user}","gists_url":"https://api.github.com/users/scott-codecov/gists{/gist_id}","starred_url":"https://api.github.com/users/scott-codecov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scott-codecov/subscriptions","organizations_url":"https://api.github.com/users/scott-codecov/orgs","repos_url":"https://api.github.com/users/scott-codecov/repos","events_url":"https://api.github.com/users/scott-codecov/events{/privacy}","received_events_url":"https://api.github.com/users/scott-codecov/received_events","type":"User","site_admin":false},"body":"You''ve + also removed div5, again ensure it''s not being used anywhere else to prevent + bugs and exceptions.","created_at":"2023-11-20T14:53:54Z","updated_at":"2023-11-20T14:53:55Z","html_url":"https://github.com/scott-codecov/codecov-test/pull/40#discussion_r1399319219","pull_request_url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399319219"},"html":{"href":"https://github.com/scott-codecov/codecov-test/pull/40#discussion_r1399319219"},"pull_request":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40"}},"reactions":{"url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399319219/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0},"start_line":null,"original_start_line":null,"start_side":null,"line":66,"original_line":66,"side":"LEFT","original_position":13,"position":13,"subject_type":"line"},{"url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399319220","pull_request_review_id":1740008775,"id":1399319220,"node_id":"PRRC_kwDOHO5Jtc5TZ-q0","diff_hunk":"@@ + -54,14 +54,5 @@ def mul4(x, y):\n def div4(x, y):\n return x / y\n \n-def + add5(x, y):\n- return x + y\n-\n-def sub5(x, y):\n- return x - y\n-\n-def + mul5(x, y):\n- return x * y\n-\n-def div5(x, y):\n- return x / y\n+def + testing(x, y):","path":"main/foo.py","commit_id":"5c64a5143951193dde7b14c14611eebe1025f862","original_commit_id":"b607bb0e17e1b8d8699272a26e32986a933f9946","user":{"login":"scott-codecov","id":103445133,"node_id":"U_kgDOBipyjQ","avatar_url":"https://avatars.githubusercontent.com/u/103445133?v=4","gravatar_id":"","url":"https://api.github.com/users/scott-codecov","html_url":"https://github.com/scott-codecov","followers_url":"https://api.github.com/users/scott-codecov/followers","following_url":"https://api.github.com/users/scott-codecov/following{/other_user}","gists_url":"https://api.github.com/users/scott-codecov/gists{/gist_id}","starred_url":"https://api.github.com/users/scott-codecov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scott-codecov/subscriptions","organizations_url":"https://api.github.com/users/scott-codecov/orgs","repos_url":"https://api.github.com/users/scott-codecov/repos","events_url":"https://api.github.com/users/scott-codecov/events{/privacy}","received_events_url":"https://api.github.com/users/scott-codecov/received_events","type":"User","site_admin":false},"body":"This + new ''testing'' function''s name is not descriptive of its functionality. It + looks like it''s performing a modulus operation, not testing. You should name + this function appropriately.","created_at":"2023-11-20T14:53:55Z","updated_at":"2023-11-20T14:53:55Z","html_url":"https://github.com/scott-codecov/codecov-test/pull/40#discussion_r1399319220","pull_request_url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399319220"},"html":{"href":"https://github.com/scott-codecov/codecov-test/pull/40#discussion_r1399319220"},"pull_request":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40"}},"reactions":{"url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399319220/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0},"start_line":null,"original_start_line":null,"start_side":null,"line":57,"original_line":57,"side":"RIGHT","original_position":15,"position":15,"subject_type":"line"}]' + headers: + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, + X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, + X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, + X-GitHub-Request-Id, Deprecation, Sunset + Cache-Control: + - private, max-age=60, s-maxage=60 + Content-Encoding: + - gzip + Content-Security-Policy: + - default-src 'none' + Content-Type: + - application/json; charset=utf-8 + Date: + - Mon, 20 Nov 2023 14:57:34 GMT + ETag: + - W/"34bf2a70870a2944dfb55a2babeb2299d1d4add01673eb7b2200f5887a35b4f8" + Referrer-Policy: + - origin-when-cross-origin, strict-origin-when-cross-origin + Server: + - GitHub.com + Strict-Transport-Security: + - max-age=31536000; includeSubdomains; preload + Transfer-Encoding: + - chunked + Vary: + - Accept, Authorization, Cookie, X-GitHub-OTP + - Accept-Encoding, Accept, X-Requested-With + X-Accepted-OAuth-Scopes: + - '' + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + X-GitHub-Media-Type: + - github.v3 + X-GitHub-Request-Id: + - FA79:2E86:93B1E2:1320300:655B73DD + X-OAuth-Scopes: + - '' + X-RateLimit-Limit: + - '5000' + X-RateLimit-Remaining: + - '4985' + X-RateLimit-Reset: + - '1700494278' + X-RateLimit-Resource: + - core + X-RateLimit-Used: + - '15' + X-XSS-Protection: + - '0' + x-accepted-github-permissions: + - pull_requests=read + x-github-api-version-selected: + - '2022-11-28' + x-oauth-client-id: + - Iv1.88e0c58abd4e2e45 + http_version: HTTP/1.1 + status_code: 200 +- request: + body: '' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + connection: + - keep-alive + host: + - api.github.com + user-agent: + - Default + method: GET + uri: https://api.github.com/repos/scott-codecov/codecov-test/pulls/40/comments?per_page=100&page=2 + response: + content: '[]' + headers: + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, + X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, + X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, + X-GitHub-Request-Id, Deprecation, Sunset + Cache-Control: + - private, max-age=60, s-maxage=60 + Content-Length: + - '2' + Content-Security-Policy: + - default-src 'none' + Content-Type: + - application/json; charset=utf-8 + Date: + - Mon, 20 Nov 2023 14:57:34 GMT + ETag: + - '"75cdf323b1b22c1c1c5eb1332cd50eaeee03e9a548fea0444f4061d44b44dc0d"' + Link: + - ; + rel="prev", ; + rel="last", ; + rel="first" + Referrer-Policy: + - origin-when-cross-origin, strict-origin-when-cross-origin + Server: + - GitHub.com + Strict-Transport-Security: + - max-age=31536000; includeSubdomains; preload + Vary: + - Accept, Authorization, Cookie, X-GitHub-OTP + - Accept-Encoding, Accept, X-Requested-With + X-Accepted-OAuth-Scopes: + - '' + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + X-GitHub-Media-Type: + - github.v3 + X-GitHub-Request-Id: + - FA79:2E86:93B279:1320448:655B73DE + X-OAuth-Scopes: + - '' + X-RateLimit-Limit: + - '5000' + X-RateLimit-Remaining: + - '4984' + X-RateLimit-Reset: + - '1700494278' + X-RateLimit-Resource: + - core + X-RateLimit-Used: + - '16' + X-XSS-Protection: + - '0' + x-accepted-github-permissions: + - pull_requests=read + x-github-api-version-selected: + - '2022-11-28' + x-oauth-client-id: + - Iv1.88e0c58abd4e2e45 + http_version: HTTP/1.1 + status_code: 200 +- request: + body: '{"body": "Upon removal of add5, sub5, mul5, div5 functions from foo.py, + remember to update all call sites that reference these functions."}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '139' + content-type: + - application/json + host: + - api.github.com + user-agent: + - Default + method: PATCH + uri: https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399319213 + response: + content: '{"url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399319213","pull_request_review_id":1740008775,"id":1399319213,"node_id":"PRRC_kwDOHO5Jtc5TZ-qt","diff_hunk":"@@ + -54,14 +54,5 @@ def mul4(x, y):\n def div4(x, y):\n return x / y\n \n-def + add5(x, y):","path":"main/foo.py","commit_id":"5c64a5143951193dde7b14c14611eebe1025f862","original_commit_id":"b607bb0e17e1b8d8699272a26e32986a933f9946","user":{"login":"scott-codecov","id":103445133,"node_id":"U_kgDOBipyjQ","avatar_url":"https://avatars.githubusercontent.com/u/103445133?v=4","gravatar_id":"","url":"https://api.github.com/users/scott-codecov","html_url":"https://github.com/scott-codecov","followers_url":"https://api.github.com/users/scott-codecov/followers","following_url":"https://api.github.com/users/scott-codecov/following{/other_user}","gists_url":"https://api.github.com/users/scott-codecov/gists{/gist_id}","starred_url":"https://api.github.com/users/scott-codecov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scott-codecov/subscriptions","organizations_url":"https://api.github.com/users/scott-codecov/orgs","repos_url":"https://api.github.com/users/scott-codecov/repos","events_url":"https://api.github.com/users/scott-codecov/events{/privacy}","received_events_url":"https://api.github.com/users/scott-codecov/received_events","type":"User","site_admin":false},"body":"Upon + removal of add5, sub5, mul5, div5 functions from foo.py, remember to update + all call sites that reference these functions.","created_at":"2023-11-20T14:53:54Z","updated_at":"2023-11-20T14:57:34Z","html_url":"https://github.com/scott-codecov/codecov-test/pull/40#discussion_r1399319213","pull_request_url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399319213"},"html":{"href":"https://github.com/scott-codecov/codecov-test/pull/40#discussion_r1399319213"},"pull_request":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40"}},"reactions":{"url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399319213/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0},"start_line":null,"original_start_line":null,"start_side":null,"line":57,"original_line":57,"side":"LEFT","original_position":4,"position":4,"subject_type":"line"}' + headers: + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, + X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, + X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, + X-GitHub-Request-Id, Deprecation, Sunset + Cache-Control: + - private, max-age=60, s-maxage=60 + Content-Encoding: + - gzip + Content-Security-Policy: + - default-src 'none' + Content-Type: + - application/json; charset=utf-8 + Date: + - Mon, 20 Nov 2023 14:57:35 GMT + ETag: + - W/"ee80dc073626d7b6a7c7469e1fe400e969fafccce776eae5b2531d2245a88be8" + Referrer-Policy: + - origin-when-cross-origin, strict-origin-when-cross-origin + Server: + - GitHub.com + Strict-Transport-Security: + - max-age=31536000; includeSubdomains; preload + Transfer-Encoding: + - chunked + Vary: + - Accept, Authorization, Cookie, X-GitHub-OTP + - Accept-Encoding, Accept, X-Requested-With + X-Accepted-OAuth-Scopes: + - '' + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + X-GitHub-Media-Type: + - github.v3 + X-GitHub-Request-Id: + - FA7A:4171:9023DB:12ACDC0:655B73DE + X-OAuth-Scopes: + - '' + X-RateLimit-Limit: + - '5000' + X-RateLimit-Remaining: + - '4983' + X-RateLimit-Reset: + - '1700494278' + X-RateLimit-Resource: + - core + X-RateLimit-Used: + - '17' + X-XSS-Protection: + - '0' + x-accepted-github-permissions: + - pull_requests=write + x-github-api-version-selected: + - '2022-11-28' + x-oauth-client-id: + - Iv1.88e0c58abd4e2e45 + http_version: HTTP/1.1 + status_code: 200 +- request: + body: '{"body": "The new ''testing'' function uses the modulus operation. The + name doesn''t reflect this, consider renaming it to ''modulus'' or a name that + better reflects its functionality."}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '181' + content-type: + - application/json + host: + - api.github.com + user-agent: + - Default + method: PATCH + uri: https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399319220 + response: + content: '{"url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399319220","pull_request_review_id":1740008775,"id":1399319220,"node_id":"PRRC_kwDOHO5Jtc5TZ-q0","diff_hunk":"@@ + -54,14 +54,5 @@ def mul4(x, y):\n def div4(x, y):\n return x / y\n \n-def + add5(x, y):\n- return x + y\n-\n-def sub5(x, y):\n- return x - y\n-\n-def + mul5(x, y):\n- return x * y\n-\n-def div5(x, y):\n- return x / y\n+def + testing(x, y):","path":"main/foo.py","commit_id":"5c64a5143951193dde7b14c14611eebe1025f862","original_commit_id":"b607bb0e17e1b8d8699272a26e32986a933f9946","user":{"login":"scott-codecov","id":103445133,"node_id":"U_kgDOBipyjQ","avatar_url":"https://avatars.githubusercontent.com/u/103445133?v=4","gravatar_id":"","url":"https://api.github.com/users/scott-codecov","html_url":"https://github.com/scott-codecov","followers_url":"https://api.github.com/users/scott-codecov/followers","following_url":"https://api.github.com/users/scott-codecov/following{/other_user}","gists_url":"https://api.github.com/users/scott-codecov/gists{/gist_id}","starred_url":"https://api.github.com/users/scott-codecov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scott-codecov/subscriptions","organizations_url":"https://api.github.com/users/scott-codecov/orgs","repos_url":"https://api.github.com/users/scott-codecov/repos","events_url":"https://api.github.com/users/scott-codecov/events{/privacy}","received_events_url":"https://api.github.com/users/scott-codecov/received_events","type":"User","site_admin":false},"body":"The + new ''testing'' function uses the modulus operation. The name doesn''t reflect + this, consider renaming it to ''modulus'' or a name that better reflects its + functionality.","created_at":"2023-11-20T14:53:55Z","updated_at":"2023-11-20T14:57:35Z","html_url":"https://github.com/scott-codecov/codecov-test/pull/40#discussion_r1399319220","pull_request_url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399319220"},"html":{"href":"https://github.com/scott-codecov/codecov-test/pull/40#discussion_r1399319220"},"pull_request":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40"}},"reactions":{"url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/comments/1399319220/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0},"start_line":null,"original_start_line":null,"start_side":null,"line":57,"original_line":57,"side":"RIGHT","original_position":15,"position":15,"subject_type":"line"}' + headers: + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, + X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, + X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, + X-GitHub-Request-Id, Deprecation, Sunset + Cache-Control: + - private, max-age=60, s-maxage=60 + Content-Encoding: + - gzip + Content-Security-Policy: + - default-src 'none' + Content-Type: + - application/json; charset=utf-8 + Date: + - Mon, 20 Nov 2023 14:57:35 GMT + ETag: + - W/"8e9b3e8922c3274894baa8442d145f1321a199f55ba5dd972c351a3bfa6ecacc" + Referrer-Policy: + - origin-when-cross-origin, strict-origin-when-cross-origin + Server: + - GitHub.com + Strict-Transport-Security: + - max-age=31536000; includeSubdomains; preload + Transfer-Encoding: + - chunked + Vary: + - Accept, Authorization, Cookie, X-GitHub-OTP + - Accept-Encoding, Accept, X-Requested-With + X-Accepted-OAuth-Scopes: + - '' + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + X-GitHub-Media-Type: + - github.v3 + X-GitHub-Request-Id: + - FA7B:9369:20108A1:4335182:655B73DF + X-OAuth-Scopes: + - '' + X-RateLimit-Limit: + - '5000' + X-RateLimit-Remaining: + - '4982' + X-RateLimit-Reset: + - '1700494278' + X-RateLimit-Resource: + - core + X-RateLimit-Used: + - '18' + X-XSS-Protection: + - '0' + x-accepted-github-permissions: + - pull_requests=write + x-github-api-version-selected: + - '2022-11-28' + x-oauth-client-id: + - Iv1.88e0c58abd4e2e45 + http_version: HTTP/1.1 + status_code: 200 +- request: + body: '{"commit_id": "5c64a5143951193dde7b14c14611eebe1025f862", "body": "CodecovAI + submitted a new review for 5c64a5143951193dde7b14c14611eebe1025f862", "event": + "COMMENT", "comments": [{"path": "main/bar.py", "position": 9, "body": "add7 + function in bar.py is identically implemented as add6. Consider removing redundant + code."}, {"path": "main/bar.py", "position": 8, "body": "The new functions you''ve + added named add7, sub7, mul7, div7 are identical to some existing functions. + It is recommended to avoid duplicate functions, perhaps by creating a utility + function if the implementation across these functions is expected to remain + identical."}]}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '643' + content-type: + - application/json + host: + - api.github.com + user-agent: + - Default + method: POST + uri: https://api.github.com/repos/scott-codecov/codecov-test/pulls/40/reviews + response: + content: '{"id":1740017976,"node_id":"PRR_kwDOHO5Jtc5ntpE4","user":{"login":"scott-codecov","id":103445133,"node_id":"U_kgDOBipyjQ","avatar_url":"https://avatars.githubusercontent.com/u/103445133?u=1ea5f79283a26325f56e7cfa9eaca5cff3d538a4&v=4","gravatar_id":"","url":"https://api.github.com/users/scott-codecov","html_url":"https://github.com/scott-codecov","followers_url":"https://api.github.com/users/scott-codecov/followers","following_url":"https://api.github.com/users/scott-codecov/following{/other_user}","gists_url":"https://api.github.com/users/scott-codecov/gists{/gist_id}","starred_url":"https://api.github.com/users/scott-codecov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scott-codecov/subscriptions","organizations_url":"https://api.github.com/users/scott-codecov/orgs","repos_url":"https://api.github.com/users/scott-codecov/repos","events_url":"https://api.github.com/users/scott-codecov/events{/privacy}","received_events_url":"https://api.github.com/users/scott-codecov/received_events","type":"User","site_admin":false},"body":"CodecovAI + submitted a new review for 5c64a5143951193dde7b14c14611eebe1025f862","state":"COMMENTED","html_url":"https://github.com/scott-codecov/codecov-test/pull/40#pullrequestreview-1740017976","pull_request_url":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40","author_association":"OWNER","_links":{"html":{"href":"https://github.com/scott-codecov/codecov-test/pull/40#pullrequestreview-1740017976"},"pull_request":{"href":"https://api.github.com/repos/scott-codecov/codecov-test/pulls/40"}},"submitted_at":"2023-11-20T14:57:36Z","commit_id":"5c64a5143951193dde7b14c14611eebe1025f862"}' + headers: + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, + X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, + X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, + X-GitHub-Request-Id, Deprecation, Sunset + Cache-Control: + - private, max-age=60, s-maxage=60 + Content-Encoding: + - gzip + Content-Security-Policy: + - default-src 'none' + Content-Type: + - application/json; charset=utf-8 + Date: + - Mon, 20 Nov 2023 14:57:37 GMT + ETag: + - W/"a4514ce707ba155eb3dbfeaa0d9ad4da4ff272e8c63a4b61bad6cffd4c1b9f3a" + Referrer-Policy: + - origin-when-cross-origin, strict-origin-when-cross-origin + Server: + - GitHub.com + Strict-Transport-Security: + - max-age=31536000; includeSubdomains; preload + Transfer-Encoding: + - chunked + Vary: + - Accept, Authorization, Cookie, X-GitHub-OTP + - Accept-Encoding, Accept, X-Requested-With + X-Accepted-OAuth-Scopes: + - '' + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + X-GitHub-Media-Type: + - github.v3 + X-GitHub-Request-Id: + - FA7C:7CD2:981A2A:13ABB2E:655B73E0 + X-OAuth-Scopes: + - '' + X-RateLimit-Limit: + - '5000' + X-RateLimit-Remaining: + - '4981' + X-RateLimit-Reset: + - '1700494278' + X-RateLimit-Resource: + - core + X-RateLimit-Used: + - '19' + X-XSS-Protection: + - '0' + x-accepted-github-permissions: + - pull_requests=write + x-github-api-version-selected: + - '2022-11-28' + x-oauth-client-id: + - Iv1.88e0c58abd4e2e45 + http_version: HTTP/1.1 + status_code: 200 +version: 1 diff --git a/services/tests/test_ai_pr_review.py b/services/tests/test_ai_pr_review.py new file mode 100644 index 000000000..8c97aa21f --- /dev/null +++ b/services/tests/test_ai_pr_review.py @@ -0,0 +1,270 @@ +import json +from unittest.mock import PropertyMock + +import pytest +from shared.config import ConfigHelper +from shared.storage.exceptions import FileNotInStorageError + +from database.tests.factories import OwnerFactory, RepositoryFactory +from services.ai_pr_review import Diff, LineInfo, perform_review +from services.archive import ArchiveService + +TEST_DIFF = """diff --git a/codecov_auth/signals.py b/codecov_auth/signals.py +index d728f92f..37f333fb 100644 +--- a/codecov_auth/signals.py ++++ b/codecov_auth/signals.py +@@ -1,10 +1,13 @@ ++import json + import logging + from datetime import datetime + ++from django.conf import settings + from django.db.models.signals import post_save + from django.dispatch import receiver ++from google.cloud import pubsub_v1 + +-from codecov_auth.models import Owner, OwnerProfile ++from codecov_auth.models import OrganizationLevelToken, Owner, OwnerProfile + + + @receiver(post_save, sender=Owner) +@@ -13,3 +16,34 @@ def create_owner_profile_when_owner_is_created( + ): + if created: + return OwnerProfile.objects.create(owner_id=instance.ownerid) ++ ++ ++_pubsub_publisher = None ++ ++ ++def _get_pubsub_publisher(): ++ global _pubsub_publisher ++ if not _pubsub_publisher: ++ _pubsub_publisher = pubsub_v1.PublisherClient() ++ return _pubsub_publisher ++ ++ ++@receiver( ++ post_save, sender=OrganizationLevelToken, dispatch_uid="shelter_sync_org_token" ++) ++def update_repository(sender, instance: OrganizationLevelToken, **kwargs): ++ pubsub_project_id = settings.SHELTER_PUBSUB_PROJECT_ID ++ topic_id = settings.SHELTER_PUBSUB_SYNC_REPO_TOPIC_ID ++ if pubsub_project_id and topic_id: ++ publisher = _get_pubsub_publisher() ++ topic_path = publisher.topic_path(pubsub_project_id, topic_id) ++ publisher.publish( ++ topic_path, ++ json.dumps( ++ { ++ "type": "org_token", ++ "sync": "one", ++ "id": instance.id, ++ } ++ ).encode("utf-8"), ++ ) +diff --git a/codecov_auth/tests/test_signals.py b/codecov_auth/tests/test_signals.py +new file mode 100644 +index 00000000..b2fb0642 +--- /dev/null ++++ b/codecov_auth/tests/test_signals.py +@@ -0,0 +1,26 @@ ++import os ++ ++import pytest ++from django.test import override_settings ++ ++from codecov_auth.tests.factories import OrganizationLevelTokenFactory ++ ++ ++@override_settings( ++ SHELTER_PUBSUB_PROJECT_ID="test-project-id", ++ SHELTER_PUBSUB_SYNC_REPO_TOPIC_ID="test-topic-id", ++) ++@pytest.mark.django_db ++def test_shelter_org_token_sync(mocker): ++ # this prevents the pubsub SDK from trying to load credentials ++ os.environ["PUBSUB_EMULATOR_HOST"] = "localhost" ++ ++ publish = mocker.patch("google.cloud.pubsub_v1.PublisherClient.publish") ++ ++ # this triggers the publish via Django signals ++ OrganizationLevelTokenFactory(id=91728376) ++ ++ publish.assert_called_once_with( ++ "projects/test-project-id/topics/test-topic-id", ++ b'{"type": "org_token", "sync": "one", "id": 91728376}', ++ ) +diff --git a/core/signals.py b/core/signals.py +index 77500d63..adffea32 100644 +--- a/core/signals.py ++++ b/core/signals.py +@@ -18,12 +18,19 @@ def _get_pubsub_publisher(): + + + @receiver(post_save, sender=Repository, dispatch_uid="shelter_sync_repo") +-def update_repository(sender, instance, **kwargs): ++def update_repository(sender, instance: Repository, **kwargs): + pubsub_project_id = settings.SHELTER_PUBSUB_PROJECT_ID + topic_id = settings.SHELTER_PUBSUB_SYNC_REPO_TOPIC_ID + if pubsub_project_id and topic_id: + publisher = _get_pubsub_publisher() + topic_path = publisher.topic_path(pubsub_project_id, topic_id) + publisher.publish( +- topic_path, json.dumps({"sync": instance.repoid}).encode("utf-8") ++ topic_path, ++ json.dumps( ++ { ++ "type": "repo", ++ "sync": "one", ++ "id": instance.repoid, ++ } ++ ).encode("utf-8"), + ) +diff --git a/core/tests/test_signals.py b/core/tests/test_signals.py +index b6eafc65..26a8c8e2 100644 +--- a/core/tests/test_signals.py ++++ b/core/tests/test_signals.py +@@ -21,5 +21,6 @@ def test_shelter_repo_sync(mocker): + RepositoryFactory(repoid=91728376) + + publish.assert_called_once_with( +- "projects/test-project-id/topics/test-topic-id", b'{"sync": 91728376}' ++ "projects/test-project-id/topics/test-topic-id", ++ b'{"type": "repo", "sync": "one", "id": 91728376}', + ) +""" + +config_params = { + "services": { + "openai": { + "api_key": "placeholder", # replace this temporarily if you need to regenerate the VCR cassettes + }, + "minio": { + "hash_key": "test-hash", + }, + }, +} + +torngit_token = { + "key": "placeholder", # replace this temporarily if you need to regenerate the VCR cassettes + "secret": None, + "username": "scott-codecov", +} + + +def test_review_index(): + diff = Diff(TEST_DIFF) + assert diff.line_info(29) == LineInfo( + file_path="codecov_auth/signals.py", position=23 + ) + assert diff.line_info(123) == LineInfo( + file_path="core/tests/test_signals.py", position=6 + ) + + +@pytest.mark.asyncio +async def test_perform_initial_review( + dbsession, codecov_vcr, mocker, mock_configuration, mock_storage +): + mock_configuration.set_params(config_params) + + bot_token = mocker.patch("services.bots.get_repo_particular_bot_token") + bot_token.return_value = (torngit_token, None) + + owner = OwnerFactory.create(service="github", username="scott-codecov") + repository = RepositoryFactory.create(owner=owner, name="codecov-test") + dbsession.add(owner) + dbsession.add(repository) + dbsession.commit() + + archive = ArchiveService(repository) + + await perform_review(repository, 40) + + assert json.loads( + mock_storage.read_file( + "archive", f"ai_pr_review/{archive.storage_hash}/pull_40.json" + ) + ) == { + "commit_sha": "b607bb0e17e1b8d8699272a26e32986a933f9946", + "review_ids": [1740008775], + } + + +@pytest.mark.asyncio +async def test_perform_duplicate_review( + dbsession, codecov_vcr, mocker, mock_configuration, mock_storage +): + mock_configuration.set_params(config_params) + + bot_token = mocker.patch("services.bots.get_repo_particular_bot_token") + bot_token.return_value = (torngit_token, None) + + owner = OwnerFactory(service="github", username="scott-codecov") + repository = RepositoryFactory(owner=owner, name="codecov-test") + dbsession.add(owner) + dbsession.add(repository) + dbsession.commit() + + archive = ArchiveService(repository) + + mock_storage.write_file( + "archive", + f"ai_pr_review/{archive.storage_hash}/pull_40.json", + json.dumps( + { + "commit_sha": "b607bb0e17e1b8d8699272a26e32986a933f9946", + "review_ids": [1740008775], + } + ), + ) + + perform = mocker.patch("services.ai_pr_review.Review.perform") + perform.return_value = None + + await perform_review(repository, 40) + + # noop - we already made a review for this sha + assert not perform.called + + +@pytest.mark.asyncio +async def test_perform_new_commit( + dbsession, codecov_vcr, mocker, mock_configuration, mock_storage +): + mock_configuration.set_params(config_params) + + bot_token = mocker.patch("services.bots.get_repo_particular_bot_token") + bot_token.return_value = (torngit_token, None) + + owner = OwnerFactory(service="github", username="scott-codecov") + repository = RepositoryFactory(owner=owner, name="codecov-test") + dbsession.add(owner) + dbsession.add(repository) + dbsession.commit() + + archive = ArchiveService(repository) + + mock_storage.write_file( + "archive", + f"ai_pr_review/{archive.storage_hash}/pull_40.json", + json.dumps( + { + "commit_sha": "b607bb0e17e1b8d8699272a26e32986a933f9946", + "review_ids": [1740008775], + } + ), + ) + + await perform_review(repository, 40) + + assert json.loads( + mock_storage.read_file( + "archive", + f"ai_pr_review/{archive.storage_hash}/pull_40.json", + ) + ) == { + "commit_sha": "5c64a5143951193dde7b14c14611eebe1025f862", + "review_ids": [1740008775, 1740017976], + } diff --git a/tasks/__init__.py b/tasks/__init__.py index 7cedb97c2..399638db3 100644 --- a/tasks/__init__.py +++ b/tasks/__init__.py @@ -1,4 +1,5 @@ from app import celery_app +from tasks.ai_pr_review import ai_pr_view_task from tasks.backfill_commit_data_to_storage import backfill_commit_data_to_storage_task from tasks.brolly_stats_rollup import brolly_stats_rollup_task from tasks.commit_update import commit_update_task diff --git a/tasks/ai_pr_review.py b/tasks/ai_pr_review.py new file mode 100644 index 000000000..4ab709f28 --- /dev/null +++ b/tasks/ai_pr_review.py @@ -0,0 +1,51 @@ +import logging + +from celery.exceptions import SoftTimeLimitExceeded +from openai import AsyncOpenAI +from shared.config import get_config +from shared.torngit.base import TokenType +from sqlalchemy.orm.session import Session + +from app import celery_app +from database.models import Repository +from helpers.exceptions import RepositoryWithoutValidBotError +from services.ai_pr_review import perform_review +from services.repository import get_repo_provider_service +from tasks.base import BaseCodecovTask + +log = logging.getLogger(__name__) + + +class AiPrReviewTask(BaseCodecovTask, name="app.tasks.ai_pr_review.AiPrReview"): + throws = (SoftTimeLimitExceeded,) + + async def run_async( + self, + db_session: Session, + *, + repoid: int, + pullid: int, + **kwargs, + ): + log.info("Starting AI PR review task", extra=dict(repoid=repoid, pullid=pullid)) + + repository = db_session.query(Repository).filter_by(repoid=repoid).first() + assert repository + if repository.owner.service != "github": + log.warning("AI PR review only supports GitHub currently") + return {"successful": False, "error": "not_github"} + + try: + await perform_review(repository, pullid) + return {"successful": True} + except RepositoryWithoutValidBotError: + log.warning( + "No valid bot found for repo", + extra=dict(pullid=pullid, repoid=repoid), + exc_info=True, + ) + return {"successful": False, "error": "no_bot"} + + +RegisteredAiPrReviewTask = celery_app.register_task(AiPrReviewTask()) +ai_pr_view_task = celery_app.tasks[RegisteredAiPrReviewTask.name] diff --git a/tasks/sync_pull.py b/tasks/sync_pull.py index 2965cd863..c544e49a6 100644 --- a/tasks/sync_pull.py +++ b/tasks/sync_pull.py @@ -143,6 +143,10 @@ async def run_async_within_lock( "pull_updated": False, "reason": "not_in_provider", } + if read_yaml_field(current_yaml, ("ai_pr_review", "enabled"), False): + self.app.tasks["app.tasks.ai_pr_review.AiPrReview"].apply_async( + kwargs=dict(repoid=repoid, pullid=pullid) + ) report_service = ReportService(current_yaml) head_commit = pull.get_head_commit() if head_commit is None: diff --git a/tasks/tests/integration/test_ai_pr_review.py b/tasks/tests/integration/test_ai_pr_review.py new file mode 100644 index 000000000..d487b9e30 --- /dev/null +++ b/tasks/tests/integration/test_ai_pr_review.py @@ -0,0 +1,30 @@ +import pytest + +from database.tests.factories import OwnerFactory, RepositoryFactory +from tasks.ai_pr_review import AiPrReviewTask + + +@pytest.mark.integration +@pytest.mark.asyncio +async def test_ai_pr_review_task( + mocker, + dbsession, +): + owner = OwnerFactory(service="github") + repository = RepositoryFactory(owner=owner) + dbsession.add(owner) + dbsession.add(repository) + dbsession.flush() + + perform_review = mocker.patch("tasks.ai_pr_review.perform_review") + + task = AiPrReviewTask() + + result = await task.run_async( + dbsession, + repoid=repository.repoid, + pullid=123, + ) + + assert result == {"successful": True} + perform_review.assert_called_once_with(repository, 123)