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

[HOLD for payment 2024-09-10] [$250] IOU - Message and Notification Swapping in IOU When Transitioning from Offline to Online #46393

Closed
6 tasks
lanitochka17 opened this issue Jul 28, 2024 · 49 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented Jul 28, 2024

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


Version Number: 9.0.13-3
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
Email or phone of affected tester (no customers): betlihemasfaw14@gmail.com
Issue reported by: Applause - Internal Team

Action Performed:

  1. Navigate to Workspace Chat > Plus Sign > Submit Expense
  2. Add amount and merchant, then confirm
  3. Go to IOU, switch to offline mode, and generate a notification by changing the date
  4. Write a message, then switch back to online mode. Notice the message and notification swap

Expected Result:

Messages and notifications should remain in place

Actual Result:

Messages and notifications swap in IOU when translated from offline to online

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

Bug6551162_1721788179924.Screen_Recording_2024-07-23_at_7.11.05_PM.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~017fdfd49bd9346b4c
  • Upwork Job ID: 1818663278050494650
  • Last Price Increase: 2024-08-14
  • Automatic offers:
    • nkdengineer | Contributor | 103525574
Issue OwnerCurrent Issue Owner: @greg-schroeder
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 28, 2024
Copy link

melvin-bot bot commented Jul 28, 2024

Triggered auto assignment to @greg-schroeder (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

@greg-schroeder 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

@nyomanjyotisa
Copy link
Contributor

nyomanjyotisa commented Jul 29, 2024

Proposal

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

Message and Notification Swapping in IOU When Transitioning from Offline to Online

What is the root cause of that problem?

The root cause of the problem is that the API call to update the date modifies the created value, which subsequently rearranges the positions of report actions. This occurs because the current sorting mechanism does not prioritize report actions with pendingAction equal to add.

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

Updating the sorting logic to ensure that report actions with pendingAction equals to 'add' are always positioned in the first of the list. This change will prevent the reordering of these actions due to API updates on the created value if there are some pending add actions left

Add the following code here

        if (first.pendingAction === 'add' && second.pendingAction !== 'add') {
            return 1  * invertedMultiplier;
        } else if (first.pendingAction !== 'add' && second.pendingAction === 'add') {
            return -1  * invertedMultiplier;
        }

What alternative solutions did you explore? (Optional)

@nkdengineer
Copy link
Contributor

nkdengineer commented Jul 29, 2024

Edited by proposal-police: This proposal was edited at 2024-08-08 10:23:22 UTC.

Proposal

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

Messages and notifications swap in IOU when translated from offline to online

What is the root cause of that problem?

After we update the money request, we call saveUpdateInformation here making the queue paused here

OnyxUpdates.saveUpdateInformation(responseToApply);

Then when the queue is unpaused, we merge the pending Onyx data from the response API to Onyx meanwhile other write APIs are not complete. created from BE is larger than other report actions makes the order change.

flushOnyxUpdatesQueue();

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

We can remove the flushOnyxUpdatesQueue here then we should update here to only update the Onyx data if the queue is empty because when the queue is paused, the process promise will be resolved immediately

if (PersistedRequests.getAll().length === 0) {
  flushOnyxUpdatesQueue();
}

flushOnyxUpdatesQueue();

What alternative solutions did you explore? (Optional)

@greg-schroeder greg-schroeder added the External Added to denote the issue can be worked on by a contributor label Jul 31, 2024
@melvin-bot melvin-bot bot changed the title IOU - Message and Notification Swapping in IOU When Transitioning from Offline to Online [$250] IOU - Message and Notification Swapping in IOU When Transitioning from Offline to Online Jul 31, 2024
Copy link

melvin-bot bot commented Jul 31, 2024

Job added to Upwork: https://www.upwork.com/jobs/~017fdfd49bd9346b4c

@melvin-bot melvin-bot bot added Overdue Help Wanted Apply this label when an issue is open to proposals by contributors labels Jul 31, 2024
Copy link

melvin-bot bot commented Jul 31, 2024

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

@melvin-bot melvin-bot bot removed the Overdue label Jul 31, 2024
@Ollyws
Copy link
Contributor

Ollyws commented Aug 1, 2024

@nkdengineer

We should check if the numberOfPersistedRequests is not 0 we will not merge the Onyx update to Onyx DB when the queue is unpaused

Hmm won't this have the effect of no Onyx updates being applied until ALL of the API requests are finished?
I imagine that could have alot of potential negative consequences as delay in a single request would stop all Onyx updates from other pending requests being applied.

@nkdengineer
Copy link
Contributor

Hmm won't this have the effect of no Onyx updates being applied until ALL of the API requests are finished?

@Ollyws Yes, currently if the queue isn't unpause, we still wait until ALL of write API are finished to merge the Onyx update here.

flushOnyxUpdatesQueue();

@Ollyws
Copy link
Contributor

Ollyws commented Aug 2, 2024

@nkdengineer It seems that after adding if (numberOfPersistedRequests === 0) { that flushOnyxUpdatesQueue() will never be called in any circumstances, or am I missing something?

@nkdengineer
Copy link
Contributor

@Ollyws it will be called here after all write APIs are complete.

flushOnyxUpdatesQueue();

@Ollyws
Copy link
Contributor

Ollyws commented Aug 2, 2024

Yes so it's effectively the same as removing flushOnyxUpdatesQueue() from the unpause() function, no?

@nkdengineer
Copy link
Contributor

@Ollyws Yeah, I think it's the same.

@Ollyws
Copy link
Contributor

Ollyws commented Aug 2, 2024

Hmm, it was specifically added this way in #25455, although I'm not exactly sure WHY we're running flushOnyxUpdatesQueue() before flush()...
It seems a little redundant but perhaps I'm missing something.

@nkdengineer
Copy link
Contributor

Let me check this again.

@nkdengineer
Copy link
Contributor

@Ollyws Confirmed in Slack here. We can move forward with this solution.

@melvin-bot melvin-bot bot added the Overdue label Aug 5, 2024
Copy link

melvin-bot bot commented Aug 5, 2024

@Ollyws, @greg-schroeder Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@Ollyws
Copy link
Contributor

Ollyws commented Aug 6, 2024

Thanks for opening a discussion, I'm just considering any adverse effects and will make a decision.

@melvin-bot melvin-bot bot removed the Overdue label Aug 6, 2024
Copy link

melvin-bot bot commented Aug 7, 2024

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

@Ollyws
Copy link
Contributor

Ollyws commented Aug 8, 2024

I'm still getting essentially the same problem even with flushOnyxUpdatesQueue() removed:

Screen.Recording.2024-08-08.at.11.59.09.mov

@Ollyws
Copy link
Contributor

Ollyws commented Aug 12, 2024

Actually I think it was a problem on my end, seems to be working fine now.

@Ollyws
Copy link
Contributor

Ollyws commented Aug 12, 2024

Let's move forward with @nkdengineer's proposal.
🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Aug 12, 2024

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

@Beamanator
Copy link
Contributor

Huh, @tgolen since you added some comments and concerns about the proposal in this issue, did you want to be assigned to review as well? 🤷 I'm happy to, just checking before I move forward here

@tgolen tgolen assigned tgolen and unassigned Beamanator Aug 13, 2024
@tgolen
Copy link
Contributor

tgolen commented Aug 13, 2024

Sure, I wouldn't mind keeping an eye on this one. I'll swap you out

@greg-schroeder
Copy link
Contributor

Okay, thanks @tgolen! Are you able to confirm the contributor assignment? #46393 (comment)

Copy link

melvin-bot bot commented Aug 14, 2024

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

@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

📣 @nkdengineer 🎉 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 📖

@tgolen
Copy link
Contributor

tgolen commented Aug 14, 2024

OK, yeah. Getting it assigned now. Let's not forget to test this with an ad-hoc build.

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Aug 15, 2024
@greg-schroeder
Copy link
Contributor

PR is still in review - seems QA identified several issues that'll need to be addressed

@tgolen
Copy link
Contributor

tgolen commented Aug 30, 2024

I'm checking with Applause to have those found issues verified against staging to see if they are happening in our main branch of code. If they are reproducible in staging, we can go ahead and merge the PR. If they are not, then @nkdengineer will need to investigate them more.

@tgolen
Copy link
Contributor

tgolen commented Sep 6, 2024

It looks like the PR has been merged and deployed to production, so I think this is just waiting on the regression period and payments @greg-schroeder.

@greg-schroeder
Copy link
Contributor

Ah, I guess it didn't get picked up by the automation. 🤔

@greg-schroeder greg-schroeder added Awaiting Payment Auto-added when associated PR is deployed to production and removed Reviewing Has a PR in review labels Sep 9, 2024
@greg-schroeder greg-schroeder changed the title [$250] IOU - Message and Notification Swapping in IOU When Transitioning from Offline to Online [HOLD for payment 2024-09-10] [$250] IOU - Message and Notification Swapping in IOU When Transitioning from Offline to Online Sep 9, 2024
@greg-schroeder
Copy link
Contributor

Regression period end 2024-09-10

@greg-schroeder
Copy link
Contributor

Payment summary:

Contributor: @nkdengineer - $250 - Paid via Upwork
C+: @Ollyws - $250 - You can make a manual request via ND for the reviewer role

@Ollyws
Copy link
Contributor

Ollyws commented Sep 11, 2024

Requested in ND.

@garrettmknight
Copy link
Contributor

$250 approved for @Ollyws

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
No open projects
Status: Done
Development

No branches or pull requests

9 participants