Skip to content
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

[$250] [CRITICAL] [CVP] Track Expense - App crashes when tracking an expense #46879

Closed
1 of 6 tasks
lanitochka17 opened this issue Aug 6, 2024 · 27 comments
Closed
1 of 6 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@lanitochka17
Copy link

lanitochka17 commented Aug 6, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 9.0.17-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Issue reported by: Applause - Internal Team

Issue found when executing PR #43163

Action Performed:

  1. Sign in with a new account
  2. Go to FAB > Track Expense

Expected Result:

Track expense modal opens and user is able to track an expense

Actual Result:

App crashes

Workaround:

Unknown

Platforms:

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

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6563076_1722927494306.video_2024-08-06_09-55-47.mp4

Bug6563076_1722947936494!Capture22

logs (2).txt

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~019f114a28e4f405b1
  • Upwork Job ID: 1820938917945788496
  • Last Price Increase: 2024-08-13
  • Automatic offers:
    • ishpaul777 | Contributor | 103522001
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Aug 6, 2024
Copy link

melvin-bot bot commented Aug 6, 2024

Triggered auto assignment to @alexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@lanitochka17
Copy link
Author

We think that this bug might be related to #vip-vsp

@lanitochka17
Copy link
Author

@alexpensify FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

@m-natarajan m-natarajan changed the title Track Expense - App crashes when tracking an expense [CRITICAL]Track Expense - App crashes when tracking an expense Aug 6, 2024
@danielrvidal danielrvidal changed the title [CRITICAL]Track Expense - App crashes when tracking an expense [CRITICAL] [CVP] Track Expense - App crashes when tracking an expense Aug 6, 2024
@trjExpensify trjExpensify added the External Added to denote the issue can be worked on by a contributor label Aug 6, 2024
Copy link

melvin-bot bot commented Aug 6, 2024

Job added to Upwork: https://www.upwork.com/jobs/~019f114a28e4f405b1

@melvin-bot melvin-bot bot changed the title [CRITICAL] [CVP] Track Expense - App crashes when tracking an expense [$250] [CRITICAL] [CVP] Track Expense - App crashes when tracking an expense Aug 6, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 6, 2024
Copy link

melvin-bot bot commented Aug 6, 2024

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

@trjExpensify trjExpensify moved this to Release 2.5: SuiteWorld (Sept 9th) in [#whatsnext] #wave-collect Aug 6, 2024
@trjExpensify
Copy link
Contributor

@thienlnam here's another track expense flow bug, this time a crash and also seems to be referencing policyID -1 in the console error like #46338 (comment)

@jp928
Copy link
Contributor

jp928 commented Aug 7, 2024

Not reproducible on latest code base.

@trjExpensify
Copy link
Contributor

@danielrvidal how are you repro'ing this as soon as yesterday?

@danielrvidal
Copy link
Contributor

I'm reproducing it on production still as of now. @jp928 did you try it on mobile web?

I'm on Safari, private tab if it helps at all

@jp928
Copy link
Contributor

jp928 commented Aug 8, 2024

@danielrvidal
I tried with a new created account still fine to me. The console log shows it is a javascript error so it doesn't matter which browser it should reproducible cross all browsers. However, in the error the dodgy value policy_FAKE_ is the key of this bug.
I would assume it is a testing policy data for testing accounts. Sorry I couldn't test with your internal testing email boxes, but I would suggest to contact your backend team to investigate if you are adding special policy value to testing accounts, especially for the value of policy_FAKE_.

@melvin-bot melvin-bot bot added the Overdue label Aug 8, 2024
@danielrvidal
Copy link
Contributor

in the error the dodgy value policy_FAKE_

@trjExpensify any idea where this would be coming from? I would think it should be fake since I was testing in production?

Copy link

melvin-bot bot commented Aug 12, 2024

@alexpensify, @thesahindia Huh... This is 4 days overdue. Who can take care of this?

@alexpensify
Copy link
Contributor

Waiting for proposals here

@melvin-bot melvin-bot bot removed the Overdue label Aug 12, 2024
@jp928
Copy link
Contributor

jp928 commented Aug 12, 2024

Edited by proposal-police: This proposal was edited at 2024-08-13 11:06:39 UTC.

Proposal

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

Javascript throws fatal exception if the onyx collection key contains underscore, such as policy__FAKE_

What is the root cause of that problem?

In the code
https://github.com/Expensify/react-native-onyx/blob/397c2cba8fe5c2bdd5f0e6eaa6761043f1bf51a6/lib/OnyxUtils.ts#L409C3-L409C50

The last index of underscore is using for check if the key is valid so that policy__FAKE_ will be treated as invalid key.
Test case is like below:

function splitCollectionMemberKey(key) {
  let underscoreIndex = key.lastIndexOf('_');
  if (underscoreIndex + 1 === key.length) {
     underscoreIndex = key.lastIndexOf('__');
  }

  if (underscoreIndex === -1) {
      throw new Error(`Invalid ${key} key provided, only collection keys are allowed.`);
  };

  const collectionKey = key.substring(0, underscoreIndex + 1);
  const memberKey = key.substring(underscoreIndex + 1);
  return [collectionKey, memberKey];
}

The function isCollectionMemberKey will return false in this case.

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

Use indexOf instead of lastIndexOf to support the key contains multiple underscores, such as policy__FAKE_

What alternative solutions did you explore? (Optional)

Change the policy__FAKE_ from backend, such as policy_FAKE

@trjExpensify
Copy link
Contributor

@trjExpensify any idea where this would be coming from? I would think it should be fake since I was testing in production?

Yeah, that's used for off-workspace DMs:

App/src/libs/ReportUtils.ts

Lines 1178 to 1179 in ff2b888

* Checks if the supplied report belongs to workspace based on the provided params. If the report's policyID is _FAKE_ or has no value, it means this report is a DM.
* In this case report and workspace members must be compared to determine whether the report belongs to the workspace.

@trjExpensify
Copy link
Contributor

Thanks, @jp928. @thesahindia can you review that proposal? Also, CC'ing @hannojg for eyes from the blame. :)

@hannojg
Copy link
Contributor

hannojg commented Aug 13, 2024

@jp928 trying to understand your proposal I don't think this really returns 'collection', 'member', right? What does it actually return?

Screenshot 2024-08-13 at 11 40 20

@hannojg
Copy link
Contributor

hannojg commented Aug 13, 2024

Hm, we are having these test cases in onyx which expect the underscore for the collection to be at the end. These tests are failing with your proposal:

Screenshot 2024-08-13 at 11 47 36

@hannojg
Copy link
Contributor

hannojg commented Aug 13, 2024

While it may not be perfect we maybe want to consider handling the case for double __ or for FAKE explicitly

@jp928
Copy link
Contributor

jp928 commented Aug 13, 2024

While it may not be perfect we maybe want to consider handling the case for double __ or for FAKE explicitly

@hannojg SRY for confusing you. I will update my proposal. Cheers.

Copy link

melvin-bot bot commented Aug 13, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@trjExpensify
Copy link
Contributor

@thesahindia can you chime in on the proposal please?

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 14, 2024
Copy link

melvin-bot bot commented Aug 14, 2024

📣 @ishpaul777 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer 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 📖

@trjExpensify trjExpensify added the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 14, 2024
@ishpaul777
Copy link
Contributor

this has same root cause with #46805, A PR was deployed to production #46956 for fix. Can we request retest again?

@trjExpensify
Copy link
Contributor

Can't reproduce on mWeb Safari anymore myself, @danielrvidal can try for good measure and then we can close.

IMG_0540

@danielrvidal
Copy link
Contributor

danielrvidal commented Aug 14, 2024

I can't reproduce it either. Sorry, I didn't mean to close it. But I can't repro either so maybe we close it?

@github-project-automation github-project-automation bot moved this from Release 2.5: SuiteWorld (Sept 9th) to Done in [#whatsnext] #wave-collect Aug 14, 2024
@danielrvidal danielrvidal reopened this Aug 14, 2024
@trjExpensify
Copy link
Contributor

Yep, seems that linked PR fixed it. Closing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
No open projects
Status: Done
Development

No branches or pull requests

8 participants