Repository navigation
Description
Problem:
Each comment in the server database is stored in reportAction.message in HTML form. However, for some reason lost to time, when we send that same comment out as an Onyx update, we:
- Rename the original message in the database to
reportAction.originalMessagein the update (which is confusing) - Create a new
messageobject that contains a copy of thehtmlmessage, as well as a strippedtextversion. - Put the
messageobject inside a totally unnecessary one-element array
That means every comment is actually sent out three times (four, if you include the update to the report object, but that's out of scope for now). This is clearly wasteful in a number of ways:
- It requires postprocessing on the server to do this extraneous operation
- It increases network bandwidth by 3x
- It increases RAM use 3x
- It increases on-device storage 3x
- It's confusing AF
Additionally, it's particularly problematic when sending Onyx updates out via UrbanAirship, which is extremely limited in the payload sizes allowed -- with anything over a certain limit just dropped quietly and never delivered, causing "gaps" in our update stream (which require more network calls to "backfill" the Onyx data on app open, which makes things slow). Basically, this was just a mistake introduced for reasons we can't remember, but that we want to undo.
Solution:
To solve this, please:
- Phase 1 (External / clientside): Stop using
originalMessage, start using array-message- Update every instance of
originalMessage.htmlto usemessage.html || message[0].html - Update every instance of
message.textto dynamically strip the text frommessage.html || message[0].html - Update every key within originalMessage to use the original message
- Update every instance of
- Phase 2 (Internal / serverside): Once we've confirmed the client no longer uses
originalMessageormessage.textor any other key within originalMessage:- Stop sending
originalMessage - Start sending
messagewithout an array
- Stop sending
- Phase 3 (External / clientside): Remove checking for "array message"
This issue is for phase 1 and phase 3.
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~01856d1399295ef760
- Upwork Job ID: 1776729925881405440
- Last Price Increase: 2024-07-12
- Automatic offers:
- cubuspl42 | Reviewer | 0
Issue Owner
Current Issue Owner: @puneetlathMetadata
Metadata
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
[-]HIGH: [Reliability] Remove `text` from the `reportActions` sent to the client to reduce payload size[/-][+][$250] HIGH: [Reliability] Remove `text` from the `reportActions` sent to the client to reduce payload size[/+]melvin-bot commentedon Apr 6, 2024
Job added to Upwork: https://www.upwork.com/jobs/~01856d1399295ef760
melvin-bot commentedon Apr 6, 2024
Triggered auto assignment to Contributor-plus team member for initial proposal review - @cubuspl42 (
External)maxim-grin commentedon Apr 6, 2024
Hey I’m going to investigate why the payload is so big in Onyx storage. Possibly track what change exactly caused the problem. Then either revert that piece of change or use one of suggestions by @thienlnam
Contributor details
Your Expensify account email: maxim.grin@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~01fb7b172c01252917
melvin-bot commentedon Apr 6, 2024
📣 @maxim-grin! 📣
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:
Format:
maxim-grin commentedon Apr 6, 2024
Hey I’m going to investigate why the payload is so big in Onyx storage. Possibly track what change exactly caused the problem. Then either revert that piece of change or use one of suggestions by @thienlnam
Contributor details
Your Expensify account email: maxim.grin@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~01fb7b172c01252917
melvin-bot commentedon Apr 6, 2024
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
ShridharGoel commentedon Apr 7, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
We don't need to use
textfrom reportAction, it would be better to use originalMessage.html.What is the root cause of that problem?
New change.
textfrom message in reportAction is being used at multiple places.What changes do you think we should make in order to solve the problem?
We have text defined here:
App/src/types/onyx/ReportAction.ts
Lines 18 to 19 in f150229
Example usage:
App/src/components/ReportActionItem/ReportPreview.tsx
Line 173 in f150229
We can change this to:
Add the above in a common method
getActionMessagePostParsingin ReportUtils.Similarly, check all usages and update them to use the method mentioned above.
Finally, we can remove
text.There's one instance of
originalMessage?.htmlin ReportUtils.ts which also needs to be updated to use the common method.101 remaining items
melvin-bot commentedon Jul 3, 2024
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.3-7 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-07-10. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Jul 3, 2024
melvin-bot commentedon Jul 10, 2024
Payment Summary
Upwork Job
BugZero Checklist (@puneetlath)
[-][HOLD for payment 2024-07-10] [HOLD for payment 2024-07-02] LOW: [$250] Stop using `reportAction.originalMessage` or `reportAction.message.text`[/-][+][HOLD for payment 2024-07-10] [HOLD for payment 2024-07-02] LOW: [$500] Stop using `reportAction.originalMessage` or `reportAction.message.text`[/+]melvin-bot commentedon Jul 12, 2024
Upwork job price has been updated to $500
puneetlath commentedon Jul 12, 2024
@nkdengineer please accept offer here: https://www.upwork.com/nx/wm/offer/103096930
@c3024 please accept offer here: https://www.upwork.com/nx/wm/offer/103096934
Both of you, please ping me on this issue when you've accepted.
c3024 commentedon Jul 12, 2024
@puneetlath thanks, accepted!
puneetlath commentedon Jul 12, 2024
@c3024 has been paid. Just waiting for you now @nkdengineer.
nkdengineer commentedon Jul 12, 2024
@puneetlath Accepted thanks 🙇
puneetlath commentedon Jul 12, 2024
All paid. Thanks everyone!