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

[PAID] [$1000] Markdown - ~~~hello~~~ is inconsistent with other markdown like ***hello*** #25693

Closed
1 of 6 tasks
lanitochka17 opened this issue Aug 22, 2023 · 55 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

@lanitochka17
Copy link

lanitochka17 commented Aug 22, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Action Performed:

Precondition: Logged into the Expensify App

  1. Open any chat between 2 people
  2. Tap the message field
  3. Type hello and tap the enter key on the mobile keyboard
  4. Type ~~~hello~~~ and tap the send icon

Expected Result:

Strikethrough should cross the word "hello" only

Actual Result:

Strikethrough crosses the word "hello" and other characters

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.3.56-2

Reproducible in staging?: Yes

Reproducible in production?: Yes

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

Bug6173398_inconsistent_markdown.mp4

Bug6173398_inconsistent_markdown

Expensify/Expensify Issue URL:

Issue reported by: Applause - Internal Team

Slack conversation:

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01f3068ef97b3f01cd
  • Upwork Job ID: 1694481963681234944
  • Last Price Increase: 2023-08-30
  • Automatic offers:
    • akamefi202 | Contributor | 26421098
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Aug 22, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 22, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 22, 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

@akamefi202
Copy link
Contributor

Proposal

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

Strikethrough markdown(~~~hello~~~) doesn't cross the word "hello" only.

What is the root cause of that problem?

I think the problem is replace regex of strikethrough markdown in expensify-common repo.

/\B~((?=\S)((~~(?!~)|[^\s~]|\s(?!~))+?))~\B(?![^<]*(<\/pre>|<\/code>|<\/a>))/g

https://github.com/Expensify/expensify-common/blob/7735de14112a968fd6a4f5af710d2fbaefc8809d/lib/ExpensiMark.js#L207-L209

There is ~~(?!~) part so <del> tag will include two ~ characters if the markdown contains multiple ~ characters before content text.

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

We need to update the replace regex rule of strikethrough markdown by removing ~~(?!~) part.

/\B~((?=\S)(([^\s~]|\s(?!~))+?))~\B(?![^<]*(<\/pre>|<\/code>|<\/a>))/g

I tried jest test in expensify-common repo and confirmed that the updated regex won't regress previous issues.

What alternative solutions did you explore? (Optional)

N/A

@strepanier03
Copy link
Contributor

Testing this now, was having an issue this morning with the Android app.

@strepanier03
Copy link
Contributor

Following the steps as described I can easily recreate this on Android New Expensify app.

image

@strepanier03 strepanier03 added the External Added to denote the issue can be worked on by a contributor label Aug 23, 2023
@melvin-bot melvin-bot bot changed the title Markdown - ~~~hello~~~ is inconsistent with other markdown like ***hello*** [$1000] Markdown - ~~~hello~~~ is inconsistent with other markdown like ***hello*** Aug 23, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 23, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01f3068ef97b3f01cd

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

melvin-bot bot commented Aug 23, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 23, 2023

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

@Krishna2323
Copy link
Contributor

Krishna2323 commented Aug 25, 2023

Proposal

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

Strikethrough markdown(~~~hello~~~) doesn't cross the word "hello" only.

What is the root cause of that problem?

The problem is with the regex & the part of the regex causing the unexpected behavior is the ~~(?!~). In the given input ~~~text~~~, after the first tilde is matched, the regex finds two tildes not followed by another tilde, so it captures those two tildes as well as the word text. This is why we get the result with ~~text struck through and the trailing tildes remaining untouched.

https://github.com/Expensify/expensify-common/blob/7735de14112a968fd6a4f5af710d2fbaefc8809d/lib/ExpensiMark.js#L207-L209

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

To modify the regex to strike through content only if there is one opening and one closing tilde, we just need to make a few adjustments:

/\B(?<!~)~((?=\S)([^\s~]|\s(?!~))+?)(?<!~)~(?!~)\B(?![^<]*(<\/pre>|<\/code>|<\/a>))/g

The only change is adding another (?<!~) before the second tilde to ensure that it's not immediately preceded by another tilde. This ensures that we only strike through content surrounded by single tildes on each side.

Slack like implementation:

We can update the regex to work only if there is only one tilde on both sides & ignore if there is more than one. Thats how slack also works.

What alternative solutions did you explore? (Optional)

We can also strike through text if there is one or two tilde on both sides.

Result (Slack like implementation)

bug_demo.mp4

@Krishna2323
Copy link
Contributor

@strepanier03 @parasharrajat, can we confirm what is the expected result here.
I think we can just handle this like Slack does. proposal

@parasharrajat
Copy link
Member

Will be checking it today...

@malaki12003
Copy link

Proposal
Please re-state the problem that we are trying to solve in this issue.
The existing functionality of the strikethrough markdown (~~~hello~~~) demonstrates a deficiency in effectively crossing out solely the word "hello." Our objective is to exclusively apply the strikethrough formatting to the text enclosed between the innermost pairs of tildes ('~').

What is the root cause of that problem?

The fundamental issue stems from the regular expression (regex) utilized within the expensify-common library, specifically the segment ~~(?!). Detecting two consecutive sequences of '' within this portion appears redundant. A more sensible approach would involve capturing the text between a single tilde and its subsequent counterpart, effectively encompassing the intended content.

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

I suggest to use a simpler version of the regex and remove double ~ checking like the following:
\B~((?=\S)([^~]+?))~\B(?![^<]*(</pre>|</code>|</a>))

What alternative solutions did you explore? (Optional)

Similar to the approach used for bolding, I believe we could apply the same strategy, but instead of crossing out the text between the two innermost pairs of tildes, we would do it for the outermost pairs.

Result:
Screenshot 2023-08-26 at 1 33 38 PM

Screenshot 2023-08-26 at 1 34 00 PM

@melvin-bot
Copy link

melvin-bot bot commented Aug 26, 2023

📣 @malaki12003! 📣
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>

@malaki12003
Copy link

Contributor details
Your Expensify account email: [email protected]
Upwork Profile Link: https://www.upwork.com/freelancers/~014a16efe272767102

@melvin-bot
Copy link

melvin-bot bot commented Aug 26, 2023

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

@parasharrajat
Copy link
Member

@Krishna2323 Can you add more details about how will you solve this? I just see theory.

@parasharrajat
Copy link
Member

parasharrajat commented Aug 27, 2023

@akamefi202's proposal looks good to me. Please make sure all tests pass and the pass issue does not pop up again.

🎀 👀 🎀 C+ reviewed

@melvin-bot
Copy link

melvin-bot bot commented Aug 27, 2023

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

@Krishna2323
Copy link
Contributor

Krishna2323 commented Aug 27, 2023

@parasharrajat, I updated my proposal, @akamefi202 proposal will fail in some cases. I think it's better to ignore multiple tilde because they might cause some issues, GitHub & Slack also does the same.
Test with: ~test ~test~~

bug_demo_proposal.mp4

@melvin-bot melvin-bot bot added the Overdue label Aug 29, 2023
@strepanier03
Copy link
Contributor

@parasharrajat - Friendly bump on the proposal update you asked for from @Krishna2323. Thanks!

@melvin-bot melvin-bot bot removed the Overdue label Aug 29, 2023
@melvin-bot melvin-bot bot changed the title [$1000] Markdown - ~~~hello~~~ is inconsistent with other markdown like ***hello*** [HOLD for payment 2023-09-20] [$1000] Markdown - ~~~hello~~~ is inconsistent with other markdown like ***hello*** Sep 13, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Sep 13, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 13, 2023

Reviewing label has been removed, please complete the "BugZero Checklist".

@melvin-bot
Copy link

melvin-bot bot commented Sep 13, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.68-17 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-09-20. 🎊

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 - N/A internal report
  • Contributor that fixed the issue - @akamefi202 - $1000 + $500 (speed bonus) = $1500 (Upwork)
  • Contributor+ that helped on the issue and/or PR - @parasharrajat - $1000 + $500 (speed bonus) = $1500 (MR)

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

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 13, 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:

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Sep 19, 2023
@akamefi202
Copy link
Contributor

@parasharrajat Could you please close this issue if there isn't any problem?

@parasharrajat
Copy link
Member

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:

Regression Test Steps

  1. Open any chat in the app.
  2. Type ~~~hello~~~ and send the message.
  3. Check if strikethrough crosses the word "hello" only and if it has two tilde characters before & after.
  4. Type ~~~~ and send the message.
  5. Observe that it is sent as normal text and message has same four ~.

Do you agree 👍 or 👎 ?

@jeet-dhandha
Copy link
Contributor

@parasharrajat A suggestion - we should ask in slack channel on what more markdown issues / expectations are there and then include all those expectations as test cases in our regex tests.

@jeet-dhandha
Copy link
Contributor

So that no more regex related bugs happen in future. And also we can ask for future/current regex requirements so that we can handle those in the regex and also add test cases related to it.

@parasharrajat
Copy link
Member

parasharrajat commented Sep 20, 2023

I have already done that. I will ping the thread again.

@strepanier03
Copy link
Contributor

Working on payment and regression test stuff now, will have an update shortly.

@strepanier03
Copy link
Contributor

@parasharrajat - The bonus comment isn't taking into consideration the merge freeze. I don't want to deny the speed bonus if it should be eligible because the merge freeze wasn't accounted for.

With the merge freeze considered, should the bonus get paid here? It looks like it should from this PR.

@parasharrajat
Copy link
Member

It is a little complicated. There are two PRs and the first PR was created for the e-common repo which was held for merge freeze. Thus we couldn't create a second PR before the merge freeze. The first PR was ready to merge within a day and the second one was created only to update the version.

Given this, I think it would have been merged within 3 days and thus should be applicable. @strepanier03

@strepanier03
Copy link
Contributor

Thank you for weighing in @parasharrajat, I agree with your comments and that's the sense I got as well from viewing the two PRs.

I will move forward with finalizing this and appreciate your quick response.

I'll update once this is ready to close.

@strepanier03
Copy link
Contributor

strepanier03 commented Sep 21, 2023

Payment summary

  • External issue reporter - N/A internal report
  • Contributor that fixed the issue - @akamefi202 - $1000 + $500 (speed bonus) = $1500 (Upwork)
  • Contributor+ that helped on the issue and/or PR - @parasharrajat - $1000 + $500 (speed bonus) = $1500 (MR)

@strepanier03
Copy link
Contributor

strepanier03 commented Sep 21, 2023

@parasharrajat - Please feel free to put in your Manual Request for payment and let me know when you do. I'll assign Jason at that point to do the payment.

@akamefi202 - You're paid out via Upwork and I closed the contract.

Thank you both for your work here and being part of the community.

@melvin-bot melvin-bot bot added the Overdue label Sep 25, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 25, 2023

@tylerkaraszewski, @strepanier03, @parasharrajat, @akamefi202 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@parasharrajat
Copy link
Member

Thanks @strepanier03 Feel free to close this, I can track payment in closed state.

@melvin-bot melvin-bot bot removed the Overdue label Sep 26, 2023
@strepanier03
Copy link
Contributor

Awesome, I'll assign Jason and close this out.

@strepanier03
Copy link
Contributor

@JmillsExpensify - Payment summary here.

Request is submitted and I'm closing now. Cheers!

@strepanier03 strepanier03 changed the title [HOLD for payment 2023-09-20] [$1000] Markdown - ~~~hello~~~ is inconsistent with other markdown like ***hello*** [PAID] [$1000] Markdown - ~~~hello~~~ is inconsistent with other markdown like ***hello*** Sep 27, 2023
@parasharrajat
Copy link
Member

Payment requested as per #25693 (comment)

@JmillsExpensify
Copy link

$1,500 payment approved for @parasharrajat based on BZ summary.

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

9 participants