-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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): Pass frame filename to find_roots #85931
ref(derived_code_mappings): Pass frame filename to find_roots #85931
Conversation
This change is in preparation of a follow-up change.
@@ -119,7 +119,7 @@ def post(self, request: Request, project) -> Response: | |||
|
|||
branch = installation.extract_branch_from_source_url(repo, source_url) | |||
source_path = installation.extract_source_path_from_source_url(repo, source_url) | |||
stack_root, source_root = find_roots(stack_path, source_path) | |||
stack_root, source_root = find_roots(FrameFilename({"filename": stack_path}), source_path) |
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.
A FrameFilename
has more information than stack_path
, thus, I can use it within find_roots
.
@@ -86,7 +90,7 @@ def __init__(self, frame: Mapping[str, Any]) -> None: | |||
self.full_path = frame_file_path | |||
self.extension = get_extension(frame_file_path) | |||
if not self.extension: | |||
raise UnsupportedFrameFilename("It needs an extension.") | |||
raise NeedsExtension("It needs an extension.") |
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.
"Unexpected format for stack_path or source_path", | ||
extra={"stack_path": stack_path, "source_path": source_path}, | ||
) | ||
logger.warning("Unexpected format for stack_path or source_path", extra=extra) |
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.
Changing it to warning
so I can inspect the errors in Sentry.
@@ -303,52 +301,76 @@ def test_list_file_matches_multiple(self) -> None: | |||
assert matches == expected_matches | |||
|
|||
def test_find_roots_starts_with_period_slash(self) -> None: | |||
stacktrace_root, source_path = find_roots("./app/", "static/app/") |
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 don't know why I originally wrote the tests without a filename at the end of the path. It does not make sense to me.
From looking at the calls, it is obvious that two full paths are used rather than base dirs:
sentry/src/sentry/issues/auto_source_code_config/code_mapping.py
Lines 159 to 163 in ed6ca20
stack_path = frame_filename.raw_path | |
source_path = file | |
try: | |
stack_root, source_root = find_roots(stack_path, source_path) |
Codecov ReportAttention: Patch coverage is ✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## master #85931 +/- ##
===========================================
+ Coverage 60.53% 87.89% +27.36%
===========================================
Files 9677 9686 +9
Lines 548684 549251 +567
Branches 21312 21312
===========================================
+ Hits 332130 482769 +150639
+ Misses 216238 66166 -150072
Partials 316 316 |
Suspect IssuesThis pull request was deployed and Sentry observed the following issues:
Did you find this useful? React with a 👍 or 👎 |
This change is in preparation for a follow-up change.
This change is in preparation for a follow-up change.