-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ref(derived_code_mappings): Refactor endpoint #84318
base: master
Are you sure you want to change the base?
Conversation
This also makes the code less coupled to the GitHub integration.
@@ -286,29 +285,6 @@ def has_repo_access(self, repo: RpcRepository) -> bool: | |||
return False | |||
return True | |||
|
|||
# XXX: To be removed after we switch over to the new repo trees integration code | |||
def get_trees_for_org_old(self, cache_seconds: int = 3600 * 24) -> dict[str, RepoTree]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should have removed this in #84164
@@ -45,6 +48,23 @@ class UnsupportedFrameFilename(Exception): | |||
pass | |||
|
|||
|
|||
def derive_code_mappings( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the code the endpoint is going to call.
Eventually, I will unify this code and the one the task calls.
SUPPORTED_INTEGRATIONS = ["github"] | ||
|
||
|
||
def get_installation( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function comes from the task module but it needs to be shared.
@@ -71,6 +73,9 @@ def process_event(project_id: int, group_id: int, event_id: str) -> None: | |||
logger.info("No installation or organization integration found.", extra=extra) | |||
return | |||
|
|||
if not isinstance(installation, RepoTreesIntegration): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class is what gives an integration the get_trees_for_org
method.
@@ -184,30 +189,6 @@ def get_stacktrace(data: NodeData) -> list[Mapping[str, Any]]: | |||
return [] | |||
|
|||
|
|||
def get_installation( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to a shared module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm moving code from here into the code_mapping
module.
resp_status: Literal[200, 204, 400] = status.HTTP_400_BAD_REQUEST | ||
|
||
if stacktrace_filename: | ||
possible_code_mappings = derive_code_mappings(organization, stacktrace_filename) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All code mapping-related code has been moved within this call.
❌ 27 Tests Failed:
View the top 3 failed tests by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
This also makes the code less coupled to the GitHub integration.