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-06-28] [$1000] When sending h_ello_ , only _ello_ is sent #20111

Closed
1 of 6 tasks
kavimuru opened this issue Jun 2, 2023 · 46 comments
Closed
1 of 6 tasks
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 Jun 2, 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. Open ND
  2. Open any chat and send message h_ello_

Expected Result:

Normal text h_ello_ is sent

Actual Result:

Italic text ello is sent

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

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.3.22-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: Any additional supporting documentation

Video_2023-06-01_124931.mp4
Recording.861.mp4

Expensify/Expensify Issue URL:
Issue reported by: @s-alves10
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1685635565083259

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0182558b3d97b80b80
  • Upwork Job ID: 1665793077552652288
  • Last Price Increase: 2023-06-05
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jun 2, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 2, 2023

Triggered auto assignment to @tjferriss (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot
Copy link

melvin-bot bot commented Jun 2, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@eh2077
Copy link
Contributor

eh2077 commented Jun 3, 2023

Proposal

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

When sending h_ello_ , only ello is sent. After comparing this feature on other Apps, like Slack and Github, I found that they don't parse it. So I tend to think that we shouldn't parse it also.

What is the root cause of that problem?

The root cause of this issue is that the regex

/(?!_blank")[^\W_]?_((?![\s_])[\s\S]*?[^\s_])_(?![^\W_])(?![^<]*(<\/pre>|<\/code>|<\/a>|_blank))/g

of italic rule matches a character of [a-zA-Z0-9] through regex piece [^\W_]? before the italic syntax.

See regex test screenshot below

image

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

To fix this issue, we should ensure the preceding of the starting underscore _ is either

  1. a word boundary \b or
  2. a word boundary followed by underscores \b_+

To achieve it, we can change the regex

/(?!_blank")[^\W_]?_((?![\s_])[\s\S]*?[^\s_])_(?![^\W_])(?![^<]*(<\/pre>|<\/code>|<\/a>|_blank))/g

of italic rule to

/(\b_+|\b)(?!_blank")_((?![\s_])[\s\S]*?[^\s_])_(?![^\W_])(?![^<]*(<\/pre>|<\/code>|<\/a>|_blank))/g

by removing [^\W_]? and adding capturing group (\b_+|\b) to the beginning.

So, the group 1 is underscores before italic syntax and the group 2 is the text of italic syntax, see regex test screenshot

image

We also change the replacement method from

replacement: (match, g1) => (g1.includes('<pre>') || this.containsNonPairTag(g1) ? match : `<em>${g1}</em>`),

to

// We add g1 which is underscores or empty string back before the <em> tag
replacement: (match, g1, g2) => (g2.includes('<pre>') || this.containsNonPairTag(g2) ? match : `${g1}<em>${g2}</em>`),

By doing so, the input

h_ello_

won't be translated into html and won't break existing unit test cases of expensify-common.

Below test cases will be helpful to verify the solution

hello_world
hello__world
_hello_
___hello_
___hello______

What alternative solutions did you explore? (Optional)

To fix this issue we can use a capture group to wrap [^\W_]? and skip rendering if the capturing is not empty.

We can change the regex

/(?!_blank")[^\W_]?_((?![\s_])[\s\S]*?[^\s_])_(?![^\W_])(?![^<]*(<\/pre>|<\/code>|<\/a>|_blank))/g

of italic rule to

/(?!_blank")([^\W_]?)_((?![\s_])[\s\S]*?[^\s_])_(?![^\W_])(?![^<]*(<\/pre>|<\/code>|<\/a>|_blank))/g

So, the group 1 is the legal character before italic syntax and the group 2 is the text of italic syntax.

We also change the replacement method from

replacement: (match, g1) => (g1.includes('<pre>') || this.containsNonPairTag(g1) ? match : `<em>${g1}</em>`),

to

replacement: (match, g1, g2) => (g1 || g2.includes('<pre>') || this.containsNonPairTag(g2) ? match : `<em>${g2}</em>`),

But there's a drawback of this solution because the regex doesn't skip matching early. For example, for following input

hello_world
_hello_

_hello_ won't be rendered as italic because it's consumed and skipped, see

image

@dummy-1111
Copy link
Contributor

@eh2077 We shouldn't parse h_ello_. It should be sent as is.

@eh2077
Copy link
Contributor

eh2077 commented Jun 3, 2023

@s-alves10 Yes, I was just doing markdown syntax comparing on other Apps. Many of them, like Slack and Github don’t parse it. So I covered it if we don't want to parse it also.

@melvin-bot
Copy link

melvin-bot bot commented Jun 3, 2023

📣 @code2learn! 📣
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:

  1. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  2. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  3. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@melvin-bot melvin-bot bot added the Overdue label Jun 5, 2023
@tjferriss tjferriss added the External Added to denote the issue can be worked on by a contributor label Jun 5, 2023
@melvin-bot melvin-bot bot changed the title When sending h_ello_ , only _ello_ is sent [$1000] When sending h_ello_ , only _ello_ is sent Jun 5, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 5, 2023

Job added to Upwork: https://www.upwork.com/jobs/~0182558b3d97b80b80

@melvin-bot
Copy link

melvin-bot bot commented Jun 5, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jun 5, 2023

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

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

melvin-bot bot commented Jun 5, 2023

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

@aidear3
Copy link

aidear3 commented Jun 5, 2023

Contributor details
Your Expensify account email: javsfdev323@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~01b7fc496875b2b3dd

@melvin-bot
Copy link

melvin-bot bot commented Jun 5, 2023

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

@tjferriss
Copy link
Contributor

Reproduced and added External label.

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Jun 5, 2023
@tjferriss
Copy link
Contributor

@mollfpr what do you think about @eh2077 proposal? #20111 (comment)

@melvin-bot melvin-bot bot removed the Overdue label Jun 7, 2023
@mollfpr
Copy link
Contributor

mollfpr commented Jun 8, 2023

@tjferriss thanks for the ping! I’ll give it feedback soon!

@mollfpr
Copy link
Contributor

mollfpr commented Jun 8, 2023

@tjferriss @amyevans I have tested the @eh2077 and the proposal looks good to me!

🎀 👀 🎀 C+ reviewed!

@melvin-bot melvin-bot bot added the Overdue label Jun 12, 2023
@mollfpr
Copy link
Contributor

mollfpr commented Jun 12, 2023

Bump @tjferriss @amyevans

@amyevans
Copy link
Contributor

Shouldn't the automated tests be sufficient to catch any regressions in this case, instead of introducing a manual regression test?

@mollfpr
Copy link
Contributor

mollfpr commented Jun 29, 2023

@amyevans Yes! I forgot about that. I guess we could skip the regression step.

@melvin-bot melvin-bot bot added the Overdue label Jul 3, 2023
@mollfpr
Copy link
Contributor

mollfpr commented Jul 3, 2023

Friendly bump @tjferriss

@melvin-bot melvin-bot bot removed the Overdue label Jul 3, 2023
@amyevans amyevans added Bug Something is broken. Auto assigns a BugZero manager. and removed Bug Something is broken. Auto assigns a BugZero manager. labels Jul 5, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 5, 2023

Triggered auto assignment to @flaviadefaria (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot
Copy link

melvin-bot bot commented Jul 5, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@amyevans
Copy link
Contributor

amyevans commented Jul 5, 2023

@flaviadefaria This is just due payment, if you could please handle (since TJ is OOO). Thanks!

@flaviadefaria
Copy link
Contributor

@s-alves10 = $250
@mollfpr = $1000 (no bonus based on this)
@eh2077 = $1000 (no bonus based on this)

I'll send out the offers in UW.

@flaviadefaria
Copy link
Contributor

@mollfpr and @eh2077 I can't find you in UW can you send me your profile name here? Thanks!

@eh2077
Copy link
Contributor

eh2077 commented Jul 5, 2023

Based on my calculations, the pull request did not get merged within 3 working days of assignment. Please, check out my computations here:

  • when @eh2077 got assigned: 2023-06-12 17:23:34 Z
  • when the PR got merged: 2023-06-15 14:24:40 UTC
  • days elapsed: 3

On to the next one 🚀

@flaviadefaria Thanks for checking the payment. I think bonus should be applicable based the timeline above. It looks like Kelvin had a bug then. Can you search Eric Han for my UW profile?

@flaviadefaria
Copy link
Contributor

Can you search Eric Han for my UW profile?

I did and couldn't find it, can you link it here?

@mollfpr
Copy link
Contributor

mollfpr commented Jul 6, 2023

@melvin-bot melvin-bot bot added the Overdue label Jul 10, 2023
@flaviadefaria
Copy link
Contributor

Offers sent, I'll add the bonus once the offer is accepted.

@melvin-bot melvin-bot bot removed the Overdue label Jul 10, 2023
@mollfpr
Copy link
Contributor

mollfpr commented Jul 10, 2023

Accepted the offer, thank you @flaviadefaria

@eh2077
Copy link
Contributor

eh2077 commented Jul 10, 2023

@flaviadefaria Accepted the offer thanks!

@flaviadefaria
Copy link
Contributor

Paid!

@dummy-1111
Copy link
Contributor

@flaviadefaria

I wasn't paid for this issue. I'm the issue reporter

@amyevans amyevans reopened this Jul 11, 2023
@flaviadefaria
Copy link
Contributor

Oh @s-alves10 I thought I had already paid you, sorry about that! I just sent you the offer in UW!

@flaviadefaria
Copy link
Contributor

I'll close this again now and will pay you as soon as you accept the offer :)

@dummy-1111
Copy link
Contributor

@flaviadefaria
Offer accepted. thanks

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

8 participants