Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.56k stars 2.9k forks source link

[HOLD for payment 2023-06-23] [$1000] Cache is not cleared completely after sign out of the app #19767

Closed kavimuru closed 2 months ago

kavimuru commented 1 year ago

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

  1. Perform few actions in the app
  2. Sign out of the app
  3. Open the app info

    Expected Result:

    All data and cache are cleared

    Actual Result:

    Still showing 144mb of data cached and 32 mb of user data

    Workaround:

    Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

Platforms:

Which of our officially supported platforms is this issue occurring on?

Version Number: 1.3.19-2 Reproducible in staging?: y Reproducible in production?: y If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs: https://stackoverflow.com/c/expensify/questions/4856 Notes/Photos/Videos: Any additional supporting documentation image (2)

Expensify/Expensify Issue URL: Issue reported by: @quinthar Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1684945967487669

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0121d019453eb06be4
  • Upwork Job ID: 1663667563279052800
  • Last Price Increase: 2023-06-06
melvin-bot[bot] commented 1 year ago

Triggered auto assignment to @sakluger (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

melvin-bot[bot] commented 1 year ago

Bug0 Triage Checklist (Main S/O)

allroundexperts commented 1 year ago

Proposal

Please re-state the problem that we are trying to solve in this issue.

App cache is not being cleared on logout

What is the root cause of that problem?

I could not find any place where we are clearing the storage on native devices on logout. This seems more like a feature to me.

What changes do you think we should make in order to solve the problem?

The problem at hand can be broken down into two parts.

The first part involves getting the path of the cache directory. We can get the path / location of the cache directory by using react-native-fs package. This library exposes a CachesDirectoryPath method that will give us the path to the cache directory.

The second part involves deleting the files present at the above path. This can be done by using unlink method that the react-native-fs package exposes. By supplying the path from step 1 to this method, all the cache of the app can be cleared.

What alternative solutions did you explore? (Optional)

We can also use this package to clear the app storage on logout. This package is forked from another package which wasn't working for RN > 0.60. If required, we can just copy the native files and use those directly in our code as custom native modules (https://reactnative.dev/docs/native-modules-android)

sakluger commented 1 year ago

Confirmed that the cache is not cleared after signing out. I tried sending an image and the cache change to 1.2MB, then I signed out and the cache was still at 1.2 MB.

melvin-bot[bot] commented 1 year ago

Job added to Upwork: https://www.upwork.com/jobs/~0121d019453eb06be4

melvin-bot[bot] commented 1 year ago

Current assignee @sakluger is eligible for the External assigner, not assigning anyone new.

melvin-bot[bot] commented 1 year ago

Triggered auto assignment to Contributor-plus team member for initial proposal review - @mollfpr (External)

melvin-bot[bot] commented 1 year ago

Triggered auto assignment to @alex-mechler (External), see https://stackoverflow.com/c/expensify/questions/7972 for more details.

rvenky125 commented 1 year ago

I'm willing to fix the issue, can I?

mollfpr commented 1 year ago

Reviewing proposal!

@rvenky125 Could you propose a solution? Thanks!

behind24proxies commented 1 year ago

full of bugs bruh

melvin-bot[bot] commented 1 year ago

πŸ“£ @behind24proxies! πŸ“£ Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:

  1. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  2. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  3. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details. Screen Shot 2022-11-16 at 4 42 54 PM Format:
    Contributor details
    Your Expensify account email: <REPLACE EMAIL HERE>
    Upwork Profile Link: <REPLACE LINK HERE>
rvenky125 commented 1 year ago

Reviewing proposal!

@rvenky125 Could you propose a solution? Thanks!

Can you pls assist me that how can I run the project with windows environment. I installed all node modules and if run npm run android, I'm getting that the scripts command not found.

alex-mechler commented 1 year ago

@rvenky125 have you followed the instructions here https://github.com/Expensify/App/blob/main/README.md#local-development?

Internally we do not use windows, so it is focused on MacOS. I would check https://reactnative.dev/docs/environment-setup?os=windows#development-os for setting up android on windows

melvin-bot[bot] commented 1 year ago

Triggered auto assignment to @kadiealexander (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

sakluger commented 1 year ago

Readded BZ label since I'm OOO next week.

alex-mechler commented 1 year ago

@mollfpr have you reviewed @allroundexperts's proposal? https://github.com/Expensify/App/issues/19767#issuecomment-1567533987

melvin-bot[bot] commented 1 year ago

πŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πŸ’Έ

mollfpr commented 1 year ago

Sorry for the delay πŸ™

We can also use this package to clear the app storage on logout. This package is forked from another package which wasn't working for RN > 0.60. If required, we can just copy the native files and use those directly in our code as custom native modules (https://reactnative.dev/docs/native-modules-android)

@alex-mechler I'm inclined to go with the alternative solution of @allroundexperts proposal. The reason is react-native-fs seems complicated to implement. What do you think?

alex-mechler commented 1 year ago

I agree, the alternative seems more straight forward here. Is there any concern about data we might not want cleared on logout? I don't think there is anything off the top of my head

allroundexperts commented 1 year ago

My two cents here are to go with approach 1. The reason is that libraries like react-native-fs are very well maintained and we might need to install them in the future anyway. The API for react-native-fs looks very straightforward to me as well.

alex-mechler commented 1 year ago

Great point about it being more well maintained. Its certainly preferable to use a well maintained library like that. @mollfpr do you have concerns with react-native-fs other than it being more complex @mollfpr?

mollfpr commented 1 year ago

I don't have other concerns on react-native-fs πŸ˜…

alex-mechler commented 1 year ago

Sounds good, lets go with @allroundexperts proposal then!

melvin-bot[bot] commented 1 year ago

πŸ“£ @allroundexperts You have been assigned to this job by @alex-mechler! Please apply to this job in Upwork and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review πŸ§‘β€πŸ’» Keep in mind: Code of Conduct | Contributing πŸ“–

allroundexperts commented 1 year ago

PR created https://github.com/Expensify/App/pull/20477

melvin-bot[bot] commented 1 year ago

Based on my calculations, the pull request did not get merged within 3 working days of assignment. Please, check out my computations here:

On to the next one πŸš€

melvin-bot[bot] commented 1 year ago

@sakluger, @alex-mechler, @mollfpr, @allroundexperts, @kadiealexander Whoops! This issue is 2 days overdue. Let's get this updated quick!

sakluger commented 1 year ago

Back from vacation, unassigning @kadiealexander. Also sent offers to @allroundexperts and @mollfpr so when the PR is deployed and settled we can pay out.

melvin-bot[bot] commented 1 year ago

Reviewing label has been removed, please complete the "BugZero Checklist".

melvin-bot[bot] commented 1 year ago

The solution for this issue has been :rocket: deployed to production :rocket: in version 1.3.28-5 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2023-06-23. :confetti_ball:

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

melvin-bot[bot] commented 1 year ago

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

michaelhaxhiu commented 1 year ago

I'm removing AlexM's assignment, and not going to trigger assignment of a new CME (since this is ready for payment at this stage!).

sakluger commented 1 year ago

Hey @mollfpr could you please make sure to complete the BZ checklist when you have a chance so that I can pay out the contracts tomorrow? Thanks!

sakluger commented 1 year ago

Bump @mollfpr on the BZ checklist.

mollfpr commented 1 year ago

Sorry for the delay @sakluger

[@mollfpr / @allroundexperts] The PR that introduced the bug has been identified. Link to the PR: [@mollfpr / @allroundexperts] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:

No offending PR. This is an improvement for the native app to clean the cache on sign-out.

[@mollfpr / @allroundexperts] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:

This is not a bug, so a regression test should be enough.

[@mollfpr / @allroundexperts] Determine if we should create a regression test for this bug.

Yes!

[@mollfpr / @allroundexperts] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.

Prerequisites installed New Expensify app.

For Android

  1. Go to Settings -> Storage -> Other Apps -> New Expensify
  2. Note the cache size, open the app, and log in to any account.
  3. Logout and do step 1
  4. Verify that the cache size is significantly less.

πŸ‘ or πŸ‘Ž

sakluger commented 1 year ago

Thanks! Regression test issue created, contracts paid, all done here!

mallenexpensify commented 2 months ago

This is happening to me on iOS, I can create a new bug report/issue, want to reopen now to see if anyone knows why it might be happening.

On iOS, latest staging build, testflight

sakluger commented 2 months ago

Hey @mallenexpensify, I think we should create a new GH issue instead so I'm going to close this one back out. Feel free to tag the relevant people on the new issue.

mallenexpensify commented 2 months ago

I guess that means no one knows why it might be happening 🧌 Reported in #expensify-bugs https://expensify.slack.com/archives/C049HHMV9SM/p1725058768402589