- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 371
 
Add cacheDirectory option #3369
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
Conversation
Add customCacheDirectory option
Revert mistaken merge
Add cache directory option
ref: Fixes for Add cacheDirectory option
| 
           Thanks for opening this PR. I'm sorry, @mlink, we did get to it this week. I will give you a review beginning next week.  | 
    
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.
Thanks for tackling this, @mlink 😃 . There are a couple of things to change, and please fix the failing unit tests.
Updated from prior closed PR to new PR number. Co-authored-by: Philipp Hofmann <[email protected]>
          Codecov Report
 Additional details and impacted files@@              Coverage Diff              @@
##              main     #3369       +/-   ##
=============================================
+ Coverage   88.940%   88.957%   +0.016%     
=============================================
  Files          522       524        +2     
  Lines        56178     56481      +303     
  Branches     19984     20345      +361     
=============================================
+ Hits         49965     50244      +279     
- Misses        5288      5315       +27     
+ Partials       925       922        -3     
 ... and 62 files with indirect coverage changes Continue to review full report in Codecov by Sentry. 
  | 
    
| 
           Thanks for all your changes @mlink 🙏 . Sorry, I didn't get to the PR today. It was a bit busy. Will try to give you another review tomorrow or Monday.  | 
    
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.
We're almost at the finish line. Thanks a lot for doing this, @mlink 👏
Co-authored-by: Philipp Hofmann <[email protected]>
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.
The PR looks good so far, but I found a blocking issue. The code now doesn't set the cache path properly for SentryCrash. Previously, it was something like
/Users/philipp.hofmann/Library/Developer/CoreSimulator/Devices/0E1EFAC8-A7EC-4B5B-88D6-68A3CD1E73AA/data/Containers/Data/Application/901E30F7-0741-4821-8FF9-ED7072792E53/Library/Caches/SentryCrash/iOS-Swift
And now it is
/Users/philipp.hofmann/Library/Developer/CoreSimulator/Devices/0E1EFAC8-A7EC-4B5B-88D6-68A3CD1E73AA/data/Containers/Data/Application/901E30F7-0741-4821-8FF9-ED7072792E53/Library/Caches
With the current approach, crashes from previous SDK versions wouldn't end up in Sentry and stay on the devices forever.
SentryCrash.getBasePath is called before setting the basePath in the SentryCrashInstallation.m. First, both paths need to match. Second, let's find a way to remove SentryCrash.getBasePath cause we need the customCacheDirectory of the options.
I found this bug by installing the iOS-Swift sample app of the main branch, crashing the sample app, checking this branch, launching the iOS-Swift sample app, and then the crash event never made it into Sentry.
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.
Thanks a lot for including all the feedback @mlink 🥇. Excellent work 👏 . We're close to merging this.
Co-authored-by: Philipp Hofmann <[email protected]>
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.
LGTM, thanks a lot for the contribution, @mlink, and for being patient with all my feedback. 💯 😃
📜 Description
This PR adds the ability for developers to specify a custom location for Sentry's cache location.
Updated PR that was closed awhile ago here #2711
💡 Motivation and Context
This option is useful in scenarios where the application hosting Sentry doesn't have read/write permissions for the default cache location. This is particularly relevant for macOS applications running prelogin
💚 How did you test it?
Built a security agent plugin with the fork, specified the cache location, and ran the plugin at the login window
📝 Checklist
You have to check all boxes before merging:
sendDefaultPIIis enabled.🔮 Next steps