Skip to content

fix: Improve trimming of Swift function names #72335

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

Merged
merged 1 commit into from
Jun 18, 2024

Conversation

Steelskin
Copy link
Contributor

@Steelskin Steelskin commented Jun 7, 2024

Some Swift for Windows function names were trimmed to incorrect tokens in the UI, resulting in hard-to-read stack traces. For instance, some functions were shown as "throws" and closures were shown as "#1".

This change fixes the former issue by using the correct function name. Closures are now displayed as "closure in <function name>", and initialization expressions are displayed as "initializer expression of <value>", improving the user experience when browsing stack traces.

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jun 7, 2024
Copy link

codecov bot commented Jun 7, 2024

Codecov Report

Attention: Patch coverage is 84.21053% with 3 lines in your changes missing coverage. Please review.

Project coverage is 77.97%. Comparing base (b5d447d) to head (4ac9f33).
Report is 19 commits behind head on master.

Current head 4ac9f33 differs from pull request most recent head 100c85c

Please upload reports for the commit 100c85c to get more accurate results.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #72335   +/-   ##
=======================================
  Coverage   77.97%   77.97%           
=======================================
  Files        6583     6582    -1     
  Lines      293419   293501   +82     
  Branches    50629    50644   +15     
=======================================
+ Hits       228781   228870   +89     
+ Misses      58343    58330   -13     
- Partials     6295     6301    +6     
Files Coverage Δ
src/sentry/stacktraces/functions.py 96.02% <84.21%> (-0.28%) ⬇️

... and 25 files with indirect coverage changes

@Steelskin Steelskin force-pushed the fix-trim-swift-functions branch 2 times, most recently from 0e18148 to 4ac9f33 Compare June 7, 2024 21:48
Some Swift for Windows function names were trimmed to incorrect tokens
in the UI, resulting in hard-to-read stack traces. For instance, some
functions were shown as "throws" and closures were shown as "getsentry#1".

This change fixes the former issue by using the correct function name.
Closures are now displayed as "closure in <function name>", and
initialization expressions are displayed as "initializer expression of
<value>", improving the user experience when browsing stack traces.
@Steelskin Steelskin force-pushed the fix-trim-swift-functions branch from 4ac9f33 to 100c85c Compare June 7, 2024 22:33
@Steelskin Steelskin requested a review from a team as a code owner June 7, 2024 22:33
@JoshFerge JoshFerge added the Trigger: getsentry tests Once code is reviewed: apply label to PR to trigger getsentry tests label Jun 7, 2024
@JoshFerge
Copy link
Member

thanks for the PR! looking at this now. will make sure it gets reviewed.

Copy link
Contributor

@brustolin brustolin left a comment

Choose a reason for hiding this comment

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

Everything seems good to me, but I think we should keep the closure number.

A function (specially in SwiftUI) may have many closures.
closure #2 in MediaSlideshow.toSources sounds more helpful

@Steelskin
Copy link
Contributor Author

Everything seems good to me, but I think we should keep the closure number.

A function (specially in SwiftUI) may have many closures. closure #2 in MediaSlideshow.toSources sounds more helpful

The closure code is hard to parse, especially when we are dealing with closures in closures. Right now, on macOS, we just display closure. On Windows, we don't display the right closure number if we are in a closure in a closure. I feel like the current PR is an improvement for both cases. And with #72336 fixed, we can have the full prototype on hover.

@armenzg armenzg merged commit 79143bc into getsentry:master Jun 18, 2024
49 of 51 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jul 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Backend Automatically applied to PRs that change backend components Trigger: getsentry tests Once code is reviewed: apply label to PR to trigger getsentry tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants