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-09-06] [$2000] Web - The backtick is outside the code block when sending a message with two backticks #23352

Closed
1 of 6 tasks
kbecciv opened this issue Jul 21, 2023 · 59 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

@kbecciv
Copy link

kbecciv commented Jul 21, 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
  2. Send a text wrapped in two backticks

Expected Result:

Backtick should be in the code block

Actual Result:

One Backtick is out of the code block

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.43-6
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

Test79_Backtick-1.mp4
Recording.3809.mp4

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

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01f54ca2df0a387770
  • Upwork Job ID: 1684220588166258688
  • Last Price Increase: 2023-08-09
  • Automatic offers:
    • abdulrahuman5196 | Reviewer | 26116411
    • daveSeife | Reporter | 26116415
@kbecciv kbecciv added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 21, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 21, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jul 21, 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

@samh-nl
Copy link
Contributor

samh-nl commented Jul 21, 2023

Proposal

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

Using two backticks leads to an incorrect processing of a code block.

What is the root cause of that problem?

The regular expression that is used for recognizing code blocks uses 'lazy' matching, as opposed to 'greedy' matching which is required in this case.

https://github.com/Expensify/expensify-common/blob/fea1a755affabdbb8b6d7c5b754241849124f488/lib/ExpensiMark.js#L45-L52

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

The last question mark inside (.*?\S.*?) should be removed to get the desired result.

Lastly, we could check for similar problems in the regular expressions of other markdown processing rules, such as the triple backtick block.

What alternative solutions did you explore? (Optional)

Option 1. Expand the regular expression to include an optional second backtick.
Option 2. Only expand the matching if the subsequent backtick(s) directly follow each other, i.e. without other characters in between. This involves adding (`)* to the regular expression (see below) and changing $3 to $4.

regex: /(\B|_|)&#x60;(.*?\S.*?(&#x60;)*)&#x60;(\B|_|)(?![^<]*<\/pre>)/g,
replacement: '$1<code>$2</code>$4',

Edit: Updated proposal

@melvin-bot melvin-bot bot added the Overdue label Jul 24, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 24, 2023

@muttmuure Whoops! This issue is 2 days overdue. Let's get this updated quick!

@muttmuure
Copy link
Contributor

@melvin-bot melvin-bot bot removed the Overdue label Jul 26, 2023
@muttmuure muttmuure added the External Added to denote the issue can be worked on by a contributor label Jul 26, 2023
@melvin-bot melvin-bot bot changed the title Web - The backtick is outside the code block when sending a message with two backticks [$1000] Web - The backtick is outside the code block when sending a message with two backticks Jul 26, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 26, 2023

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

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

melvin-bot bot commented Jul 26, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jul 26, 2023

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

@manan-upadhyay
Copy link

manan-upadhyay commented Jul 26, 2023

I think this issue can be fixed as follows:

  • We can check if there are two backticks in a message together with a word, and we can escape the inner backticks so that they would be rendered as normal text

@melvin-bot
Copy link

melvin-bot bot commented Jul 26, 2023

📣 @manan-upadhyay! 📣
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>

@manan-upadhyay
Copy link

Contributor details
Your Expensify account email: upadhyaymanan01@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~0122e0ed8ca6eca7fa

@melvin-bot
Copy link

melvin-bot bot commented Jul 26, 2023

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

@Victor-Nyagudi
Copy link
Contributor

This issue seems like a likely candidate to be added to the markdown tracking issue.

A discussion was held in Slack about another issue involving backticks, and the consensus was it's better not to overcomplicate the code blocks' regular expressions for certain scenarios.

I'd like to hear your thoughts on this one, @greg-schroeder, since you took part in the Slack discussion.

@melvin-bot melvin-bot bot added the Overdue label Jul 28, 2023
@abdulrahuman5196
Copy link
Contributor

Reviewing today

@melvin-bot melvin-bot bot removed the Overdue label Jul 31, 2023
@Antasel
Copy link
Contributor

Antasel commented Aug 1, 2023

Proposal

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

text wrapped in two backticks is not parsed properly with code block, one backtick is out of code block.

What is the root cause of that problem?

in inline codeblock rule's regex pattern is using lazy mode to get code block content, so last backtick is not contained in code block content.

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

to fix the root cause, add a tweak(adding a backtick option in negative lookahead) on inline codeblock's regex pattern
which would be like following after fixed.

regex: /(\B|_|)&#x60;(.*?\S.*?)&#x60;(\B|_|)(?!&#x60;|[^<]*<\/pre>)/g,

relevant test case is like below

const testString = '``JavaScript``';
expect(parser.replace(testString)).toBe('<code>&#x60;JavaScript&#x60;</code>');

it doesn't make other auto test cases failed, all passed.

@melvin-bot
Copy link

melvin-bot bot commented Aug 2, 2023

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@melvin-bot melvin-bot bot added the Overdue label Aug 2, 2023
@muttmuure muttmuure changed the title [$1000] Web - The backtick is outside the code block when sending a message with two backticks [$2000] Web - The backtick is outside the code block when sending a message with two backticks Aug 2, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 2, 2023

Upwork job price has been updated to $2000

@jasperhuangg
Copy link
Contributor

Thanks @Antasel! Taking a look

@melvin-bot
Copy link

melvin-bot bot commented Aug 25, 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 @Antasel got assigned: 2023-08-14 17:01:29 Z
  • when the PR got merged: 2023-08-25 19:28:35 UTC
  • days elapsed: 9

On to the next one 🚀

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Aug 30, 2023
@melvin-bot melvin-bot bot changed the title [$2000] Web - The backtick is outside the code block when sending a message with two backticks [HOLD for payment 2023-09-06] [$2000] Web - The backtick is outside the code block when sending a message with two backticks Aug 30, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Aug 30, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 30, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 30, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.58-5 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-06. 🎊

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

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 Aug 30, 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:

  • [@abdulrahuman5196] The PR that introduced the bug has been identified. Link to the PR:
  • [@abdulrahuman5196] 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:
  • [@abdulrahuman5196] 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:
  • [@abdulrahuman5196] Determine if we should create a regression test for this bug.
  • [@abdulrahuman5196] 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.
  • [@muttmuure] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@abdulrahuman5196
Copy link
Contributor

The PR that introduced the bug has been identified. Link to the PR:
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:
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:

Not a regression. This issue is present from implementation.

Determine if we should create a regression test for this bug.
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.

No. We have already added Unit test cases to common package.

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

Antasel commented Sep 7, 2023

@abdulrahuman5196 @muttmuure
We are still in regression period ? I think it's over.
And I am not sure how can I get offer on Upwork .

@melvin-bot
Copy link

melvin-bot bot commented Sep 11, 2023

@jasperhuangg, @abdulrahuman5196, @muttmuure, @Antasel Whoops! This issue is 2 days overdue. Let's get this updated quick!

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

melvin-bot bot commented Sep 11, 2023

@jasperhuangg, @abdulrahuman5196, @muttmuure, @Antasel Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@Antasel
Copy link
Contributor

Antasel commented Sep 13, 2023

@jasperhuangg @muttmuure
Looks like a week passed. Do we have any update to move forward 😄

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Sep 13, 2023
@muttmuure
Copy link
Contributor

Catching up from OOO and looking today

@melvin-bot melvin-bot bot removed the Overdue label Sep 18, 2023
@muttmuure
Copy link
Contributor

Reporter $250 - @daveSeife
C $2000 - @Antasel
C+ $2000 - @abdulrahuman5196

@Antasel
Copy link
Contributor

Antasel commented Sep 18, 2023

@muttmuure Thanks, Accepted offer

@melvin-bot melvin-bot bot added the Overdue label Sep 20, 2023
@muttmuure
Copy link
Contributor

@Antasel paid

@melvin-bot melvin-bot bot removed the Overdue label Sep 21, 2023
@muttmuure
Copy link
Contributor

@daveSeife paid

@muttmuure
Copy link
Contributor

@abdulrahuman5196 paid

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