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 2023-03-13] [$2000] Sending/Editing message counts the typed characters in the UI & not the html characters which causes the api request to fail. #14268

Closed
2 of 6 tasks
kavimuru opened this issue Jan 13, 2023 · 82 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@kavimuru
Copy link

kavimuru commented Jan 13, 2023

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. Go to any chat/report
  2. Send/Edit a comment to have a text that has*a* 3333 times.
  3. The message will fail to send/update.

Expected Result:

We should only allow sending the number of characters that BE can accept. i.e while sending we should calculate the length of the final html converted text instead of the typed characters

Actual Result:

The message fails to send/update with "402 Maximum Size Exceeded message" error

Workaround:

unknown

Platforms:

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

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.2.53-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:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos:

Screen.Recording.2023-01-13.at.3.32.14.AM.mov
Recording.1280.mp4

Expensify/Expensify Issue URL:
Issue reported by: @priyeshshah11
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1673541273533429

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~010b95e20b95c70ed7
  • Upwork Job ID: 1614963723426578432
  • Last Price Increase: 2023-02-24
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jan 13, 2023
@melvin-bot melvin-bot bot locked and limited conversation to collaborators Jan 13, 2023
@melvin-bot melvin-bot bot added the Overdue label Jan 16, 2023
@flaviadefaria flaviadefaria added the External Added to denote the issue can be worked on by a contributor label Jan 16, 2023
@melvin-bot melvin-bot bot unlocked this conversation Jan 16, 2023
@melvin-bot melvin-bot bot changed the title Sending/Editing message counts the typed characters in the UI & not the html characters which causes the api request to fail. [$1000] Sending/Editing message counts the typed characters in the UI & not the html characters which causes the api request to fail. Jan 16, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jan 16, 2023

Job added to Upwork: https://www.upwork.com/jobs/~010b95e20b95c70ed7

@melvin-bot
Copy link

melvin-bot bot commented Jan 16, 2023

Current assignee @flaviadefaria is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented Jan 16, 2023

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jan 16, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jan 16, 2023

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

@flaviadefaria
Copy link
Contributor

Added the external label. Now waiting for proposals.

@melvin-bot melvin-bot bot removed the Overdue label Jan 16, 2023
@0xmiroslav
Copy link
Contributor

0xmiroslav commented Jan 16, 2023

This is duplicated with #13988
I think this is backend issue and we need to make it consistent between the behaviors of send message and edit message.
Edit message works fine.

error.mov

@priyeshshah11
Copy link
Contributor

priyeshshah11 commented Jan 16, 2023

Proposal

Problem

As the description says we don't count the actual sending characters, instead we just count the typed characters to determine a valid length.

Solution 1

Count the html parsed characters and limit it to 60K as that is the limit that has been set in the backend/DB.

Solution 2

Send the non-parsed message if the parsed html message exceeds the 60K character limit as that is the limit that has been set in the backend/DB. Also, currently we don't parse text to MD/HTML when the text is above 10K characters so this can be a good enough solution.

diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js
index 45b9319a4..706846268 100644
--- a/src/libs/ReportUtils.js
+++ b/src/libs/ReportUtils.js
@@ -651,16 +651,17 @@ function buildOptimisticReportAction(sequenceNumber, text, file) {
     // For longer comments, skip parsing and display plaintext for performance reasons. It takes over 40s to parse a 100k long string!!
     const parser = new ExpensiMark();
     const commentText = text.length < 10000 ? parser.replace(text) : text;
+    const finalCommentText = commentText < 60000 ? commentText : text;
     const isAttachment = _.isEmpty(text) && file !== undefined;
     const attachmentInfo = isAttachment ? file : {};
-    const htmlForNewComment = isAttachment ? 'Uploading Attachment...' : commentText;
+    const htmlForNewComment = isAttachment ? 'Uploading Attachment...' : finalCommentText;
 
     // Remove HTML from text when applying optimistic offline comment
     const textForNewComment = isAttachment ? '[Attachment]'
         : parser.htmlToText(htmlForNewComment);
 
     return {
-        commentText,
+        commentText: finalCommentText,
         reportAction: {
             reportActionID: NumberUtils.rand64(),
             actionName: CONST.REPORT.ACTIONS.TYPE.ADDCOMMENT,

@s77rt
Copy link
Contributor

s77rt commented Jan 16, 2023

a duplicate, please close.

Edit: This seems slightly a different issue than the one linked, Maybe it should be on hold till we figure out a solution for the first issue

@puneetlath puneetlath changed the title [$1000] Sending/Editing message counts the typed characters in the UI & not the html characters which causes the api request to fail. [HOLD #13988] [$1000] Sending/Editing message counts the typed characters in the UI & not the html characters which causes the api request to fail. Jan 17, 2023
@puneetlath
Copy link
Contributor

Yes, I agree let's hold on #13988. Whether or not we can close this I think will depend on the solution we land on in that issue.

@flaviadefaria I'm going to remove the External/Help Wanted labels and the assignment for me/Manan. Feel free to re-add the External label to get people assigned once #13988 is resolved. Thanks!

@puneetlath puneetlath added Weekly KSv2 and removed External Added to denote the issue can be worked on by a contributor Daily KSv2 Help Wanted Apply this label when an issue is open to proposals by contributors labels Jan 17, 2023
@melvin-bot melvin-bot bot added the Overdue label Jan 30, 2023
@MelvinBot
Copy link

MelvinBot commented Mar 6, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.2.78-0 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 2023-03-13. 🎊

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.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@MelvinBot
Copy link

MelvinBot commented Mar 6, 2023

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:

  • [@aimane-chnaif / @francoisl] The PR that introduced the bug has been identified. Link to the PR: N/A - not a regression, the component already behaved like this from the start
  • [@aimane-chnaif / @francoisl] 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
  • [@aimane-chnaif / @francoisl] 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
  • [@redstar504] Propose regression test steps to ensure the same bug will not reach production again.
  • [@flaviadefaria] Link the GH issue for creating/updating the regression test once above steps have been agreed upon: https://github.com/Expensify/Expensify/issues/269975

@flaviadefaria flaviadefaria added Daily KSv2 and removed Weekly KSv2 labels Mar 9, 2023
@flaviadefaria
Copy link
Contributor

Moving this to daily so I can remember to pay it 😅

@melvin-bot melvin-bot bot added Daily KSv2 and removed Daily KSv2 labels Mar 12, 2023
@redstar504
Copy link
Contributor

Regression Test Proposal

  • Bug: Markdown characters in comments are not counted as their transformed HTML length, and therefore allow sending amounts that exceed the back-end limit.

  • Proposed test steps:

  1. Go to URL https://staging.new.expensify.com/
  2. Log in with any account
  3. Navigate to any conversation
  4. Focus on the compose box
  5. Paste the following string:
*b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b*
  1. Remove any surrounding backticks and spaces
  2. Verify the message cannot be sent (should exceed comment length)
  3. Remove one sequence of *b* characters, so you are left with the following string:
*b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b**b*
  1. Remove any surrounding backticks and spaces
  2. Verify the message can now be sent

Do we agree 👍 or 👎

cc @aimane-chnaif @francoisl

Also @aimane-chnaif, for your steps, I do not believe there will be a PR on the front-end that is the source of this bug. It was an oversight when creating the comment counter, and the source PR would ultimately be on the back-end when the auth limit was instated.

@MelvinBot
Copy link

@redstar504, @francoisl, @flaviadefaria, @aimane-chnaif Whoops! This issue is 2 days overdue. Let's get this updated quick!

@melvin-bot melvin-bot bot added the Overdue label Mar 17, 2023
@francoisl
Copy link
Contributor

I updated the BZ checklist above, @flaviadefaria we'll just need to issue the payments and create a GH issue to add these regression steps. Thanks!

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Mar 17, 2023
@redstar504
Copy link
Contributor

@flaviadefaria Can we get payments sorted? The bonus should apply and we still need to be invited to Upwork. Thanks.

@melvin-bot melvin-bot bot removed the Overdue label Mar 20, 2023
@aimane-chnaif
Copy link
Contributor

@flaviadefaria Can we get payments sorted? The bonus should apply and we still need to be invited to Upwork. Thanks.

Hope she will be back soon. Last week everyone was busy at ECX 🚀

@aimane-chnaif
Copy link
Contributor

@flaviadefaria Thanks for the quick response. Accepted your offer.

@flaviadefaria
Copy link
Contributor

Sorry for the delay here! I've sent all offers and will issue payment now - $2000 + $1000 bonus = $3000 for @aimane-chnaif and @redstar504

And $250 to @priyeshshah11 for reporting the bug.

@priyeshshah11
Copy link
Contributor

Sorry for the delay here! I've sent all offers and will issue payment now - $2000 + $1000 bonus = $3000 for @aimane-chnaif and @redstar504

And $250 to @priyeshshah11 for reporting the bug.

Thanks @flaviadefaria, received the offer but isn't it $1000 for reporting these days?

@flaviadefaria
Copy link
Contributor

Thanks @flaviadefaria, received the offer but isn't it $1000 for reporting these days?

Hm I didn't think so, but let me double-check and I'll get back to you.

@flaviadefaria
Copy link
Contributor

@priyeshshah11 I just got confirmation that reporting bugs is still at $250. As soon as you accept the offer I'll issue you the payment. Thanks!

@priyeshshah11
Copy link
Contributor

@priyeshshah11 I just got confirmation that reporting bugs is still at $250. As soon as you accept the offer I'll issue you the payment. Thanks!

My bad, Thanks for checking @flaviadefaria 😄

@flaviadefaria
Copy link
Contributor

No problem! I just issued your payment :)

@michaelhaxhiu
Copy link
Contributor

ps @priyeshshah11 if you are unsure in the future, we always update the contributing.md file to state the current payout rates for jobs and bug reporting:

https://github.com/Expensify/App/blob/main/contributingGuides/CONTRIBUTING.md#proposing-a-job-that-expensify-hasnt-posted

@flaviadefaria
Copy link
Contributor

image

Coming from these updated instructions @aimane-chnaif where in TestRail would you propose these testing steps be added?

This is what I need:

  • Say to which section the new step should be added, and after which existing step it should be inserted
  • If possible, copy a link to that exact step in TestRail into your issue (you can click on every single step in TestRail)

I had a quick look in TR and I think we should add it within Copy Function test, but not really sure if in an existing folder or a new one.

image

@aimane-chnaif
Copy link
Contributor

@flaviadefaria Oh, there was a discussion where C+ doesn't need to propose testing steps in TestRail. Can you please confirm?

@flaviadefaria
Copy link
Contributor

Oh interesting, ok let me double-check.

@flaviadefaria
Copy link
Contributor

@aimane-chnaif thanks for linking that discussion. You're correct, our resources were not up to date, but we're updating them now. We're all done here!

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. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests