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-10-18] [$1000] IOU - Not all Split bills are registered when leaving offline mode #25925

Closed lanitochka17 closed 1 year ago

lanitochka17 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. Open a New Expensify application
  2. Disable the internet connection in the device
  3. From the global create menu +, select Split bill
  4. Select any 3 participants and complete the IOU
  5. Repeat steps 3-4 2 times with the same participants
  6. Enable the Internet connection on your device

This bug also occurs in this workflow:

  1. Login as User A and User B in front of you at the same time.
  2. As User A requests Money from User B ( make sure it works by avoiding the bugs around the IOU feature Now )
  3. As User A go offline ( go to settings > preferences > turn on the offline mode ) - don't go offline as User B.
  4. As User A Send another Money request.
  5. As User B, Pay the first money request elsewhere.
  6. Back to User A and Go online again.
  7. Notice the Money request message for both users.

Expected Result:

All Split bills created in offline mode must be registered when you enable online mode

Actual Result:

When creating several Split bills for the same participants in offline mode, only the first Split bill is registered when going online, all others give an error

Workaround:

Unknown

Platforms:

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

Version Number: 1.3.57-1

Reproducible in staging?: Yes

Reproducible in production?: Yes

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

https://github.com/Expensify/App/assets/78819774/837a0945-96cf-4b2f-a19f-df119789e5d3

Expensify/Expensify Issue URL:

Issue reported by: Applause - Internal Team / @eusalazar

Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1692057275536929

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~010990d7cb2b15ce9f
  • Upwork Job ID: 1696572786341081088
  • Last Price Increase: 2023-09-19
melvin-bot[bot] commented 1 year ago

Triggered auto assignment to @zanyrenney (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)

melvin-bot[bot] commented 1 year ago

@zanyrenney Whoops! This issue is 2 days overdue. Let's get this updated quick!

zanyrenney commented 1 year ago

agree we need to level this up for offline<>online!

melvin-bot[bot] commented 1 year ago

Job added to Upwork: https://www.upwork.com/jobs/~010990d7cb2b15ce9f

melvin-bot[bot] commented 1 year ago

Current assignee @zanyrenney 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 - @aimane-chnaif (External)

AJV009 commented 1 year ago

could this be related as well? here too the offline<>online is a lil lost https://github.com/Expensify/App/issues/26099

zanyrenney commented 1 year ago

Good shout, I have asked the other BZ team member about their view on combining these.

zanyrenney commented 1 year ago

Maddy OOO so just waiting for her to be back to check on combining these.

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? ๐Ÿ’ธ

aimane-chnaif commented 1 year ago

Awaiting proposals

aimane-chnaif commented 1 year ago

Maddy OOO so just waiting for her to be back to check on combining these.

@zanyrenney Maddy answered here

maddylewis commented 1 year ago

updated OP with additional workflow!

zanyrenney commented 1 year ago

Thanks @aimane-chnaif and @maddylewis

tsa321 commented 1 year ago

Proposal --- For the fist workflow

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

Not all Split bills are registered when leaving offline mode

What is the root cause of that problem?

The server returns error response for second and later split bill requests because of incorrect logic used for detecting group chat report with same participants. The application trying to create split bills request using new/different reportID even though the participant is same and server refuse to create the bills because the report for the same participants is already exist and must use it and not create new report.

The detection of chat report with same pariticipant is in ReportUtils.getChatByParticipants:

https://github.com/Expensify/App/blob/b11bddc054f54bb46d5fb5aaf05e25b8a7df7faf/src/libs/ReportUtils.js#L2859-L2878

The function try to compare two array but sorted by different method, the first is using native javascript sort which is based on string sort and second array is using underscore.js sort which is based on number sort, so the result or order will be different even though the content of two array is same.

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

We could use same sort method for newParticipantList, so the code will be:

const sortedNewParticipantList = _.sortBy(newParticipantList)
....
....
return _.isEqual(sortedNewParticipantList, _.sortBy(report.participantAccountIDs));

What alternative solutions did you explore? (Optional)

Basically other methods or functions to compare two content of array of number correctly.

zanyrenney commented 1 year ago

@aimane-chnaif please explore the proposal.

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? ๐Ÿ’ธ

aimane-chnaif commented 1 year ago

@tsa321 can you please share 2 videos before and after applying solution?

tsa321 commented 1 year ago

@aimane-chnaif

Issue's video...
https://github.com/Expensify/App/assets/114975543/2cd8070c-538a-4702-944e-256f98048d53
Fix video...
https://github.com/Expensify/App/assets/114975543/26df8513-6dbe-4b77-9f07-9351cbce261a
melvin-bot[bot] commented 1 year ago

@zanyrenney @aimane-chnaif this issue is now 3 weeks old. There is one more week left before this issue breaks WAQ and will need to go internal. What needs to happen to get a PR in review this week? Please create a thread in #expensify-open-source to discuss. Thanks!

zanyrenney commented 1 year ago

@aimane-chnaif the proposal above looks good, can you check please so we can move ahead with this? We are close to breaking WAQ otherwise.

aimane-chnaif commented 1 year ago

@tsa321 thanks for sharing demo. Does your solution also fix https://github.com/Expensify/App/issues/26099 which was closed in favor of this one?

tsa321 commented 1 year ago

@aimane-chnaif No, the fix is only for the first workflow. Because, the root of the problem is different. For the second workflow, the problem is because user B already paid the money request of user A while user A goes offline, then subsequent money request by user A will be based on outdated report action IOU preview (because it already paid). The server will give error response, because we need to make subsequent money request of user A based on new report action IOU preview (not already paid one) and server give error response. But the server response is CONST.ERROR.DUPLICATE_RECORD

https://github.com/Expensify/App/blob/76b691482af9c8d9d798e0f53991d60a90ebebd0/src/libs/Network/SequentialQueue.js#L84

The server detect that the money request is duplicate then the onyx failure data will not be processed. The request will just be ignored and no error sign (red circle) will be shown.

As for current offline infrastructure, I don't know how to fix the second workflow problem based on onyx update of failure data, I think to fix it we need some sort of callback when reconnect...

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? ๐Ÿ’ธ

zanyrenney commented 1 year ago

That's fine to tackle separately, I reopened the other GH issue and explained that. @aimane-chnaif please can you re-review the proposal for this now? Thanks!

melvin-bot[bot] commented 1 year ago

@zanyrenney @aimane-chnaif this issue is now 4 weeks old and preventing us from maintaining WAQ, can you:

Thanks!

melvin-bot[bot] commented 1 year ago

Current assignee @aimane-chnaif is eligible for the Internal assigner, not assigning anyone new.

zanyrenney commented 1 year ago

@aimane-chnaif should we increase the bounty again here? How complex would you say this is?

zanyrenney commented 1 year ago

@aimane-chnaif seeing as @tsa321 proposal solved this, but not the related issue, i think this proposal would now be sufficient seeing as we are not combining the issues.

please can you review their proposal again and assign them if the proposal seems sufficient.

zanyrenney commented 1 year ago

Bump @aimane-chnaif please can you reply to me on the above?

zanyrenney commented 1 year ago

https://expensify.slack.com/archives/C01GTK53T8Q/p1696235633005159 asked in slack for more visibility.

zanyrenney commented 1 year ago

Still not seeing the feedback, bumping again in slack.

aimane-chnaif commented 1 year ago

@tsa321's proposal looks good to me. ๐ŸŽ€ ๐Ÿ‘€ ๐ŸŽ€ C+ reviewed

melvin-bot[bot] commented 1 year ago

Triggered auto assignment to @tylerkaraszewski, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

tsa321 commented 1 year ago

Thank you, my plan is to make the PR within one or two days.

tsa321 commented 1 year ago

@aimane-chnaif PR is ready

tsa321 commented 1 year ago

The PR has been merged at 6 October 9:35PM (UTC time), but the melvin bot doesn't post information about the merging. Maybe because of the external label isn't attached?

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.80-3 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-10-18. :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.

For reference, here are some details about the assignees on this issue:

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:

zanyrenney commented 1 year ago

@tylerkaraszewski please can you check the timeframes for this based on this comment? https://github.com/Expensify/App/issues/25925#issuecomment-1756418223

I want to proceed with the payment but I would like a second opinion on any urgency bonus as it is not visible in this issue.

aimane-chnaif commented 1 year ago

yes bonus applies.

Assign: Oct 4 (https://github.com/Expensify/App/issues/25925#event-10555537069) Merge: Oct 6 (https://github.com/Expensify/App/pull/28882#event-10579905976)

zanyrenney commented 1 year ago

unfortunately the original job post has closed. https://www.upwork.com/jobs/~01fc8ba64ab4045ff1

please reapply to this job for payout @aimane-chnaif @tsa321

Thanks!

zanyrenney commented 1 year ago

@tsa321 especially you as i do not have any upwork details for you.

tsa321 commented 1 year ago

@zanyrenney I have applied to the upwork job just now.

zanyrenney commented 1 year ago

great, just waiting on @aimane-chnaif now.

aimane-chnaif commented 1 year ago

great, just waiting on @aimane-chnaif now.

Accepted invite

aimane-chnaif commented 1 year ago

@zanyrenney I am not able to accept offer. Error occurs.

Untitled

zanyrenney commented 1 year ago

I just resent it to you @aimane-chnaif - let me know?