Skip to content

[HOLD for payment 2024-11-11] [HOLD for payment 2024-11-05] [$250] De-dupe AddComment, EditComment, and DeleteComment requests #50074

Closed

Description

@roryabraham

Problem

When we make unnecessary network requests, it slows down the app and contributes to higher traffic on our servers. In particular:

  • if you are offline and you serialize multiple EditComment requests, only the last one will take effect
  • if you serialize both an AddComment and any number of EditComment requests, the result would be the same as one AddComment with the content of the final EditComment
  • if you serialize an AddComment followed by a DeleteComment, the end result is the same as not sending any network requests at all
  • if you serialize an EditComment request followed by a DeleteComment, the end result is the same as only sending the DeleteComment

Solution

De-dupe the network requests!

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021848400026446902359
  • Upwork Job ID: 1848400026446902359
  • Last Price Increase: 2024-10-21
  • Automatic offers:
    • dukenv0307 | Reviewer | 104528746
    • c3024 | Contributor | 104528756
Issue OwnerCurrent Issue Owner: @bfitzexpensify

Activity

  1. self-assigned this
    on Oct 2, 2024
  2. roryabraham commented on Oct 2, 2024

    @roryabraham
    ContributorAuthor
  3. gedu commented on Oct 2, 2024

    @gedu
    Contributor

    Hey, I'm Edu from Callstack, I can take this one

  4. shubham1206agra commented on Oct 2, 2024

    @shubham1206agra
    Contributor

    There are several obstacles to achieve this.

    1. if you are offline and you serialize multiple EditComment requests, only the last one will take effect

    The obstacle here is that if the request fails after replace call, it will show wrong comment.

    1. if you serialize an AddComment followed by a DeleteComment, the end result is the same as not sending any network requests at all

    This is tricky as we are now reducing the queue size.

  5. roryabraham commented on Oct 2, 2024

    @roryabraham
    ContributorAuthor

    The obstacle here is that if the request fails after replace call, it will show wrong comment.

    isn't that the case today with any EditComment request? Or is there something I'm missing?

  6. removed their assignment
    on Oct 4, 2024
  7. roryabraham commented on Oct 4, 2024

    @roryabraham
    ContributorAuthor

    Going on parental leave. @gedu @mountiny @shubham1206agra I leave this in your capable hands. My parting note is to please use as many automated tests to cover this change as possible 👍🏼

  8. gedu commented on Oct 7, 2024

    @gedu
    Contributor

    I just made a PR for OpenApp, I will start taking a look at this

  9. 70 remaining items

  10. melvin-bot commented on Oct 29, 2024

    @melvin-bot

    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:

    • [@c3024 / @dukenv0307] The PR that introduced the bug has been identified. Link to the PR:
    • [@c3024 / @dukenv0307] 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:
    • [@c3024 / @dukenv0307] 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:
    • [@c3024 / @dukenv0307] Determine if we should create a regression test for this bug.
    • [@c3024 / @dukenv0307] 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.
    • [@bfitzexpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
  11. mountiny commented on Oct 30, 2024

    @mountiny
    Contributor

    2 PRs been tested (#50919, #51422) and we merged the one that had more stuff in it. As a result we will pay $250 to both @c3024 and to @dukenv0307

  12. changed the title [-][HOLD for payment 2024-11-05] [$250] De-dupe AddComment, EditComment, and DeleteComment requests[/-] [+][HOLD for payment 2024-11-11] [HOLD for payment 2024-11-05] [$250] De-dupe AddComment, EditComment, and DeleteComment requests[/+] on Nov 4, 2024
  13. melvin-bot commented on Nov 4, 2024

    @melvin-bot

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

    If no regressions arise, payment will be issued on 2024-11-11. 🎊

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

  14. melvin-bot commented on Nov 4, 2024

    @melvin-bot

    @c3024 / @dukenv0307 @bfitzexpensify The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  15. dukenv0307 commented on Nov 5, 2024

    @dukenv0307
    Contributor

    BugZero Checklist:

    • The PR that introduced the bug has been identified. Link to the PR: This is the new implementation so there's no offending PR here
    • 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: N/A
    • 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: N/A
    • Determine if we should create a regression test for this bug. Yes
    • 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.

    Regression test:

    • Delete No requests:
    1. Go to offline
    2. send a message
    3. edit the message
    4. add a emoji reaction
    5. delete the message
    6. Go to online
    7. No requests should be sent
    • No delete Threads
    1. Go to offline
    2. Send a message
    3. create a thread
    4. delete that message
    5. Go to online
    6. All the request must be sent
    • Add + Update:
    1. Go offline
    2. Send a new message
    3. Edit that new message
    4. Go back online
    5. Only AddComment request with the Edited text should be sent
    • Multiple edit requests:
    1. Turn off internet connection
    2. Edit a single comment, save it.
    3. Repeat step 2 multiple times.
    4. Turn on internet connection
    5. Observe a single UpdateCommentsent to BE.

    Do we 👍 or 👎

  16. bfitzexpensify commented on Nov 8, 2024

    @bfitzexpensify
    Contributor

    Thanks all - payments complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorImprovementItem broken or needs improvement.

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions